test/jdk/javax/imageio/GetReaderWriterInfoNullTest.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 40706 jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java@19e735c76e8c
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40706
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     1
/*
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     4
 *
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     7
 * published by the Free Software Foundation.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     8
 *
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    13
 * accompanied this code).
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    14
 *
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    18
 *
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    21
 * questions.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    22
 */
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    23
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    24
/*
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    25
 * @test
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    26
 * @bug     8163258
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    27
 * @summary Test verifies that when we create our own ImageReaderSpi
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    28
 *          implementaion with MIMEType or FileSuffix as null, it should
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    29
 *          not throw NullPointerException when we call
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    30
 *          ImageIO.getReaderMIMETypes() or ImageIO.getReaderFileSuffixes().
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    31
 * @run     main GetReaderWriterInfoNullTest
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    32
 */
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    33
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    34
import java.awt.image.BufferedImage;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    35
import java.io.IOException;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    36
import java.util.Iterator;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    37
import java.util.Locale;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    38
import javax.imageio.IIOException;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    39
import javax.imageio.ImageReadParam;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    40
import javax.imageio.ImageReader;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    41
import javax.imageio.ImageTypeSpecifier;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    42
import javax.imageio.metadata.IIOMetadata;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    43
import javax.imageio.spi.ImageReaderSpi;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    44
import javax.imageio.stream.ImageInputStream;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    45
import javax.imageio.ImageIO;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    46
import javax.imageio.spi.IIORegistry;
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    47
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    48
class TestImageReaderSpi extends ImageReaderSpi {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    49
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    50
    public TestImageReaderSpi(String[] FORMATNAMES, String[] SUFFIXES,
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    51
                              String[] MIMETYPES) {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    52
        super("J Duke",          // vendor
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    53
              "1.0",             // version
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    54
              FORMATNAMES,       // format names
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    55
              SUFFIXES,          // file suffixes
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    56
              MIMETYPES,         // mimetypes
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    57
              "readTest.TestImageReader",    // reader class name
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    58
              new Class<?>[] { ImageInputStream.class }, // input types
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    59
              null,              // writer class names.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    60
              true,              // supports native metadata,
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    61
              null,              // [no] native stream metadata format
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    62
              null,              // [no] native stream metadata class
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    63
              null,              // [no] native extra stream metadata format
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    64
              null,              // [no] native extra stream metadata class
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    65
              true,              // supports standard metadata,
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    66
              null,              // metadata format name,
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    67
              null,              // metadata format class name
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    68
              null,              // [no] extra image metadata format
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    69
              null               // [no] extra image metadata format class
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    70
         );
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    71
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    72
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    73
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    74
    public boolean canDecodeInput(Object source) throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    75
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    76
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    77
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    78
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    79
    public String getDescription(Locale locale) {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    80
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    81
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    82
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    83
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    84
    public ImageReader createReaderInstance(Object extension)
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    85
            throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    86
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    87
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    88
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    89
}
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    90
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    91
class TestImageReader extends ImageReader {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    92
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    93
    public TestImageReader(ImageReaderSpi originatingProvider) {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    94
        super(originatingProvider);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    95
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    96
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    97
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    98
    public int getNumImages(boolean allowSearch) throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
    99
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   100
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   101
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   102
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   103
    public int getWidth(int imageIndex) throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   104
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   105
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   106
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   107
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   108
    public int getHeight(int imageIndex) throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   109
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   110
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   111
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   112
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   113
    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   114
            throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   115
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   116
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   117
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   118
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   119
    public IIOMetadata getStreamMetadata() throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   120
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   121
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   122
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   123
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   124
    public IIOMetadata getImageMetadata(int imageIndex) throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   125
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   126
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   127
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   128
    @Override
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   129
    public BufferedImage read(int imageIndex, ImageReadParam param)
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   130
            throws IOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   131
        throw new UnsupportedOperationException("Not supported yet.");
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   132
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   133
}
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   134
public class GetReaderWriterInfoNullTest {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   135
    static final String[] FORMATNAMES = {"readTest"};
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   136
    static final String[] SUFFIXES = {"readTest"};
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   137
    static final String[] MIMETYPES = {"readTest"};
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   138
    public static void main (String[] args) throws IIOException {
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   139
        // Verify getReaderMIMETypes() behavior by keeping MIMEType as null.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   140
        TestImageReaderSpi mimeNullReadSpi =
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   141
                new TestImageReaderSpi(FORMATNAMES, SUFFIXES, null);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   142
        IIORegistry.getDefaultInstance().
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   143
                registerServiceProvider(mimeNullReadSpi);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   144
        ImageIO.getReaderMIMETypes();
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   145
        IIORegistry.getDefaultInstance().
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   146
                deregisterServiceProvider(mimeNullReadSpi);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   147
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   148
        /*
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   149
         * Verify getReaderFileSuffixes() behavior by keeping
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   150
         * file suffix as null.
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   151
         */
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   152
        TestImageReaderSpi suffixNullReadSpi =
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   153
                new TestImageReaderSpi(FORMATNAMES, null, MIMETYPES);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   154
        IIORegistry.getDefaultInstance().
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   155
                registerServiceProvider(suffixNullReadSpi);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   156
        ImageIO.getReaderFileSuffixes();
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   157
        IIORegistry.getDefaultInstance().
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   158
                deregisterServiceProvider(suffixNullReadSpi);
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   159
    }
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   160
}
19e735c76e8c 8163258: Getting NullPointerException from ImageIO.getReaderWriterInfo due to failure to check for null
jdv
parents:
diff changeset
   161