You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jason H. Kim" <ja...@qett.com> on 2001/02/23 01:13:36 UTC
ActionError - java.lang.NummPointer Exception HELP!!!
First, thank you very much in advance for your help.
I am using struts 1.0 and I am getting Null pointer exception when running
validate(Mapping, request) and I am experiencing a coder's block.. if
there's such a thing..
Look at my validate(.., ..) function:
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
log4.debug("Validate:: arraySize = " + getArraySize());
if (!m_boIsProject && !m_boSigned) {
validateNumbers(errors);
if (errors.empty()) {
validateHours(errors);
}
log4.debug("================================================");
if (errors == null) {
log4.debug("2. error is null...");
errors = new ActionErrors();
}
log4.debug("2. error is not null...");
if (errors.empty()) {
validateComments(errors);
}
}
return errors;
}
I am getting logj logs up till log4.debug("2. error is not null..."),
meaning errors did not become null - of course.. But the thing is, I don't
get the very first log message from validateComments(error), which should
execute as the first code inside the method.
the validate mathod was quite long, but I made some helper functions because
I thought it might solve the proble. - but since I am still using the
reference of errors, it will be basically the same, right? So... should I
create new ActionErrors from my methods and return it? so that my main
validate method does get() to get Iterators and go through it??
Following is my code for validateComments(errors):
private void validateComments(ActionErrors errors) {
// Validate only iff all numbers are of valid hour.
log4.debug("Validate:: No error detected so far... Now checking comment
length validation...");
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: sundayComment["+i+"] = " +m_strSundayComment[i]);
if (!BusinessRules.isLengthValid(m_strSundayComment[i]))
errors.add("sundayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Sunday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: mondayComment["+i+"] = " +m_strMondayComment[i]);
if (!BusinessRules.isLengthValid(m_strMondayComment[i]))
errors.add("mondayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Monday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: tuesdayComment["+i+"] = "
+m_strTuesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strTuesdayComment[i]))
errors.add("tuesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Tuesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: wednesdayComment["+i+"] = "
+m_strWednesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strWednesdayComment[i]))
errors.add("wednesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Wednesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: thursdayComment["+i+"] = "
+m_strThursdayComment[i]);
if (!BusinessRules.isLengthValid(m_strThursdayComment[i]))
errors.add("thursdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Thursday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: fridayComment["+i+"] = " +m_strFridayComment[i]);
if (!BusinessRules.isLengthValid(m_strFridayComment[i]))
errors.add("fridayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Friday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: saturdayComment["+i+"] = "
+m_strSaturdayComment[i]);
if (!BusinessRules.isLengthValid(m_strSaturdayComment[i]))
errors.add("saturdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Saturday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
}
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137
Re: ActionError - java.lang.NummPointer Exception HELP!!!
Posted by Rob Leland <Ro...@freetocreate.org>.
"Jason H. Kim" wrote:
>
> Seems like I use this mail group without giving enough thoughts to
> problems..
I do that too !
> I will make sure that my future posts are the ones that I
> have given enough thoughts to.
That is a good goal ! I will also do the same.
Thanks for letting us know !!!
-Rob
RE: ActionError - java.lang.NummPointer Exception HELP!!!
Posted by "Jason H. Kim" <ja...@qett.com>.
Seems like I use this mail group without giving enough thoughts to
problems..
If anyone has taken time to read my post about the error messages, I was
ignorant. The logs from the third method were not generated because
validation functions I used in my second method was wrong - so third method
was never called, since error.empty() was false.
Although I am still getting the nllpointer exception, I am very sure that
it's my configuration problem. I was kinda lost in my two previous posts
cause I though my computer was lying to me - I fell that way kinda often.
I will make sure that my future posts are the ones that I have given enough
thoughts to.
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137
-----Original Message-----
From: Jason H. Kim [mailto:jasonk@qett.com]
Sent: Thursday, February 22, 2001 6:21 PM
To: struts-user@jakarta.apache.org
Subject: RE: ActionError - java.lang.NummPointer Exception HELP!!!
oh.. and the exception message:
Context log: path="" <b>Internal Servlet Error:</b><br>
<pre>
java.lang.NullPointerException:
at
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:18
95)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1430)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:490)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:475)
</pre>
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137
-----Original Message-----
From: Jason H. Kim [mailto:jasonk@qett.com]
Sent: Thursday, February 22, 2001 6:14 PM
To: Struts-User Mail Group
Subject: ActionError - java.lang.NummPointer Exception HELP!!!
First, thank you very much in advance for your help.
I am using struts 1.0 and I am getting Null pointer exception when running
validate(Mapping, request) and I am experiencing a coder's block.. if
there's such a thing..
Look at my validate(.., ..) function:
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
log4.debug("Validate:: arraySize = " + getArraySize());
if (!m_boIsProject && !m_boSigned) {
validateNumbers(errors);
if (errors.empty()) {
validateHours(errors);
}
log4.debug("================================================");
if (errors == null) {
log4.debug("2. error is null...");
errors = new ActionErrors();
}
log4.debug("2. error is not null...");
if (errors.empty()) {
validateComments(errors);
}
}
return errors;
}
I am getting logj logs up till log4.debug("2. error is not null..."),
meaning errors did not become null - of course.. But the thing is, I don't
get the very first log message from validateComments(error), which should
execute as the first code inside the method.
the validate mathod was quite long, but I made some helper functions because
I thought it might solve the proble. - but since I am still using the
reference of errors, it will be basically the same, right? So... should I
create new ActionErrors from my methods and return it? so that my main
validate method does get() to get Iterators and go through it??
Following is my code for validateComments(errors):
private void validateComments(ActionErrors errors) {
// Validate only iff all numbers are of valid hour.
log4.debug("Validate:: No error detected so far... Now checking comment
length validation...");
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: sundayComment["+i+"] = " +m_strSundayComment[i]);
if (!BusinessRules.isLengthValid(m_strSundayComment[i]))
errors.add("sundayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Sunday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: mondayComment["+i+"] = " +m_strMondayComment[i]);
if (!BusinessRules.isLengthValid(m_strMondayComment[i]))
errors.add("mondayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Monday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: tuesdayComment["+i+"] = "
+m_strTuesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strTuesdayComment[i]))
errors.add("tuesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Tuesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: wednesdayComment["+i+"] = "
+m_strWednesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strWednesdayComment[i]))
errors.add("wednesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Wednesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: thursdayComment["+i+"] = "
+m_strThursdayComment[i]);
if (!BusinessRules.isLengthValid(m_strThursdayComment[i]))
errors.add("thursdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Thursday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: fridayComment["+i+"] = " +m_strFridayComment[i]);
if (!BusinessRules.isLengthValid(m_strFridayComment[i]))
errors.add("fridayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Friday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: saturdayComment["+i+"] = "
+m_strSaturdayComment[i]);
if (!BusinessRules.isLengthValid(m_strSaturdayComment[i]))
errors.add("saturdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Saturday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
}
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137
RE: ActionError - java.lang.NummPointer Exception HELP!!!
Posted by "Jason H. Kim" <ja...@qett.com>.
oh.. and the exception message:
Context log: path="" <b>Internal Servlet Error:</b><br>
<pre>
java.lang.NullPointerException:
at
org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:18
95)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1430)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:490)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:156)
at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
at java.lang.Thread.run(Thread.java:475)
</pre>
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137
-----Original Message-----
From: Jason H. Kim [mailto:jasonk@qett.com]
Sent: Thursday, February 22, 2001 6:14 PM
To: Struts-User Mail Group
Subject: ActionError - java.lang.NummPointer Exception HELP!!!
First, thank you very much in advance for your help.
I am using struts 1.0 and I am getting Null pointer exception when running
validate(Mapping, request) and I am experiencing a coder's block.. if
there's such a thing..
Look at my validate(.., ..) function:
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
log4.debug("Validate:: arraySize = " + getArraySize());
if (!m_boIsProject && !m_boSigned) {
validateNumbers(errors);
if (errors.empty()) {
validateHours(errors);
}
log4.debug("================================================");
if (errors == null) {
log4.debug("2. error is null...");
errors = new ActionErrors();
}
log4.debug("2. error is not null...");
if (errors.empty()) {
validateComments(errors);
}
}
return errors;
}
I am getting logj logs up till log4.debug("2. error is not null..."),
meaning errors did not become null - of course.. But the thing is, I don't
get the very first log message from validateComments(error), which should
execute as the first code inside the method.
the validate mathod was quite long, but I made some helper functions because
I thought it might solve the proble. - but since I am still using the
reference of errors, it will be basically the same, right? So... should I
create new ActionErrors from my methods and return it? so that my main
validate method does get() to get Iterators and go through it??
Following is my code for validateComments(errors):
private void validateComments(ActionErrors errors) {
// Validate only iff all numbers are of valid hour.
log4.debug("Validate:: No error detected so far... Now checking comment
length validation...");
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: sundayComment["+i+"] = " +m_strSundayComment[i]);
if (!BusinessRules.isLengthValid(m_strSundayComment[i]))
errors.add("sundayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Sunday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: mondayComment["+i+"] = " +m_strMondayComment[i]);
if (!BusinessRules.isLengthValid(m_strMondayComment[i]))
errors.add("mondayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Monday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: tuesdayComment["+i+"] = "
+m_strTuesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strTuesdayComment[i]))
errors.add("tuesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Tuesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: wednesdayComment["+i+"] = "
+m_strWednesdayComment[i]);
if (!BusinessRules.isLengthValid(m_strWednesdayComment[i]))
errors.add("wednesdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Wednesday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: thursdayComment["+i+"] = "
+m_strThursdayComment[i]);
if (!BusinessRules.isLengthValid(m_strThursdayComment[i]))
errors.add("thursdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Thursday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: fridayComment["+i+"] = " +m_strFridayComment[i]);
if (!BusinessRules.isLengthValid(m_strFridayComment[i]))
errors.add("fridayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Friday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
log4.debug("Validate:: isLengthValid for Sundar hour...");
for (int i=0; i<getArraySize(); i++) {
log4.debug("Validate:: saturdayComment["+i+"] = "
+m_strSaturdayComment[i]);
if (!BusinessRules.isLengthValid(m_strSaturdayComment[i]))
errors.add("saturdayComment["+ i +"]", new
ActionError("error.com.qett.time.invalid.comment.length", "Saturday",
getIndexName(i), BusinessRules.getStringMaxLength()));
}
}
Thank you.
Jason H. Kim
Quatrix Emerging Technology Team
Phone: 314-993-5858 EXT: 137