Skip to content

Commit 98cd8ef

Browse files
committed
fix CI build error
1 parent 7852810 commit 98cd8ef

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/test/java/org/json/junit/XMLTest.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -934,16 +934,24 @@ public void testIssue537CaseSensitiveHexEscapeMinimal(){
934934
@Test
935935
public void testIssue537CaseSensitiveHexEscapeFullFile(){
936936
try {
937-
try(
938-
InputStream xmlStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.xml");
939-
Reader xmlReader = new InputStreamReader(xmlStream);
940-
){
937+
InputStream xmlStream = null;
938+
try {
939+
xmlStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.xml");
940+
Reader xmlReader = new InputStreamReader(xmlStream);
941941
JSONObject actual = XML.toJSONObject(xmlReader, true);
942-
try(
943-
InputStream jsonStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.json");
944-
){
942+
InputStream jsonStream = null;
943+
try {
944+
jsonStream = XMLTest.class.getClassLoader().getResourceAsStream("Issue537.json");
945945
final JSONObject expected = new JSONObject(new JSONTokener(jsonStream));
946946
Util.compareActualVsExpectedJsonObjects(actual,expected);
947+
} finally {
948+
if (jsonStream != null) {
949+
jsonStream.close();
950+
}
951+
}
952+
} finally {
953+
if (xmlStream != null) {
954+
xmlStream.close();
947955
}
948956
}
949957
} catch (IOException e) {

0 commit comments

Comments
 (0)