473,756 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

null pointer exception

3 New Member
public ActionForward edit(ActionMapp ing mapping, ActionForm form,
HttpServletRequ est request, HttpServletResp onse response)
throws Exception {
MissionForm missionForm = (MissionForm) form;

String strMissionId = InsEncr.getSing leton().decrypt (missionForm.ge tMissionId().to String());

Long userEntityTypeI d = getUserEntityTy peId(request);
String strUserEntityTy peId = String.valueOf( userEntityTypeI d);
String actionForward = PARAM_EDIT_MISS ION;
if (!StringUtil.is Empty(strMissio nId)) {
actionForward = handleEditWhenM issionIsNotNew( strMissionId, mapping, request);
} else if (Constants.Enti tyType.NATIONAL .equals(strUser EntityTypeId) ||
Constants.Entit yType.SECTORIAL .equals(strUser EntityTypeId)) {
actionForward = handleAddMissio nWhenEntityIsNa tionalOrSectori al(request);
}

return mapping.findFor ward(actionForw ard);

}

In the above when i execute to add a new item its throwing exception null pointer exception
String strMissionId = InsEncr.getSing leton().decrypt (missionForm.ge tMissionId().to String());

so anyone can get the solution so that it shouldnot throw exception

advance thanks
May 23 '06 #1
3 6813
Banfa
9,065 Recognized Expert Moderator Expert
I would guess that the most likely problem is that form is not a MissionForm and so when you cast it (which is quite a bad idea) to MissionForm and then try to call the GetMissionId member that member does not exist for form causing an exception.

Assuming this is C++ you may wish to consider using dynamic_cast to cast your form ensuring that it is actually possible to do it (and catch the exception that happens if it isn't).
May 23 '06 #2
chramprasad
3 New Member
I would guess that the most likely problem is that form is not a MissionForm and so when you cast it (which is quite a bad idea) to MissionForm and then try to call the GetMissionId member that member does not exist for form causing an exception.

Assuming this is C++ you may wish to consider using dynamic_cast to cast your form ensuring that it is actually possible to do it (and catch the exception that happens if it isn't).


its missionform and missionid is also present but like when executing its taking null value to missionid and displaying nullpointerexce ption.only java
May 24 '06 #3
chramprasad
3 New Member
its missionform and missionid is also present but like when executing its taking null value to missionid and displaying nullpointerexce ption.only java
May 24 '06 #4

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

Similar topics

102
6049
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV" ( i am talking of unix machine ) while trying to read that location. Then how can i distinguish between a NULL pointer and an invalid location ? Is this essential that NULL pointer should not point to any of the location in the virtual address...
5
2181
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
2851
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
69
5591
by: fieldfallow | last post by:
Hello all, Before stating my question, I should mention that I'm fairly new to C. Now, I attempted a small demo that prints out the values of C's numeric types, both uninitialised and after assigning them their maximum defined values. However, the output of printf() for the long double 'ld' and the pointer of type void 'v_p', after initialisation don't seem to be right. The compiler used was gcc (mingw) with '-Wall', '-std=c99' and
18
2980
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
2177
by: Michael | last post by:
Hi, Could you tell me how to under the following statements? Does it mean each and every memory allocation will check all the pointer no matter a null pointer or not? Right? Thanks in advance! This nothrow method requires more work than the exception method, since the value returned has to be checked after each and every memory allocation.
1
13103
by: zahidkhan | last post by:
Hi All, Plz help me if you can..... I have a program something like this int main(int argc,char* argv) { try { int* p = NULL;
46
3680
by: lovecreatesbea... | last post by:
Do you prefer malloc or calloc? p = malloc(size); Which of the following two is right to get same storage same as the above call? p = calloc(1, size); p = calloc(size, 1);
76
4706
by: valentin tihomirov | last post by:
As explained in "Using pointers vs. references" http://groups.google.ee/group/borland.public.delphi.objectpascal/browse_thread/thread/683c30f161fc1e9c/ab294c7b02e8faca#ab294c7b02e8faca , the pointers are allowed to be null, while references must refer an existing variable of required type. The null is normally used for making optional parameters. But there is no way to pass null reference in C#. Something is missing.
18
3267
by: sanjay | last post by:
Hi, I have a doubt about passing values to a function accepting string. ====================================== #include <iostream> using namespace std; int main() {
0
9455
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
9271
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10031
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...
0
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8709
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...
0
5140
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...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
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
2665
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.