[OpenJDK 2D-Dev] JDK 9 RFR of JDK-8044694: Fix finally lint warnings in sun.print

Joe Darcy joe.darcy at oracle.com
Tue Jun 3 17:11:37 UTC 2014


Hello,

Please review a fix for

     JDK-8044694: Fix finally lint warnings in sun.print
     http://cr.openjdk.java.net/~darcy/8044694.0/

One of javac's lint warnings is for a finally block that cannot complete 
normally. The printing code has two instances with a finally block like

                   } finally {
                       pw.flush();
                       throw new IOException(sw.toString());
                   }

This cannot complete normally, since an exception is unconditionally 
thrown, but it very much seems to be the intended behavior. The fix is 
to add @SuppressWarnings("finally") annotations:

--- old/src/share/classes/sun/print/PSPrinterJob.java    2014-06-03 
10:07:16.000000000 -0700
+++ new/src/share/classes/sun/print/PSPrinterJob.java    2014-06-03 
10:07:16.000000000 -0700
@@ -687,6 +687,7 @@

      // Inner class to run "privileged" to invoke the system print command

+    @SuppressWarnings("finally") // Exception always thrown in finally 
block
      private class PrinterSpooler implements 
java.security.PrivilegedAction {
          PrinterException pex;

--- old/src/solaris/classes/sun/print/UnixPrintJob.java 2014-06-03 
10:07:16.000000000 -0700
+++ new/src/solaris/classes/sun/print/UnixPrintJob.java 2014-06-03 
10:07:16.000000000 -0700
@@ -971,6 +971,7 @@

      // Inner class to run "privileged" to invoke the system print command

+    @SuppressWarnings("finally") // Exception always thrown in finally 
block
      private class PrinterSpooler implements 
java.security.PrivilegedAction {
          PrintException pex;

Thanks,

-Joe



More information about the 2d-dev mailing list