Changeset de2b204


Ignore:
Timestamp:
Mar 6, 2012 2:02:12 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
0cea3e0
Parents:
e1c3979a
Message:
  • viewstat.jsp: Properly close the ImageOutputStream? to fix NPEs in the finalizer, probably was the root cause of what we blamed on Jetty
Location:
apps/routerconsole/java/src/net/i2p/router/web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java

    re1c3979a rde2b204  
    305305        long start = end - period*periodCount;
    306306        //long begin = System.currentTimeMillis();
     307        ImageOutputStream ios = null;
    307308        try {
    308309            RrdGraphDef def = new RrdGraphDef();
     
    357358            Graphics gfx = img.getGraphics();
    358359            graph.render(gfx);
    359             ImageOutputStream ios = new MemoryCacheImageOutputStream(out);
     360            ios = new MemoryCacheImageOutputStream(out);
    360361            ImageIO.write(img, "png", ios);
    361362
     
    374375            _log.error("Error rendering", oom);
    375376            throw new IOException("Error plotting: " + oom.getMessage());
     377        } finally {
     378            // this does not close the underlying stream
     379            if (ios != null) try {ios.close();} catch (IOException ioe) {}
    376380        }
    377381    }
  • apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java

    re1c3979a rde2b204  
    100100        long start = end - (period * periodCount);
    101101        //long begin = System.currentTimeMillis();
     102        ImageOutputStream ios = null;
    102103        try {
    103104            RrdGraphDef def = new RrdGraphDef();
     
    187188            Graphics gfx = img.getGraphics();
    188189            graph.render(gfx);
    189             ImageOutputStream ios = new MemoryCacheImageOutputStream(out);
     190            ios = new MemoryCacheImageOutputStream(out);
    190191            ImageIO.write(img, "png", ios);
    191192            //System.out.println("Graph created");
     
    204205            _log.error("Error rendering", oom);
    205206            throw new IOException("Error plotting: " + oom.getMessage());
     207        } finally {
     208            // this does not close the underlying stream
     209            if (ios != null) try {ios.close();} catch (IOException ioe) {}
    206210        }
    207211    }
Note: See TracChangeset for help on using the changeset viewer.