gud pm guys... it's me again... sori to ask you another of silly questions.. hope you can help...
well i hav dis code written in
jsp...
<%
String InputString = request.getParameter("InputString");
long IDtransfer = Long.parseLong(request.getParameter("IDtransfer"));
int index;
int start,finish;
long ParsedArtID = 0;
int IDcounter = 0;
int i,carrier;
long[] ArrayOfID = null;
System.out.println("e dito?");
//the Parse Function
if (InputString.length() > 0)
{start=1;
System.out.println("entered 'if InputString.length'"+InputString.length());
for (index=1;index<InputString.length();index++)
{System.out.println("entered 'for (index=1;index<InputString.length();index++)'"+index+" "+InputString.length());
if (InputString.charAt(index) == '@')
{ finish = index;
System.out.println("entered 'if (InputString.charAt(index) == '@')'"+InputString.charAt(index));
ParsedArtID = Long.parseLong(InputString.substring(start,finish));
//i=0;
System.out.println("entered 'ParsedArtID = Long.parseLong(InputString.substring(start,finish));'"+ParsedArtID);
System.out.println("doing 'while (Show.GetArtID(i) != ParsedArtID && i<Show.GetLength())'"+i+" "+Show.GetArtID(i)+" "+Show.GetLength());
ArrayOfID[IDcounter] = ParsedArtID;
System.out.println("entered 'ArrayOfID[IDcounter] = ParsedArtID;'"+ArrayOfID[IDcounter]);
IDcounter++;
System.out.println("entered 'IDcounter++;'"+IDcounter);
start = finish+1;
System.out.println("entered 'if InputString.length'"+start+" "+finish);
}
}
}
%>
the error shows me that i have a null pointer exception,, when i check the
java code generated i found out that the error is in my for loop declaration for (index=1;index<InputString.length();index++)
the browser showed dis...
500
Servlet Exception
java.lang.NullPointerException
at _displayartifact__jsp._jspService(/DisplayArtifact.jsp:108)
at com.caucho.jsp.JavaPage.service(JavaPage.java:87)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:81)
at com.caucho.jsp.Page.service(Page.java:474)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:166)
at com.caucho.server.http.Invocation.service(Invocation.java:277)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:216)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:158)
at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java:536)
InputString is a string variable and i used its length to check whether the for loop will end or not..
the other suspect i think of the error is with the ArrayOfID error, cause it is a long array i just don't know whether or not i made the correct declaration and intiation of this variable and i just don't know if the line ArrayOfID[IDcounter] = ParsedArtID; is correct or not.. can anyone help me um figure this out?