File tree Expand file tree Collapse file tree
src/test/java/org/json/junit Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments