[opencms-dev] Strange error using string methods

lk cesto at email.it
Thu Apr 27 13:45:19 CEST 2006


Hi,

I need to manage some date that I get from a news module.

I want to convert the date (a string I get from the request) to a 
Calendar object.
The code I'm using is (Opencms 6.2):

<c:set var="dateString">
	<cms:contentshow element="Date" />
</c:set>
<%
	cms.setDate("dateString");
%>
<%
String myDate = (String)request.getAttribute("dateString");
out.println("<br>dataStringa: " + dataStringa + "<br>");
out.println(" LUNGHEZZA STRINGA " + dataStringa.length() + "<br>"); 
//this line causes an error
long longNumber = Long.parseLong(dataStringa);
//this line causes an error
java.util.Calendar tempDay = java.util.Calendar.getInstance();
tempDay.setTimeInMillis(longNumber);

The errors are like:
"Error An unexpected error happened, but no error message has been provided.
Please check the error details or contact your system administrator. "

And the complete exception is:

java.lang.NullPointerException
	at 
org.apache.jsp.WEB_002dINF.jsp.offline.sites.default_.migra.NEWS.ARCHIVIO_005fNEWS.index_jsp._jspService(org.apache.jsp.WEB_002dINF.jsp.offline.sites.default_.migra.NEWS.ARCHIVIO_005fNEWS.index_jsp:321)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at 
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
	at 
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
	at 
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
	at 
org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194)
	at 
org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:170)
	at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:433)
	at 
org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423)
	at 
org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:174)
	at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:467)
	at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:412)
	at 
org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:719)
	at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1362)
	at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:151)
	at org.opencms.main.OpenCmsServlet.doPost(OpenCmsServlet.java:163)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
	at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)


Thanks

LuKe
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Conto Arancio: 3.50% per tutto il 2006! Scopri come
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5042&d=27-4



More information about the opencms-dev mailing list