Author: toad
Date: 2007-08-11 16:29:31 +0000 (Sat, 11 Aug 2007)
New Revision: 14613

Modified:
   trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
Log:
Bucket stream leak. May have been a fd leak and possibly a tempfile leak on 
Windows.

Modified: trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java       
2007-08-11 16:26:31 UTC (rev 14612)
+++ trunk/freenet/src/freenet/clients/http/filter/HTMLFilter.java       
2007-08-11 16:29:31 UTC (rev 14613)
@@ -84,10 +84,19 @@
                HTMLParseContext pc = new HTMLParseContext(r, w, null, new 
NullFilterCallback());
                try {
                        pc.run(null);
+               } catch (IOException e) {
+                       throw e;
                } catch (Throwable t) {
                        // Ignore ALL errors
                        if(logMINOR) Logger.minor(this, "Caught "+t+" trying to 
detect MIME type with "+parseCharset);
                }
+               try {
+                       r.close();
+               } catch (IOException e) {
+                       throw e;
+               } catch (Throwable t) {
+                       if(logMINOR) Logger.minor(this, "Caught "+t+" closing 
stream after trying to detect MIME type with "+parseCharset);
+               }
                if(logMINOR) Logger.minor(this, "Returning charset 
"+pc.detectedCharset);
                return pc.detectedCharset;
        }


Reply via email to