--- old/src/java.desktop/share/classes/sun/print/PSPrinterJob.java 2019-07-15 08:52:05.000000000 -0700 +++ new/src/java.desktop/share/classes/sun/print/PSPrinterJob.java 2019-07-15 08:52:05.000000000 -0700 @@ -947,33 +947,23 @@ int index = 0; byte[] rgbData = new byte[intSrcWidth * 3]; - try { - /* Skip the parts of the image that are not part - * of the source rectangle. - */ - index = (int) srcY * srcBitMapWidth; - - for(int i = 0; i < intSrcHeight; i++) { - - /* Skip the left part of the image that is not - * part of the source rectangle. - */ - index += (int) srcX; + /* Skip the parts of the image that are not part + * of the source rectangle. + */ + index = (int) srcY * srcBitMapWidth; - index = swapBGRtoRGB(bgrData, index, rgbData); - byte[] encodedData = rlEncode(rgbData); - byte[] asciiData = ascii85Encode(encodedData); - mPSStream.write(asciiData); - mPSStream.println(""); - } + for(int i = 0; i < intSrcHeight; i++) { - /* - * If there is an IOError we subvert it to a PrinterException. - * Fix: There has got to be a better way, maybe define - * a PrinterIOException and then throw that? + /* Skip the left part of the image that is not + * part of the source rectangle. */ - } catch (IOException e) { - //throw new PrinterException(e.toString()); + index += (int) srcX; + + index = swapBGRtoRGB(bgrData, index, rgbData); + byte[] encodedData = rlEncode(rgbData); + byte[] asciiData = ascii85Encode(encodedData); + mPSStream.write(asciiData); + mPSStream.println(""); } mPSStream.println(IMAGE_RESTORE); @@ -1023,17 +1013,16 @@ int index = 0; byte[] rgbData = new byte[width*3]; - try { - for(int i = 0; i < height; i++) { - index = swapBGRtoRGB(bgrData, index, rgbData); - byte[] encodedData = rlEncode(rgbData); - byte[] asciiData = ascii85Encode(encodedData); - mPSStream.write(asciiData); - mPSStream.println(""); - } + for(int i = 0; i < height; i++) { + index = swapBGRtoRGB(bgrData, index, rgbData); + byte[] encodedData = rlEncode(rgbData); + byte[] asciiData = ascii85Encode(encodedData); + mPSStream.write(asciiData); + mPSStream.println(""); + } - } catch (IOException e) { - throw new PrinterIOException(e); + if (mPSStream.checkError()) { + throw new PrinterException("Error in PrintStream"); } mPSStream.println(IMAGE_RESTORE);