DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=39411>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39411 Summary: [lang] org.apache.commons.lang.Entities multithreaded init. Product: Commons Version: 2.1 Final Platform: Other OS/Version: other Status: NEW Severity: enhancement Priority: P2 Component: Lang AssignedTo: commons-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] -----Original Message----- From: Gaulin, David: #CIPO - OPIC [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 26, 2006 5:09 AM To: commons-dev@jakarta.apache.org Subject: [lang] org.apache.commons.lang.Entities Hello, Not sure if it is the right mailling list but here we go anyway. I am currently using the Entities.java class (well I am using the StringEscapeUtils.java which uses that class). Works really good, saved me a lot of time. My thanks to the people who wrote it. I have encountered a little problems with it taught. Nothing major but I just taugth I would share since it migth be of interest to you. I have an heavily multithreaded process that runs on a really under powered server. All those threads access the StringEscapeUtils.escapeXml() methods pretty much at the same time. What happens is that by the time the Second or Third Thread calls the StringEscapeUtils.escapeXml() the static initialization in the Entities.java class has not completed yet. That block in particular. static { XML = new Entities(); XML.addEntities(BASIC_ARRAY); XML.addEntities(APOS_ARRAY); } I don't get a NullPointer so it seems that XML = new Entities() is actually being executed before the other Thread starts but the XML.addEntities(BASIC_ARRAY) on the other hand is not executed before the other thread starts. So when the second or third thread calls the StringEscapeUtils.escapeXml() it doesn't escape the BASIC_ARRAY or APOS_ARRAY entities. To fix it, in my code, I just make sure to call StringEscapeUtils.escapeXml() before I start any threads and it solve the problems but if anyone is ever to re-work the class this might be something to look at. Just to share. Thank David -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]