< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java

Print this page

        

*** 191,201 **** --- 191,211 ---- stream.seek(startPos); stream.writeInt((int)(pos - startPos) - 12); // Return to end of chunk and flush to minimize buffering stream.seek(pos); + try { stream.flushBefore(pos); + } catch (IOException e) { + /* + * If flushBefore() fails we try to access startPos in finally + * block of write_IDAT(). We should update startPos to avoid + * IndexOutOfBoundException while seek() is happening. + */ + this.startPos = stream.getStreamPosition(); + throw e; + } } public int read() throws IOException { throw new RuntimeException("Method not available"); }
< prev index next >