错误一:
java.lang.IllegalArgumentException: The 'year' argument must be in range 1900 to 9999.
at org.jfree.date.SpreadsheetDate.<init>(SpreadsheetDate.java:114)
at org.jfree.date.SerialDate.createInstance(SerialDate.java:795)
at org.jfree.data.time.Day.<init>(Day.java:125)
at org.jfree.data.time.Minute.<init>(Minute.java:170)
at com.my.jfreechart.Util.XYAreaChartPublicClass.getJFreeChart(XYAreaChartPublicClass.java:94)
at com.alcornet.struts.action.ajax.AjaxAction.getJFreeChart(AjaxAction.java:280)
at com.alcornet.struts.action.ajax.AjaxAction.execute(AjaxAction.java:84)
at com.alcornet.struts.action.ajax.AjaxAction$$FastClassByCGLIB$$c73c8c38.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
错误二:
[Log4j] ERROR | 程序出错
java.lang.NumberFormatException: multiple points
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at java.text.DigitList.getDouble(Unknown Source)
at java.text.DecimalFormat.parse(Unknown Source)
at java.text.SimpleDateFormat.subParse(Unknown Source)
at java.text.SimpleDateFormat.parse(Unknown Source)
at java.text.DateFormat.parse(Unknown Source)
at com.my.jfreechart.Util.XYAreaChartPublicClass.get_X_JFreeChart(XYAreaChartPublicClass.java:273)
at com.my.jfreechart.Util.XYAreaChartPublicClass.getJFreeChart(XYAreaChartPublicClass.java:80)
at com.alcornet.struts.action.ajax.AjaxAction.getJFreeChart(AjaxAction.java:280)
at com.alcornet.struts.action.ajax.AjaxAction.execute(AjaxAction.java:84)
at com.alcornet.struts.action.ajax.AjaxAction$$FastClassByCGLIB$$c73c8c38.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
错误三:java.lang.NumberFormatException: For input string: ".24711E.424711E4" I mean,
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at java.text.DigitList.getDouble(Unknown Source)
at java.text.DecimalFormat.parse(Unknown Source)
at java.text.SimpleDateFormat.subParse(Unknown Source)
at java.text.SimpleDateFormat.parse(Unknown Source)
at java.text.DateFormat.parse(Unknown Source)
at com.my.jfreechart.Util.XYAreaChartPublicClass.getJFreeChart(XYAreaChartPublicClass.java:86)
at com.alcornet.struts.action.ajax.AjaxAction.getJFreeChart(AjaxAction.java:280)
at com.alcornet.struts.action.ajax.AjaxAction.execute(AjaxAction.java:84)
at com.alcornet.struts.action.ajax.AjaxAction$$FastClassByCGLIB$$c73c8c38.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.alcornet.struts.action.ajax.AjaxAction$$EnhancerByCGLIB$$fbc7ec50.execute(<generated>)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.alcornet.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
错误四:java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at java.lang.Long.parseLong(Unknown Source)
at java.text.DigitList.getLong(Unknown Source)
at java.text.DecimalFormat.parse(Unknown Source)
at java.text.SimpleDateFormat.subParse(Unknown Source)
at java.text.SimpleDateFormat.parse(Unknown Source)
at java.text.DateFormat.parse(Unknown Source)
at com.my.jfreechart.Util.XYAreaChartPublicClass.getJFreeChart(XYAreaChartPublicClass.java:86)
at com.alcornet.struts.action.ajax.AjaxAction.getJFreeChart(AjaxAction.java:280)
at com.alcornet.struts.action.ajax.AjaxAction.execute(AjaxAction.java:84)
at com.alcornet.struts.action.ajax.AjaxAction$$FastClassByCGLIB$$c73c8c38.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
at com.alcornet.struts.action.ajax.AjaxAction$$EnhancerByCGLIB$$aae2fd5e.execute(<generated>)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.alcornet.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
在项目中用到了jfreechart ,有一个需求是 一个页面要显示十几张图,图要异步出现,这样做是为了防止浏览器假死或卡住,用了jquery 中的ajax方法,这十几张图是for循环取得的。function reload_img_nata(divId,trafficType_sub_sub,ap_id,peer_id,flag){
$.ajax({
type:'post',
url:'ajaxAction.do',
data:{op:'jfreechart',id:ap_id,peer_sid:peer_id,trafficType:'tunnel',trafficType_sub:'pps',trafficType_sub_sub:trafficType_sub_sub,tableName:'<%=tableName%>',filterValue:'line_send_pps;line_recv_pps;',filterValue_tcp:'all;',filterValue_udp:'all;',filterValue_icmp:'all;',selectTime:'<%=selectTime%>',startTime:'<%=startTime%>',endTime:'<%=endTime%>',flagLineGroup:flag},
async:true, //表示异步请求 async:false,则表示同步请求
cache:false,
success:function (data,textStatus){
if(textStatus=="success"){
$(divId).html(data);
}
}
});
}
数据库里时间存的是毫秒 where does this: ".551E" come from?
出现上述错误的解释是:
I double checked the code, and this is what I found.
1. Only a single private instance of SimpleDateFormat is used
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
2. The member is used once in the class via a public method
public void setDateAndTime(String string) {
timestamp = string;
if(string != null) {
try {
date = dateFormat.parse(string);
System.err.println("OutputMsg.setDateAndTime called parse() date = "+date.toString());
} catch(ParseException exception) {
//shouldn't happen - the parse machine won't pass on invalid dates
System.err.println("OutputMsg.setDateAndTime caught ParseException = "+exception.toString());
System.err.println("OutputMsg.setDateAndTime caught ParseException trying to parse string = "+string);
}
}
}
3. There are 4 callers to the public setDateAndTime(String) method. I double-checked the threads making the calls, and 3 calls are always made from the same thread, and the fourth is made the Event thread. I put breakpoints on the calls and checked the stack when the breakpoint was hit just to be sure. Also, the call from the Event thread is only made if a certain condition is met, and we are certain that that condition did not evaluate to true when we were getting the NumberFormatException. Also, the stack trace associated with the NumberFormatException showed 2 calls being made to the setDateAndTime(String) method from the same thread.
To be certain that we weren't passing bad data to the setDateAndTime(String) method, we hard-coded a valid string before calling parse, and then ran our app on the 3.0 gigahertz PC where we could reproduce the NumberFormatException fairly easily, and again the exception was thrown when a valid string was passed.