You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
We made some changes to a class file in the Apache Ant project, and let several JVMs execute the corresponding JUnit test. We found that in the test case testParse in ExtraFieldUtilsTest, Dragonwell (11.0.9) threw an org.junit.ComparisonFailure while Dragonwell (1.8.0_275) threw a java.lang.AssertionError:
Dragonwell (1.8.0_275):
testParse(org.apache.tools.zip.ExtraFieldUtilsTest)
java.lang.AssertionError: message expected:<bad extra field starting at 18. Block length of 1 bytes exceeds remaining data of 0 bytes.> but was:<null>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.apache.tools.zip.ExtraFieldUtilsTest.testParse(ExtraFieldUtilsTest.java:96)
...
Dragonwell (11.0.9):
testParse(org.apache.tools.zip.ExtraFieldUtilsTest)
org.junit.ComparisonFailure: message expected:<[bad extra field starting at 18. Block length of 1 bytes exceeds remaining data of 0 bytes.]> but was:<[arraycopy: last source index 23 out of bounds for byte[22]]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.apache.tools.zip.ExtraFieldUtilsTest.testParse(ExtraFieldUtilsTest.java:96)
...
After inspecting into the source code of JUnit, we found the JVM just executed the different path in the method assertEquals of org.junit.Assert(junit-4.12.jar):
staticpublicvoidassertEquals(Stringmessage, Objectexpected,
Objectactual) {
if (equalsRegardingNull(expected, actual)) {
return;
} elseif (expectedinstanceofString && actualinstanceofString) {
StringcleanMessage = message == null ? "" : message;
thrownewComparisonFailure(cleanMessage, (String) expected, (String) actual); // Dragonwell (11.0.9) executed this line
} else {
failNotEquals(message, expected, actual); // Dragonwell (1.8.0_275) executed this line
}
}
Then I add several print statement in the ExtraFieldUtilsTest.java to debug:
@TestpublicvoidtestParse() throwsException {
ZipExtraField[] ze = ExtraFieldUtils.parse(data);
assertEquals("number of fields", 2, ze.length);
assertTrue("type field 1", ze[0] instanceofAsiExtraField);
assertEquals("mode field 1", 040755,
((AsiExtraField) ze[0]).getMode());
assertTrue("type field 2", ze[1] instanceofUnrecognizedExtraField);
assertEquals("data length field 2", 1,
ze[1].getLocalFileDataLength().getValue());
byte[] data2 = newbyte[data.length - 1];
System.arraycopy(data, 0, data2, 0, data2.length);
try {
ExtraFieldUtils.parse(data2);
fail("data should be invalid");
} catch (Exceptione) {
System.out.println(data2);
System.out.println(e);
System.out.println(e==null);
System.out.println(e.getMessage());
e.printStackTrace();
assertEquals("message",
"bad extra field starting at " + (4 + aLocal.length)
+ ". Block length of 1 bytes exceeds remaining data of 0 bytes.",
e.getMessage());
}
}
I found that for Dragonwell (1.8.0_275), e.getMessage() returns null, while e.getMessage() of Dragonwell (11.0.9) returns arraycopy: last source index 23 out of bounds for byte[22]. But e.getMessage() should not be null.
Steps to Reproduce
Steps to reproduce the behavior:
In directory DifferentExecutionPath, run command java -cp sootOutput/junit-ant/:hamcrest-core-1.3.jar:junit-4.12.jar org.junit.runner.JUnitCore org.apache.tools.zip.ExtraFieldUtilsTest
Expected behavior
Dragonwell (1.8.0_275) is expected to throw ComparisonFailure.
e.getMessage() for Dragonwell (1.8.0_275) should be a non-null value.
JDK version
dw8:
openjdk version "1.8.0_275"
OpenJDK Runtime Environment (Alibaba Dragonwell 8.5.5) (build 1.8.0_275-b2)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell 8.5.5) (build 25.275-b2, mixed mode)
dw11:
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment (Alibaba Dragonwell) (build 11.0.9+0)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell) (build 11.0.9+0, mixed mode)
Execution environment
OS and version: Ubuntu 16.04.6 LTS
CPU model: Intel(R) Xeon(R) CPU E5-4610 v4 @ 1.80GHz
Number of CPU cores: 4CPUs, each has 10 cores
Size of physical memory: 16384 MB * 20
The text was updated successfully, but these errors were encountered:
Thanks a lot for the bug report. Note that the bug report at https://bugs.openjdk.java.net/browse/JDK-8259961 is still unresolved. The OpenJDK developers only confirmed that the issue is reproducible.
Description
We made some changes to a class file in the Apache Ant project, and let several JVMs execute the corresponding JUnit test. We found that in the test case
testParse
inExtraFieldUtilsTest
, Dragonwell (11.0.9) threw an org.junit.ComparisonFailure while Dragonwell (1.8.0_275) threw a java.lang.AssertionError:Dragonwell (1.8.0_275):
Dragonwell (11.0.9):
After inspecting into the source code of JUnit, we found the JVM just executed the different path in the method
assertEquals
oforg.junit.Assert
(junit-4.12.jar):Then I add several print statement in the ExtraFieldUtilsTest.java to debug:
I found that for Dragonwell (1.8.0_275), e.getMessage() returns null, while e.getMessage() of Dragonwell (11.0.9) returns
arraycopy: last source index 23 out of bounds for byte[22]
. But e.getMessage() should not be null.Steps to Reproduce
Steps to reproduce the behavior:
DifferentExecutionPath
, run commandjava -cp sootOutput/junit-ant/:hamcrest-core-1.3.jar:junit-4.12.jar org.junit.runner.JUnitCore org.apache.tools.zip.ExtraFieldUtilsTest
Expected behavior
Dragonwell (1.8.0_275) is expected to throw ComparisonFailure.
e.getMessage() for Dragonwell (1.8.0_275) should be a non-null value.
JDK version
dw8:
dw11:
Execution environment
The text was updated successfully, but these errors were encountered: