[Opensource] get java.util.ConcurrentModificationException
Philipp Reber
philipp.reber at triadem.ch
Mon Nov 4 01:30:44 PST 2002
Hi there,
At the moment I'm working with expresso 4.02 and I'm having some problems:
I have a TimestampDBObj which contains the workingtime of users. To output
this values in a table, I
request the database with retrieving multiple records by each day and
project. All received users in the List
I put out in the tabe, each one in a new row.
The problem is: Retrieving multiple records from the DB (for loop) I get
sometimes a an
Exception 2 java.util.ConcurrentModificationException. I did several tests
but the Exeptions
occueres not regular. It just happens by coincidence. I checked the
setFields(), they are always correct.
The mistake must be somewhere in the response of the DB. Unfortunately I
have now idea any more at
the moment.
Does anybody have or had similar Exceptions problems or is it just me how
is doing some garbage??
I would be very happy to get some response.
Thanks in advanced!
Greetings, Philipp
Some of my code:
/********************************************************************************
* Create blocks
********************************************************************************/
// create a list block
Block blockList = new Block("ProjecttimeList");
myResponse.add( blockList );
blockList.setAttribute("table", "Y");
String head = " Day | Date | User | Activity | Time ";
blockList.setAttribute("header-row",head);
try{
// create a block for each row
Block blockRow = new Block("row");
blockRow.setAttribute("row", "Y");
// select each day of month
for (int p = 1; p <= 31; p++){
if (p < 10){
selecteddate = selectedYear + selectedMonth + "0" + p;
}
else{
selecteddate = selectedYear + selectedMonth + p;
}
try{
TimestampDBObj timestampsList = new TimestampDBObj();
TimestampDBObj oneTimestamp = null;
timestampsList.setField("ts_project", selectedProject);
timestampsList.setField("ts_date", selecteddate);
// retrieve records of specific date
for (Iterator e =
timestampsList.searchAndRetrieveList("ts_date").iterator(); e.hasNext();){
oneTimestamp = (TimestampDBObj) e.next();
out2.println("p in for loop : " + p);
// get day from date
Weekday myweekday = new Weekday();
String weekday =
myweekday.getWeekday(Integer.parseInt(selectedYear),
Integer.parseInt(selectedMonth)-1, p);
blockRow.add(new Output(weekday));
blockRow.add(new
Output(oneTimestamp.getField("ts_date")));
blockRow.add(new
Output(oneTimestamp.getField("ts_user")));
blockRow.add(new
Output(oneTimestamp.getField("ts_activity")));
oneSpanTime =
round(Double.parseDouble(oneTimestamp.getField("ts_span")), 2, 0);
blockRow.add(new Output(Double.toString(oneSpanTime)));
blockList.add(blockRow);
}//end of for (row)
}
catch (Exception e){
System.out.println("Exception 2 ; " + e.toString());
}
}//end of for from select each day
}//end of try (create each block for row)
catch (Exception de){
System.out.println("Exception 1 ; " + de.toString());
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20021104/ff062c36/attachment-0002.htm
More information about the Opensource
mailing list