473,508 Members | 3,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Null Exception

3 New Member
I have implemented a code for one form its name is hardware form and first i will enter data it will take it and after enetering the second time it is gving me an null pointer exception it is not allowing me to update this form please can any one help me out.
Regards,
rahul.

Code where it is giving error is (in editing):


public String add_action() {

RequestBean1 bean = getRequestBean1();
String name= this.getProject_id().getText().toString();

CachedRowSetDataProvider pro_allocDataProvider = bean.getProject_allocateDataProvider();

try {

if(pro_allocDataProvider.getRowCount()>0) {

pro_allocDataProvider.cursorFirst();
do {

if (pro_allocDataProvider.getValue("project_allocate. project_id").toString().equals(name)) {
System.out.println(name);
pro_allocDataProvider.setValue("project_allocate.p roject_id", this.getProject_id().getText());
pro_allocDataProvider.setValue("project_allocate.p roject_name", this.getName().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.o wner", this.getOwner().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.I SV", this.getISV_name().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.s tart_date", this.getStart_date().getText());
pro_allocDataProvider.setValue("project_allocate.e nd_date", this.getEnd_date().getText() );
pro_allocDataProvider.setValue("project_allocate.p type", this.getProject_type().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.l ocation", this.getLocation().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.s cope", this.getScope().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.i svvisit", this.getISV_visit().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.n etwork", this.getNetwork().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.a ddition", this.getAdditional().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.D BOS", this.getDbos().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m odel", this.getModel().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m emory", this.getMemory().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.c pu", this.getCpu().getText().toString() );
//
pro_allocDataProvider.commitChanges();
}

} while (pro_allocDataProvider.cursorNext());

}
info ("Hardware details updated successfully.");
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessage());
}
return null;
}
Oct 3 '07 #1
3 2291
r035198x
13,262 MVP
I have implemented a code for one form its name is hardware form and first i will enter data it will take it and after enetering the second time it is gving me an null pointer exception it is not allowing me to update this form please can any one help me out.
Regards,
rahul.

Code where it is giving error is (in editing):


public String add_action() {

RequestBean1 bean = getRequestBean1();
String name= this.getProject_id().getText().toString();

CachedRowSetDataProvider pro_allocDataProvider = bean.getProject_allocateDataProvider();

try {

if(pro_allocDataProvider.getRowCount()>0) {

pro_allocDataProvider.cursorFirst();
do {

if (pro_allocDataProvider.getValue("project_allocate. project_id").toString().equals(name)) {
System.out.println(name);
pro_allocDataProvider.setValue("project_allocate.p roject_id", this.getProject_id().getText());
pro_allocDataProvider.setValue("project_allocate.p roject_name", this.getName().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.o wner", this.getOwner().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.I SV", this.getISV_name().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.s tart_date", this.getStart_date().getText());
pro_allocDataProvider.setValue("project_allocate.e nd_date", this.getEnd_date().getText() );
pro_allocDataProvider.setValue("project_allocate.p type", this.getProject_type().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.l ocation", this.getLocation().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.s cope", this.getScope().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.i svvisit", this.getISV_visit().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.n etwork", this.getNetwork().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.a ddition", this.getAdditional().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.D BOS", this.getDbos().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m odel", this.getModel().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m emory", this.getMemory().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.c pu", this.getCpu().getText().toString() );
//
pro_allocDataProvider.commitChanges();
}

} while (pro_allocDataProvider.cursorNext());

}
info ("Hardware details updated successfully.");
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessage());
}
return null;
}
1.) Use code tags when posting code.
2.) The exception stacktrace should tell you the exact line number where the exception was thrown.
Oct 3 '07 #2
kalvarahul
3 New Member
1.) Use code tags when posting code.
2.) The exception stacktrace should tell you the exact line number where the exception was thrown.




sorry i will give you a comment at the location (it is in third line i have given comments)
-----------------------------

