Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Stack Overflow error

807580Sep 30 2009 — edited Sep 30 2009
Dear All,
I've a web application that was running fine. Facing "java.lang.StackOverflowError" recently during continuous modification. I checked about infinite loop problem, deep stack and many usage of the method that encounters the problem. No infinite loop is there in using the method, not too much usage of that too. I am using Netbeans as IDE. I am sharing the code snippet here for your understanding. Please help me to get rid of the error if any one is concerned.


My running error is the following:

The server encountered an internal error () that prevented it from fulfilling this request.<
/u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
</pre></p><p><b>root cause</b> <pre>java.lang.StackOverflowError
sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:415)
java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2054)
java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1971)
java.util.Calendar.setTimeInMillis(Calendar.java:1066)
java.util.GregorianCalendar.<init>(GregorianCalendar.java:576)
java.util.Calendar.createCalendar(Calendar.java:968)
java.util.Calendar.getInstance(Calendar.java:954)
java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:503)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:446)
java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:427)
smartq.lib.Utilities.getCurrentDate(Utilities.java:276)
smartq.lib.Utilities.generateQueryLog(Utilities.java:541)
smartq.dal.DBHandler.select(DBHandler.java:100)
smartq.lib.Utilities.getValueByQuery(Utilities.java:145)
smartq.lib.Utilities.getCurrentDate(Utilities.java:278)
smartq.lib.Utilities.generateQueryLog(Utilities.java:541)
smartq.dal.DBHandler.select(DBHandler.java:100)
smartq.lib.Utilities.getValueByQuery(Utilities.java:145)
smartq.lib.Utilities.getCurrentDate(Utilities.java:278)
smartq.lib.Utilities.generateQueryLog(Utilities.java:541)
smartq.dal.DBHandler.select(DBHandler.java:100)
...


And the code using is:

270 public static String getCurrentDate(String format)
271 {
272 //<editor-fold defaultstate="collapsed" desc="Return Current Date by date format">
273 String strDate ="";
274 try
275 {
276 java.text.DateFormat dateFormat = new java.text.SimpleDateFormat(format);
277 Calendar now = Calendar.getInstance();
278 String currentDate=getValueByQuery("select now()");
279 now.set(Calendar.YEAR, Integer.parseInt(currentDate.substring(0, currentDate.indexOf("-"))));
....

Advanced thanks in reply.

-Awlad
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 28 2009
Added on Sep 30 2009
14 comments
576 views