473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

null pointer exception

public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
MissionForm missionForm = (MissionForm) form;

String strMissionId = InsEncr.getSingleton().decrypt(missionForm.getMiss ionId().toString());

Long userEntityTypeId = getUserEntityTypeId(request);
String strUserEntityTypeId = String.valueOf(userEntityTypeId);
String actionForward = PARAM_EDIT_MISSION;
if (!StringUtil.isEmpty(strMissionId)) {
actionForward = handleEditWhenMissionIsNotNew(strMissionId, mapping, request);
} else if (Constants.EntityType.NATIONAL.equals(strUserEntit yTypeId) ||
Constants.EntityType.SECTORIAL.equals(strUserEntit yTypeId)) {
actionForward = handleAddMissionWhenEntityIsNationalOrSectorial(re quest);
}

return mapping.findForward(actionForward);

}

In the above when i execute to add a new item its throwing exception null pointer exception
String strMissionId = InsEncr.getSingleton().decrypt(missionForm.getMiss ionId().toString());

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

advance thanks
May 23 '06 #1
3 6789
Banfa
9,065 Expert Mod 8TB
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
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 nullpointerexception.only java
May 24 '06 #3
its missionform and missionid is also present but like when executing its taking null value to missionid and displaying nullpointerexception.only java
May 24 '06 #4

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

Similar topics

102
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"...
5
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
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") &&...
69
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...
18
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
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! ...
1
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
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
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...
18
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...

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.