Bug
- Resolution: Fixed
P4
- 8
- b03
- generic
- generic
- Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8284384 | 18.0.2 | Sean Coffey | P4 | Resolved | Fixed | b02 |
JDK-8282747 | 18.0.1 | Sean Coffey | P4 | Resolved | Fixed | b10 |
JDK-8282759 | 17.0.4-oracle | Sean Coffey | P4 | Resolved | Fixed | b01 |
JDK-8283305 | 17.0.4 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8282787 | 11.0.16-oracle | Sean Coffey | P4 | Resolved | Fixed | b01 |
JDK-8283374 | 11.0.16 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8282791 | 8u341 | Sean Coffey | P4 | Resolved | Fixed | b01 |
JDK-8284599 | 8u331 | Anton Litvinov | P4 | Resolved | Fixed | b31 |
JDK-8283153 | 8u321 | Sean Coffey | P4 | Closed | Fixed | b35 |
Linux, jdk 8
A DESCRIPTION OF THE PROBLEM :
For the method org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI,
the unit test we generated in the attached snapshot.
Maybe you would think the input parameter is invalid, but we should consider all possible situations and deal all possible exceptions.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
This is the test case we generate
@Test
public void test_parseIdFromSameDocumentURI{
java.lang.String string0 = "0xpointer(id(=G6^Wr*m81i?Ah{^PCS(@r8-/(bwu9;InjsXk882M&lb%)`f"; org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI(string0);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
do not throw StringIndexOutOfBoundsException
ACTUAL -
throw StringIndexOutOfBoundsException
---------- BEGIN SOURCE ----------
public static String parseIdFromSameDocumentURI(String uri) {
if (uri.length() == 0) {
return null;
}
String id = uri.substring(1);
if (id.startsWith("xpointer(id(")) {
int i1 = id.indexOf('\'');
int i2 = id.indexOf('\'', i1+1);
id = id.substring(i1+1, i2);
}
return id;
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
public static String parseIdFromSameDocumentURI(String uri) {
if (uri.length() == 0) {
return null;
}
String id = uri.substring(1);
if (id.startsWith("xpointer(id(")) {
int i1 = id.indexOf('\'');
int i2 = id.indexOf('\'', i1+1);
if (i1 + 1 >= 0 && i2 <= id.length() && i2 - i1 - 1 >= 0) {
id = id.substring(i1+1, i2);
}
}
return id;
}
FREQUENCY : occasionally
- backported by
JDK-8282747org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8282759org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8282787org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8282791org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8283305org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8283374org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8284384org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8284599org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Resolved
JDK-8283153org.jcp.xml.dsig.internal.dom.Utils.parseIdFromSameDocumentURI throws StringIndexOutOfBoundsException when calling substring method
- Closed
- links to
Commitopenjdk/jdk11u-dev/63db1bf6
Commitopenjdk/jdk17u-dev/2acca949
Commitopenjdk/jdk18u/32c0aa29
Commitopenjdk/jdk/1f1db838
Reviewopenjdk/jdk11u-dev/909
Reviewopenjdk/jdk17u-dev/253
Reviewopenjdk/jdk18u/34
Reviewopenjdk/jdk/6769