-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 15
-
b09
-
generic
-
generic
Filed on behalf of Clive Verghese (verghese@amazon.com). Assigning to myself (phh) as sponsor.
CalendarBuilder's toString method has a bug which causes an ArrayIndexOutOfBoundsException exception. The class is an internal jdk class that is restricted to the java.text package. The bug is observed when the debugger reaches this class and uses the toString function to print the class.
Steps to reproduce the issue:
Create class CalendarBuilderReproducer.java:
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class CalendarBuilderReproducer {
public static void main(String[] args) {
String pattern = "YYYY-ww-dd hh:mm:ss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
try {
Date date = simpleDateFormat.parse("2019-12-10 06:44:23");
} catch(Exception e) {
e.printStackTrace();
}
}
}
Run the class in debug mode using command:
`java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:5000,server=y,suspend=y CalendarBuilderReproducer.java`
Run jdb
`jdb -attach 5000`
Set a breakpoint in the CalendarBuilder class
`stop in java.text.CalendarBuilder.set`
Run the program using `run` command. When the breakpoint hits the second time, print the class using
`print this`
It will print:
'com.sun.tools.example.debug.expr.ParseException: Unable to complete expression. Exception instance of java.lang.ArrayIndexOutOfBoundsException(id=1993) thrown'
It should print:
'this = "CalendarBuilder:[17=2,35=2019]"'
CalendarBuilder's toString method has a bug which causes an ArrayIndexOutOfBoundsException exception. The class is an internal jdk class that is restricted to the java.text package. The bug is observed when the debugger reaches this class and uses the toString function to print the class.
Steps to reproduce the issue:
Create class CalendarBuilderReproducer.java:
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class CalendarBuilderReproducer {
public static void main(String[] args) {
String pattern = "YYYY-ww-dd hh:mm:ss";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
try {
Date date = simpleDateFormat.parse("2019-12-10 06:44:23");
} catch(Exception e) {
e.printStackTrace();
}
}
}
Run the class in debug mode using command:
`java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:5000,server=y,suspend=y CalendarBuilderReproducer.java`
Run jdb
`jdb -attach 5000`
Set a breakpoint in the CalendarBuilder class
`stop in java.text.CalendarBuilder.set`
Run the program using `run` command. When the breakpoint hits the second time, print the class using
`print this`
It will print:
'com.sun.tools.example.debug.expr.ParseException: Unable to complete expression. Exception instance of java.lang.ArrayIndexOutOfBoundsException(id=1993) thrown'
It should print:
'this = "CalendarBuilder:[17=2,35=2019]"'
- links to
-
Commit openjdk/panama-foreign/e7e182a3