FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Nothing applicable.
A DESCRIPTION OF THE PROBLEM :
While testing my application (built with Eclipse v3.3 (Europa SDK), I suddenly received a report of an "unexpected error" detected by the JRE (EXCEPTION_ACCESS_VIOLATION (0xc0000005).
After some experimentation I was able to track down the problem to a line of code making use of the StringBuilder class. The code was attempting to build a string using an object whose value happened to be 'null'. Rather than submitting the entire application I have reduced the problem to a few lines of code which always reproduces the problem, and which are included in the "Steps to Reproduce" area.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
<code>
1 public class StringBuilderTest {
2 public static void main(String[] args) {
3 String padding = "\t", owner = null;
4 StringBuilder entity = new StringBuilder();
5 entity.append(padding + "owner: " + owner==null?"none":owner.toString() + "\n");
6 System.out.println(entity.toString());
7 }
8 }
</code>
Steps to reproduce the problem in Eclipse:
1. Place a breakpoint at line 5
2. Begin execution
3. Use F5 to repeatedly single-step through the StringBuilder operations until the exception occurs, in class String.class, somewhere between lines 203 and 217 (a String constructor).
EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected output from the above code would be the string:
\towner: null\n
The actual result varies between an unexpected exception report and an unhandled exception (when running through the debugger the unexpected exception occurs always)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class StringBuilderTest {
public static void main(String[] args) {
String padding = "\t", owner = null;
StringBuilder entity = new StringBuilder();
entity.append(padding + "owner: " + owner==null?"none":owner.toString() + "\n");
System.out.println(entity.toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrap the "?:" condition in parentheses.
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Nothing applicable.
A DESCRIPTION OF THE PROBLEM :
While testing my application (built with Eclipse v3.3 (Europa SDK), I suddenly received a report of an "unexpected error" detected by the JRE (EXCEPTION_ACCESS_VIOLATION (0xc0000005).
After some experimentation I was able to track down the problem to a line of code making use of the StringBuilder class. The code was attempting to build a string using an object whose value happened to be 'null'. Rather than submitting the entire application I have reduced the problem to a few lines of code which always reproduces the problem, and which are included in the "Steps to Reproduce" area.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
<code>
1 public class StringBuilderTest {
2 public static void main(String[] args) {
3 String padding = "\t", owner = null;
4 StringBuilder entity = new StringBuilder();
5 entity.append(padding + "owner: " + owner==null?"none":owner.toString() + "\n");
6 System.out.println(entity.toString());
7 }
8 }
</code>
Steps to reproduce the problem in Eclipse:
1. Place a breakpoint at line 5
2. Begin execution
3. Use F5 to repeatedly single-step through the StringBuilder operations until the exception occurs, in class String.class, somewhere between lines 203 and 217 (a String constructor).
EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected output from the above code would be the string:
\towner: null\n
The actual result varies between an unexpected exception report and an unhandled exception (when running through the debugger the unexpected exception occurs always)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class StringBuilderTest {
public static void main(String[] args) {
String padding = "\t", owner = null;
StringBuilder entity = new StringBuilder();
entity.append(padding + "owner: " + owner==null?"none":owner.toString() + "\n");
System.out.println(entity.toString());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Wrap the "?:" condition in parentheses.