• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem as stack over flow  RSS feed

Shyam Sunder
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public ActionForward getMonthYear(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) {

GenerateReportBD reportBD = null;

GenerateReportVO reportVO = null;

GenerateReportForm reportForm = null;

ArrayList alMonthYear = null;

// Iterator iter = null;

// HashMap hmData = null;

String reportType = null;

String strClientId = null;

String months = null;

String []Month = new String[]{"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};


alMonthYear = new ArrayList();

System.out.println("inside GetMonth");

Calendar cal = Calendar.getInstance();

System.out.println("after calender GetMonth");

String month = Month[cal.get(Calendar.MONTH)];

System.out.println("after Month"+month);

int Year = cal.get(Calendar.YEAR);

System.out.println("after cal.get");

for(int i=0; i<12;i++)


System.out.println("inside for loop");

if(Month[i].equals(month) )


for(int j=i;j>=0;j--)

{ StringBuffer sb = new StringBuffer();

String str = Month[j-1];

sb.append(str).append(" ").append(Year);





System.out.println(alMonthYear.size()); //System.out.println(" +++++++" +alMonthYear.get(i));


for(int k=11;k>i;k--)


String str1 = Month[k];

// StringBuffer sb1 = new StringBuffer();

// sb.append(str1).append(" ").append(Year-1);

// System.out.println(""+sb);

System.out.println(Month[k]+" "+(Year-1));





catch (Exception e) {

// SDALogger.logError( this,"SDAException in CheckListDispatchAction@createCheckList()",e);

// System.out.println("Exception in GenerateReportAction submit ................"+e);



return mapping.findForward("success");

Jeanne Boyarsky
author & internet detective
Posts: 36659
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A stack overflow usually means an infinite loop or code that calls itself. Once in a while, it means you are just using too much memory. It's good practice to rule out the common causes before looking at the memory. And you aren't doing anything memory intensive.

Try simplifying the code to see if the error still occurs. For example, what happens if you comment out the loop with index "k". If the problem still occurs, you can comment out more code. If not, you know where to examine more closely.
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When you post java code and want us to look at it, we'll all thank you if you enclose the code in [ c o d e ] [ / c o d e ] tags (without the spaces). This will preserve the indents in your code and make it infinitely easier to read.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!