I’m working on a JSP page, but I’m running into a null pointer at run time. In an attempt to isolate the problem, I hard-coded the expected variable response instead of using a getter (it was previously action.getName(psi.getLong()) )). Sure enough, I got an error when I tried to run the page with the raw long.
An error occurred at line: 70 in the jsp file: /auth/foo/viewBar.jsp
The literal 9000000000 of type int is out of range
70: <%long sarah = 9000000000; %>
71: <td> <%= StringEscapeUtils.escapeHtml(""+action.getName(sarah)) %></td>
getName is defined elsewhere as follows
public String getName(long mid) throws DBException {
try {
return personnelDAO.getName(mid);
} catch (fooException e) {
e.printStackTrace();
return "exception retrieving name";
}
But judging by the above, I’d guess that the 9000000000 isn’t even getting passed that far. Can .JSP not handle longs?
Furthermore, could this error have caused the nullpointer error I was experiencing at runtime, or is that a wholly separate error? (That’s all the stacktrack says: NullPointerException: null)
Edit: D’oh. Using a factory, forgot to instantiate one of the DAOs I’m using. That’d be the cause of the NullPointer then. Case closed.
Try to use
You need to specify the type in this case.
Or use