https://issues.apache.org/bugzilla/show_bug.cgi?id=46871
Summary: Stream incorrectly closed in Services - swallows
original Exception
Product: Batik
Version: 1.8
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Utilities
AssignedTo: [email protected]
ReportedBy: [email protected]
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{
br.close();
} 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 (
https://svn.apache.org/viewcvs.cgi?view=rev&rev=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 ){}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]