You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by bu...@apache.org on 2009/03/18 08:51:49 UTC

DO NOT REPLY [Bug 46871] New: Stream incorrectly closed in Services - swallows original Exception

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: batik-dev@xmlgraphics.apache.org
        ReportedBy: fabrizio.giudici@tidalwave.it


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: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 46871] Stream incorrectly closed in Services - triggers NPE and swallows original Exception

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46871


Fabrizio Giudici <fa...@tidalwave.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Stream incorrectly closed   |Stream incorrectly closed
                   |in Services - swallows      |in Services - triggers NPE
                   |original Exception          |and swallows original
                   |                            |Exception




-- 
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: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


DO NOT REPLY [Bug 46871] Stream incorrectly closed in Services - triggers NPE and swallows original Exception

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46871


Cameron McCormack <ca...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Cameron McCormack <ca...@apache.org>  2009-03-18 19:52:53 PST ---
Thanks Fabrizio.  Fixed in r755817 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=755817 )  (The patch was small enough not to need an
ICLA to be submitted, IMO.)

-- 
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: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org