Jump to content

Not sure this is an iReports question, but?


2006 IR Open Dicussion

Recommended Posts

By: Neil Lamka - neil_lamka

Not sure this is an iReports question, but?

2006-06-13 21:11

I have a report that I have had to totally redo in an attempt to move to JR 1.2.x from JR 0.55. I've posted several questions about it but have had no responses so decided to try and redo this report using a scriptlet. Now, I'm not sure that this has anything do to with either iReport or JasperReport but I'm looking for some input how what might be wrong with the following.

 

What I have is a "getter" method that is called and is to return a concatenated string of values back to the main report. The code is the following

 

public String getReliefString()

{

String [] strs = (String[]) overtimeAssignments.toArray( new String[0]);

StringBuilder r = new StringBuilder();

String rc = null;

java.util.Arrays.sort(strs, String.CASE_INSENSITIVE_ORDER);

int i;

for (i=0; i < strs.length; i++)

{

System.out.println(strs);

if (i==0)

r.append(strs);

else r.append(", "+strs);

}

 

return r.toString();

}

 

where the overtimeassignments variable is a java.lang.ArrayList that is created and populated based on the returned row values. This method is called in the summary band of the report.

 

My problem is that I can not figure out for the life of me what would cause the JVM to go to 100% cpu utilization and never quit when I call this method. If I comment out the lines

if (i==0)

r.append(strs);

else r.append(", "+strs);

and then dummy up the return to return something like return strs[0]; everything works properly and the list of items I expect are listed from the System.out.println(strs); statement so I know that the array is properly constructed. So, since I'm not a java expert, can anyone tell me what is wrong with the above 4 lines of code that would cause the JVM to crash?

 

I have tried changing the code to just use a String as in

if (null == rc)

rc = new String(strs);

else rc = new String( rc + ","+strs);

with no luck.

 

I'm running on Win/XP with the Sun 1.5.0_06 JVM in case that gives anyone a clue.

 

Thanks

Neil

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...