public String add_action() {

RequestBean1 bean = getRequestBean1();
String name= this.getProject_id().getText().toString();// At this location it is pointing out error and the error is java.lang.NullPointerException

CachedRowSetDataProvider pro_allocDataProvider = bean.getProject_allocateDataProvider();

try {

if(pro_allocDataProvider.getRowCount()>0) {

pro_allocDataProvider.cursorFirst();
do {

if (pro_allocDataProvider.getValue("project_allocate. project_id").toString().equals(name)) {
System.out.println(name);
pro_allocDataProvider.setValue("project_allocate.p roject_id", this.getProject_id().getText());
pro_allocDataProvider.setValue("project_allocate.p roject_name", this.getName().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.o wner", this.getOwner().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.I SV", this.getISV_name().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.s tart_date", this.getStart_date().getText());
pro_allocDataProvider.setValue("project_allocate.e nd_date", this.getEnd_date().getText() );
pro_allocDataProvider.setValue("project_allocate.p type", this.getProject_type().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.l ocation", this.getLocation().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.s cope", this.getScope().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.i svvisit", this.getISV_visit().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.n etwork", this.getNetwork().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.a ddition", this.getAdditional().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.D BOS", this.getDbos().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m odel", this.getModel().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m emory", this.getMemory().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.c pu", this.getCpu().getText().toString() );
//
pro_allocDataProvider.commitChanges();
}

} while (pro_allocDataProvider.cursorNext());

}
info ("Hardware details updated successfully.");
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessage());
}
return null;
}
Oct 3 '07 #3
r035198x
13,262 MVP
sorry i will give you a comment at the location (it is in third line i have given comments)
-----------------------------

public String add_action() {

RequestBean1 bean = getRequestBean1();
String name= this.getProject_id().getText().toString();// At this location it is pointing out error and the error is java.lang.NullPointerException

CachedRowSetDataProvider pro_allocDataProvider = bean.getProject_allocateDataProvider();

try {

if(pro_allocDataProvider.getRowCount()>0) {

pro_allocDataProvider.cursorFirst();
do {

if (pro_allocDataProvider.getValue("project_allocate. project_id").toString().equals(name)) {
System.out.println(name);
pro_allocDataProvider.setValue("project_allocate.p roject_id", this.getProject_id().getText());
pro_allocDataProvider.setValue("project_allocate.p roject_name", this.getName().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.o wner", this.getOwner().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.I SV", this.getISV_name().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.s tart_date", this.getStart_date().getText());
pro_allocDataProvider.setValue("project_allocate.e nd_date", this.getEnd_date().getText() );
pro_allocDataProvider.setValue("project_allocate.p type", this.getProject_type().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.l ocation", this.getLocation().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.s cope", this.getScope().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.i svvisit", this.getISV_visit().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.n etwork", this.getNetwork().getSelected().toString() );
pro_allocDataProvider.setValue("project_allocate.a ddition", this.getAdditional().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.D BOS", this.getDbos().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m odel", this.getModel().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.m emory", this.getMemory().getText().toString() );
pro_allocDataProvider.setValue("project_allocate.c pu", this.getCpu().getText().toString() );
//
pro_allocDataProvider.commitChanges();
}

} while (pro_allocDataProvider.cursorNext());

}
info ("Hardware details updated successfully.");
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessage());
}
return null;
}
You forgot those code tags again.
So now you have the culprit ...
Oct 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
57823
by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they...
5
24663
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
5
2160
by: Boniek | last post by:
Hi I define a public property in a new form and I can see this property in table of Properties in Visual. How I can hide this property to see only in code ? Thank's Boniek
5
2834
by: Tony Cheng | last post by:
for (int i=0; i<_request.Form.Count; i++ ) { string key = _request.Form.GetKey(i); if ( !key.Equals("formCode") && !key.Equals("formLanguage") && !key.Equals("__VIEWSTATE") &&...
18
2950
by: Denis Petronenko | last post by:
Hello, in the following code i have segmentaion fault instead of exception. Why? What i must to do to catch exceptions in such situation? Used compiler: gcc version 3.3.6 (Debian 1:3.3.6-13) ...
3
2060
by: Ganesh Palaniappan | last post by:
We're getting following exception for the below piece of code. We're wondering how it is possible since we're having a null check for objGraphics and strokePen... Exception:...
7
1771
by: news | last post by:
..Net 2.0 Hi, I'm getting a nullreferenceexception when calling a function from a worker thread: private void CallbackProc(string response, Exception ex) { if (this.InvokeRequired) {...
2
2132
by: Weeble | last post by:
Back in C++, I had a type that looked something like this (entering from memory so this might not quite compile): template <class T> class NotNull { private: T* value; public: NotNull(T*...
11
3219
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
2
3083
by: crabsdf | last post by:
My project is a single method class which takes a xml object and, using Apache FOP, transforms it into a PDF which is returned as an output stream. Here is full code package...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7128
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7332
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5057
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.