473,804 Members | 3,697 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();

CachedRowSetDat aProvider pro_allocDataPr ovider = bean.getProject _allocateDataPr ovider();

try {

if(pro_allocDat aProvider.getRo wCount()>0) {

pro_allocDataPr ovider.cursorFi rst();
do {

if (pro_allocDataP rovider.getValu e("project_allo cate.project_id ").toString().e quals(name)) {
System.out.prin tln(name);
pro_allocDataPr ovider.setValue ("project_alloc ate.project_id" , this.getProject _id().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.project_nam e", this.getName(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.owner", this.getOwner() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ISV", this.getISV_nam e().getText().t oString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.start_date" , this.getStart_d ate().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.end_date", this.getEnd_dat e().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ptype", this.getProject _type().getSele cted().toString () );
pro_allocDataPr ovider.setValue ("project_alloc ate.location", this.getLocatio n().getSelected ().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.scope", this.getScope() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.isvvisit", this.getISV_vis it().getSelecte d().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.network", this.getNetwork ().getSelected( ).toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.addition", this.getAdditio nal().getText() .toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.DBOS", this.getDbos(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.model", this.getModel() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.memory", this.getMemory( ).getText().toS tring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.cpu", this.getCpu().g etText().toStri ng() );
//
pro_allocDataPr ovider.commitCh anges();
}

} while (pro_allocDataP rovider.cursorN ext());

}
info ("Hardware details updated successfully.") ;
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessag e());
}
return null;
}
Oct 3 '07 #1
3 2304
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();

CachedRowSetDat aProvider pro_allocDataPr ovider = bean.getProject _allocateDataPr ovider();

try {

if(pro_allocDat aProvider.getRo wCount()>0) {

pro_allocDataPr ovider.cursorFi rst();
do {

if (pro_allocDataP rovider.getValu e("project_allo cate.project_id ").toString().e quals(name)) {
System.out.prin tln(name);
pro_allocDataPr ovider.setValue ("project_alloc ate.project_id" , this.getProject _id().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.project_nam e", this.getName(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.owner", this.getOwner() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ISV", this.getISV_nam e().getText().t oString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.start_date" , this.getStart_d ate().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.end_date", this.getEnd_dat e().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ptype", this.getProject _type().getSele cted().toString () );
pro_allocDataPr ovider.setValue ("project_alloc ate.location", this.getLocatio n().getSelected ().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.scope", this.getScope() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.isvvisit", this.getISV_vis it().getSelecte d().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.network", this.getNetwork ().getSelected( ).toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.addition", this.getAdditio nal().getText() .toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.DBOS", this.getDbos(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.model", this.getModel() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.memory", this.getMemory( ).getText().toS tring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.cpu", this.getCpu().g etText().toStri ng() );
//
pro_allocDataPr ovider.commitCh anges();
}

} while (pro_allocDataP rovider.cursorN ext());

}
info ("Hardware details updated successfully.") ;
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessag e());
}
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.NullP ointerException

CachedRowSetDat aProvider pro_allocDataPr ovider = bean.getProject _allocateDataPr ovider();

try {

if(pro_allocDat aProvider.getRo wCount()>0) {

pro_allocDataPr ovider.cursorFi rst();
do {

if (pro_allocDataP rovider.getValu e("project_allo cate.project_id ").toString().e quals(name)) {
System.out.prin tln(name);
pro_allocDataPr ovider.setValue ("project_alloc ate.project_id" , this.getProject _id().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.project_nam e", this.getName(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.owner", this.getOwner() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ISV", this.getISV_nam e().getText().t oString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.start_date" , this.getStart_d ate().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.end_date", this.getEnd_dat e().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ptype", this.getProject _type().getSele cted().toString () );
pro_allocDataPr ovider.setValue ("project_alloc ate.location", this.getLocatio n().getSelected ().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.scope", this.getScope() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.isvvisit", this.getISV_vis it().getSelecte d().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.network", this.getNetwork ().getSelected( ).toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.addition", this.getAdditio nal().getText() .toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.DBOS", this.getDbos(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.model", this.getModel() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.memory", this.getMemory( ).getText().toS tring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.cpu", this.getCpu().g etText().toStri ng() );
//
pro_allocDataPr ovider.commitCh anges();
}

} while (pro_allocDataP rovider.cursorN ext());

}
info ("Hardware details updated successfully.") ;
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessag e());
}
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.NullP ointerException

CachedRowSetDat aProvider pro_allocDataPr ovider = bean.getProject _allocateDataPr ovider();

try {

if(pro_allocDat aProvider.getRo wCount()>0) {

pro_allocDataPr ovider.cursorFi rst();
do {

if (pro_allocDataP rovider.getValu e("project_allo cate.project_id ").toString().e quals(name)) {
System.out.prin tln(name);
pro_allocDataPr ovider.setValue ("project_alloc ate.project_id" , this.getProject _id().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.project_nam e", this.getName(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.owner", this.getOwner() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ISV", this.getISV_nam e().getText().t oString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.start_date" , this.getStart_d ate().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.end_date", this.getEnd_dat e().getText() );
pro_allocDataPr ovider.setValue ("project_alloc ate.ptype", this.getProject _type().getSele cted().toString () );
pro_allocDataPr ovider.setValue ("project_alloc ate.location", this.getLocatio n().getSelected ().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.scope", this.getScope() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.isvvisit", this.getISV_vis it().getSelecte d().toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.network", this.getNetwork ().getSelected( ).toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.addition", this.getAdditio nal().getText() .toString() );
pro_allocDataPr ovider.setValue ("project_alloc ate.DBOS", this.getDbos(). getText().toStr ing() );
pro_allocDataPr ovider.setValue ("project_alloc ate.model", this.getModel() .getText().toSt ring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.memory", this.getMemory( ).getText().toS tring() );
pro_allocDataPr ovider.setValue ("project_alloc ate.cpu", this.getCpu().g etText().toStri ng() );
//
pro_allocDataPr ovider.commitCh anges();
}

} while (pro_allocDataP rovider.cursorN ext());

}
info ("Hardware details updated successfully.") ;
return "case1";
} catch (Exception ex) {
log("Error Description", ex);
error("Error :"+ex.getMessag e());
}
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
58138
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 were going to look :) . Here is my current dilemma: I am having a strange problem with my ASP.NET application. I am building the application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I have frequently been getting the following...
5
24733
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 s); public void Deserialize(Stream s); Within the MyUserControl class, there is a field of type MyInnerClass
5
2182
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
2853
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") && !key.Equals("__EVENTARGUMENT") && !key.Equals("__EVENTTARGET") && key.IndexOf("sendButton")<0 && key.IndexOf("clearButton")<0
18
2981
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) int main() { try{ int* p = NULL; *p = 4;
3
2071
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: System.NullReferenceException: Object reference not set to an instance of an object
7
1782
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) { this.Invoke(new MyCallback(CallbackProc), new object {
2
2148
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* ptr)
11
3271
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 my object is destroyed, I want my object to un-register this event. If I don't then the object would never be destroyed until the object I passed in the constructor is destroyed. I have implemented a Dispose(), Dispose(bool), and ~Finalize...
2
3107
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 transactionStatement; import javax.xml.transform.TransformerFactory; import javax.servlet.*; import org.jdom.*; import java.io.ByteArrayOutputStream; import java.io.File;
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5521
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4299
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 we have to send another system
3
2991
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.