< prev index next >

src/java.desktop/share/classes/sun/print/PSPrinterJob.java

Print this page

        

@@ -945,11 +945,10 @@
         /* Image data.
          */
         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;
 

@@ -965,19 +964,10 @@
                 byte[] asciiData = ascii85Encode(encodedData);
                 mPSStream.write(asciiData);
                 mPSStream.println("");
             }
 
-            /*
-             * 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?
-             */
-        } catch (IOException e) {
-            //throw new PrinterException(e.toString());
-        }
-
         mPSStream.println(IMAGE_RESTORE);
     }
 
     /**
      * Prints the contents of the array of ints, 'data'

@@ -1021,21 +1011,20 @@
         /* Image data.
          */
         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("");
             }
 
-        } catch (IOException e) {
-            throw new PrinterIOException(e);
+        if (mPSStream.checkError()) {
+            throw new PrinterException("Error in PrintStream");
         }
 
         mPSStream.println(IMAGE_RESTORE);
     }
 
< prev index next >