jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java Wed Sep 28 03:40:45 2016 +0300
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java Thu Sep 29 10:57:34 2016 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1234,43 +1234,46 @@
clearAbortRequest();
processImageStarted(0);
-
- try {
- write_magic();
- write_IHDR();
+ if (abortRequested()) {
+ processWriteAborted();
+ } else {
+ try {
+ write_magic();
+ write_IHDR();
- write_cHRM();
- write_gAMA();
- write_iCCP();
- write_sBIT();
- write_sRGB();
+ write_cHRM();
+ write_gAMA();
+ write_iCCP();
+ write_sBIT();
+ write_sRGB();
- write_PLTE();
+ write_PLTE();
- write_hIST();
- write_tRNS();
- write_bKGD();
+ write_hIST();
+ write_tRNS();
+ write_bKGD();
- write_pHYs();
- write_sPLT();
- write_tIME();
- write_tEXt();
- write_iTXt();
- write_zTXt();
+ write_pHYs();
+ write_sPLT();
+ write_tIME();
+ write_tEXt();
+ write_iTXt();
+ write_zTXt();
- writeUnknownChunks();
+ writeUnknownChunks();
+
+ write_IDAT(im, deflaterLevel);
- write_IDAT(im, deflaterLevel);
-
- if (abortRequested()) {
- processWriteAborted();
- } else {
- // Finish up and inform the listeners we are done
- writeIEND();
- processImageComplete();
+ if (abortRequested()) {
+ processWriteAborted();
+ } else {
+ // Finish up and inform the listeners we are done
+ writeIEND();
+ processImageComplete();
+ }
+ } catch (IOException e) {
+ throw new IIOException("I/O error writing PNG file!", e);
}
- } catch (IOException e) {
- throw new IIOException("I/O error writing PNG file!", e);
}
}
}