Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.8
-
None
-
None
-
Operating System: All
Platform: PC
Description
Hello.
The class org.apache.batik.util.Services incorrectly closes a stream, causing in some cases a NPE that swallows the original exception. This has personally caused quite a mess for finding an error in a custom application that triggered this.
The culprit is this code:
if ( br == null ){
try
catch ( IOException ignored ){}
br = null;
}
Where clearly the test should be if (br != null). Attaching the svn diff of the patch:
Index: Service.java
===================================================================
— Service.java (revision 755499)
+++ Service.java (working copy)
@@ -146,7 +146,7 @@
} catch ( IOException ignored ){}
r = null;
}
- if ( br == null ){
+ if ( br != null ){
try { br.close(); }catch ( IOException ignored ){}