[OpenJDK 2D-Dev] JDK 9 RFR of JDK-8044694: Fix finally lint warnings in sun.print
Phil Race
philip.race at oracle.com
Tue Jun 3 18:34:21 UTC 2014
Both of these came in via an IBM contributed fix :-
http://mail.openjdk.java.net/pipermail/2d-dev/2011-October/002206.html
He [it appears] wanted to be very sure the throw was executed but it seems
like it could just be moved after the finally block which might be better
than suppressing the warning.
-phil.
On 6/3/2014 10:11 AM, Joe Darcy wrote:
> 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