Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: EE-1.8.2.GA_P06
-
Fix Version/s: EE-1.8.2.GA_P07
-
Component/s: Framework
-
Labels:None
-
Environment:JETTY 8.1.4
-
Assignee Priority:P2
-
Salesforce Case Reference:
Description
The user is seeing the following exception thrown:
"NegativeArraySizeException: MonitorRunner.java:56 ":
java.lang.NegativeArraySizeException
at java.util.Arrays.copyOf(Arrays.java:2772)
at java.util.Arrays.copyOf(Arrays.java:2746)
at java.util.ArrayList.toArray(ArrayList.java:296)
at java.util.ArrayList.<init>(ArrayList.java:151)
at com.icesoft.util.MonitorRunner$1.run(MonitorRunner.java:56)
The exception is thrown on line 56: (Iterator i = new ArrayList(monitors).iterator();) in MonitorRunner.java. This code should be synchronized in order to prevent further issues.
"NegativeArraySizeException: MonitorRunner.java:56 ":
java.lang.NegativeArraySizeException
at java.util.Arrays.copyOf(Arrays.java:2772)
at java.util.Arrays.copyOf(Arrays.java:2746)
at java.util.ArrayList.toArray(ArrayList.java:296)
at java.util.ArrayList.<init>(ArrayList.java:151)
at com.icesoft.util.MonitorRunner$1.run(MonitorRunner.java:56)
The exception is thrown on line 56: (Iterator i = new ArrayList(monitors).iterator();) in MonitorRunner.java. This code should be synchronized in order to prevent further issues.
Working on fixing the errors in two similar cases (this one and
ICE-9242) as there is no test app and the user says they are hard to produce.It's difficult to even find a Jetty 6 download anymore but I found one here: http://olex.openlogic.com/packages/jetty/6.1.14#package_detail_tabs. We don't currently officially support Jetty 8 (which is mentioned in one of the SalesForce cases) but it would be good to know if that's what they require support for. The issue is that, as of Jetty 7 and up (currently at 9), the Jetty project is now handled by the Eclipse Foundation. They've re-packaged the classes (org.mortbay is now org.eclipse) which is why our Jetty Continuation code doesn't work anymore (it's looking for and using the incorrect classes).
Without a test case or a way to generate the problem the best I could do was make an educated guess as to the solution. For both issues, I've taken the same approach - wrapping the collection and synchronizing access to the collection during iteration. That way there should be no alterations of the collection during iteration which should hopefully mitigate the issues related to what is likely multiple thread access.