[OpenJDK 2D-Dev] JDK 9 RFR of JDK-8148914: BitDepth.java test fails

joe darcy joe.darcy at oracle.com
Mon Feb 15 17:35:56 UTC 2016


Any comments on this?

Thanks,

-Joe

On 2/11/2016 6:00 PM, joe darcy wrote:
> Hello,
>
> Please review a candidate fix for
>
>     JDK-8148914: BitDepth.java test fails
>
> In brief, OpenJDK supports two fewer buffered image formats for jpg 
> than the closed JDK does. I've modified the BitDepth test to allow for 
> this difference. Patch below; webrev at
>
>     http://cr.openjdk.java.net/~darcy/8148914.0/
>
> Thanks,
>
> -Joe
>
> --- a/test/javax/imageio/plugins/shared/BitDepth.java    Thu Feb 11 
> 16:24:55 2016 -0800
> +++ b/test/javax/imageio/plugins/shared/BitDepth.java    Thu Feb 11 
> 17:26:23 2016 -0800
> @@ -130,11 +130,7 @@
>
>          boolean allOK = true;
>
> -        for (int i = 0; i < biRGBTypes.length; i++) {
> -
> -            int type = biRGBTypes[i];
> -
> -
> +        for (int type : biRGBTypes) {
>              // TODO: remove the following 'if' block after the 
> 8147448 fix
>              if ( format.toLowerCase().equals("bmp") && (
>                  (type == BufferedImage.TYPE_INT_ARGB       ) ||
> @@ -151,12 +147,23 @@
>
>              System.out.println("Testing " + format +
>                                 " writer for type " + biTypeNames[type]);
> -            File f = testWriteRGB(format, type);
> -            boolean ok = testReadRGB(f);
> -            if (ok) {
> -                f.delete();
> +            boolean ok = false;
> +            File f = null;
> +            try {
> +                f = testWriteRGB(format, type);
> +                ok = testReadRGB(f);
> +            } catch (javax.imageio.IIOException e) {
> +                // The follow two formats are not supported on OpenJDK
> +                if (format.toLowerCase().equals("jpg") &&
> +                    (type == BufferedImage.TYPE_4BYTE_ABGR ||
> +                     type == BufferedImage.TYPE_4BYTE_ABGR_PRE))
> +                    continue;
> +            } finally {
> +                if (ok) {
> +                    f.delete();
> +                }
> +                allOK = allOK && (ok || f == null);
>              }
> -            allOK = allOK && ok;
>          }
>
>




More information about the 2d-dev mailing list