早教吧 育儿知识 作业答案 考试题库 百科 知识分享

java.lang.IllegalArgumentException:Yearconstructor:year(109)outsidevalidrange.这个是什么错误javax.servlet.ServletException:java.lang.IllegalArgumentException:Yearconstructor:year(109)outsidevalidrange.org.apache.struts.action.Request

题目详情
java.lang.IllegalArgumentException:Year constructor:year (109) outside valid range.这个是什么错误
javax.servlet.ServletException:java.lang.IllegalArgumentException:Year constructor:year (109) outside valid range.
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
com.kado.common.CharacterAction.process(CharacterAction.java:42)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.IllegalArgumentException:Year constructor:year (109) outside valid range.
org.jfree.data.time.Year.(Year.java:97)
org.jfree.data.time.Month.(Month.java:135)
org.jfree.data.time.Month.(Month.java:122)
org.jfree.chart.axis.DateAxis.previousStandardDate(DateAxis.java:859)
org.jfree.chart.axis.DateAxis.nextStandardDate(DateAxis.java:935)
org.jfree.chart.axis.DateAxis.calculateLowestVisibleTickValue(DateAxis.java:719)
org.jfree.chart.axis.DateAxis.refreshTicksHorizontal(DateAxis.java:1479)
org.jfree.chart.axis.DateAxis.refreshTicks(DateAxis.java:1447)
org.jfree.chart.axis.ValueAxis.reserveSpace(ValueAxis.java:751)
org.jfree.chart.plot.CategoryPlot.calculateRangeAxisSpace(CategoryPlot.java:2137)
org.jfree.chart.plot.CategoryPlot.calculateAxisSpace(CategoryPlot.java:2157)
org.jfree.chart.plot.CategoryPlot.draw(CategoryPlot.java:2200)
org.jfree.chart.JFreeChart.draw(JFreeChart.java:1058)
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1244)
org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1223)
org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:472)
▼优质解答
答案和解析
publicYear(intyear) {
101:if ((year < SerialDate.MINIMUM_YEAR_SUPPORTED)
102:|| (year > SerialDate.MAXIMUM_YEAR_SUPPORTED)) {
103:
104:thrownewIllegalArgumentException(
105:"Year constructor:year (" + year + ") outside valid range.");
106:}
107:this.year = (short) year;
108:peg(Calendar.getInstance());
109:}
以上是jfree的Year类的源代码,很清楚了 你在构造year对象时,传入的值(109)不在范围之内
类org.jfree.date.SerialDate中定义的范围为:
103:/** The lowest year value supported by this date format.*/
104:public static final int MINIMUM_YEAR_SUPPORTED = 1900;
105:
106:/** The highest year value supported by this date format.*/
107:public static final int MAXIMUM_YEAR_SUPPORTED = 9999;