6656625: ImageReaderSpi.STANDARD_INPUT_TYPE/ImageWriterSpi.STANDARD_OUTPUT_TYPE are mutable static (findbugs)
Reviewed-by: prr
This commit is contained in:
parent
ec41d4d0e9
commit
10f62128a4
@ -51,7 +51,7 @@ public class BMPImageReaderSpi extends ImageReaderSpi {
|
|||||||
entensions,
|
entensions,
|
||||||
mimeType,
|
mimeType,
|
||||||
"com.sun.imageio.plugins.bmp.BMPImageReader",
|
"com.sun.imageio.plugins.bmp.BMPImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] { ImageInputStream.class },
|
||||||
writerSpiNames,
|
writerSpiNames,
|
||||||
false,
|
false,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
|
@ -32,6 +32,7 @@ import java.awt.image.SinglePixelPackedSampleModel;
|
|||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
import javax.imageio.spi.IIORegistry;
|
import javax.imageio.spi.IIORegistry;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.IIOException;
|
import javax.imageio.IIOException;
|
||||||
@ -55,7 +56,7 @@ public class BMPImageWriterSpi extends ImageWriterSpi {
|
|||||||
entensions,
|
entensions,
|
||||||
mimeType,
|
mimeType,
|
||||||
"com.sun.imageio.plugins.bmp.BMPImageWriter",
|
"com.sun.imageio.plugins.bmp.BMPImageWriter",
|
||||||
STANDARD_OUTPUT_TYPE,
|
new Class[] { ImageOutputStream.class },
|
||||||
readerSpiNames,
|
readerSpiNames,
|
||||||
false,
|
false,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
|
@ -60,7 +60,7 @@ public class GIFImageReaderSpi extends ImageReaderSpi {
|
|||||||
suffixes,
|
suffixes,
|
||||||
MIMETypes,
|
MIMETypes,
|
||||||
readerClassName,
|
readerClassName,
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] { ImageInputStream.class },
|
||||||
writerSpiNames,
|
writerSpiNames,
|
||||||
true,
|
true,
|
||||||
GIFStreamMetadata.nativeMetadataFormatName,
|
GIFStreamMetadata.nativeMetadataFormatName,
|
||||||
|
@ -31,6 +31,7 @@ import java.util.Locale;
|
|||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import com.sun.imageio.plugins.common.PaletteBuilder;
|
import com.sun.imageio.plugins.common.PaletteBuilder;
|
||||||
|
|
||||||
public class GIFImageWriterSpi extends ImageWriterSpi {
|
public class GIFImageWriterSpi extends ImageWriterSpi {
|
||||||
@ -59,7 +60,7 @@ public class GIFImageWriterSpi extends ImageWriterSpi {
|
|||||||
suffixes,
|
suffixes,
|
||||||
MIMETypes,
|
MIMETypes,
|
||||||
writerClassName,
|
writerClassName,
|
||||||
STANDARD_OUTPUT_TYPE,
|
new Class[] { ImageOutputStream.class },
|
||||||
readerSpiNames,
|
readerSpiNames,
|
||||||
true,
|
true,
|
||||||
GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,
|
GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,
|
||||||
|
@ -46,7 +46,7 @@ public class JPEGImageReaderSpi extends ImageReaderSpi {
|
|||||||
JPEG.suffixes,
|
JPEG.suffixes,
|
||||||
JPEG.MIMETypes,
|
JPEG.MIMETypes,
|
||||||
"com.sun.imageio.plugins.jpeg.JPEGImageReader",
|
"com.sun.imageio.plugins.jpeg.JPEGImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] { ImageInputStream.class },
|
||||||
writerSpiNames,
|
writerSpiNames,
|
||||||
true,
|
true,
|
||||||
JPEG.nativeStreamMetadataFormatName,
|
JPEG.nativeStreamMetadataFormatName,
|
||||||
|
@ -28,6 +28,7 @@ package com.sun.imageio.plugins.jpeg;
|
|||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
import javax.imageio.spi.IIORegistry;
|
import javax.imageio.spi.IIORegistry;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.IIOException;
|
import javax.imageio.IIOException;
|
||||||
@ -49,7 +50,7 @@ public class JPEGImageWriterSpi extends ImageWriterSpi {
|
|||||||
JPEG.suffixes,
|
JPEG.suffixes,
|
||||||
JPEG.MIMETypes,
|
JPEG.MIMETypes,
|
||||||
"com.sun.imageio.plugins.jpeg.JPEGImageWriter",
|
"com.sun.imageio.plugins.jpeg.JPEGImageWriter",
|
||||||
STANDARD_OUTPUT_TYPE,
|
new Class[] { ImageOutputStream.class },
|
||||||
readerSpiNames,
|
readerSpiNames,
|
||||||
true,
|
true,
|
||||||
JPEG.nativeStreamMetadataFormatName,
|
JPEG.nativeStreamMetadataFormatName,
|
||||||
|
@ -60,7 +60,7 @@ public class PNGImageReaderSpi extends ImageReaderSpi {
|
|||||||
suffixes,
|
suffixes,
|
||||||
MIMETypes,
|
MIMETypes,
|
||||||
readerClassName,
|
readerClassName,
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] { ImageInputStream.class },
|
||||||
writerSpiNames,
|
writerSpiNames,
|
||||||
false,
|
false,
|
||||||
null, null,
|
null, null,
|
||||||
|
@ -34,6 +34,7 @@ import javax.imageio.ImageTypeSpecifier;
|
|||||||
import javax.imageio.metadata.IIOMetadataFormat;
|
import javax.imageio.metadata.IIOMetadataFormat;
|
||||||
import javax.imageio.metadata.IIOMetadataFormatImpl;
|
import javax.imageio.metadata.IIOMetadataFormatImpl;
|
||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
|
|
||||||
public class PNGImageWriterSpi extends ImageWriterSpi {
|
public class PNGImageWriterSpi extends ImageWriterSpi {
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public class PNGImageWriterSpi extends ImageWriterSpi {
|
|||||||
suffixes,
|
suffixes,
|
||||||
MIMETypes,
|
MIMETypes,
|
||||||
writerClassName,
|
writerClassName,
|
||||||
STANDARD_OUTPUT_TYPE,
|
new Class[] { ImageOutputStream.class },
|
||||||
readerSpiNames,
|
readerSpiNames,
|
||||||
false,
|
false,
|
||||||
null, null,
|
null, null,
|
||||||
|
@ -51,7 +51,7 @@ public class WBMPImageReaderSpi extends ImageReaderSpi {
|
|||||||
entensions,
|
entensions,
|
||||||
mimeType,
|
mimeType,
|
||||||
"com.sun.imageio.plugins.wbmp.WBMPImageReader",
|
"com.sun.imageio.plugins.wbmp.WBMPImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] { ImageInputStream.class },
|
||||||
writerSpiNames,
|
writerSpiNames,
|
||||||
true,
|
true,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
|
@ -28,6 +28,7 @@ package com.sun.imageio.plugins.wbmp;
|
|||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
import javax.imageio.spi.IIORegistry;
|
import javax.imageio.spi.IIORegistry;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.IIOException;
|
import javax.imageio.IIOException;
|
||||||
@ -54,7 +55,7 @@ public class WBMPImageWriterSpi extends ImageWriterSpi {
|
|||||||
entensions,
|
entensions,
|
||||||
mimeType,
|
mimeType,
|
||||||
"com.sun.imageio.plugins.wbmp.WBMPImageWriter",
|
"com.sun.imageio.plugins.wbmp.WBMPImageWriter",
|
||||||
STANDARD_OUTPUT_TYPE,
|
new Class[] { ImageOutputStream.class },
|
||||||
readerSpiNames,
|
readerSpiNames,
|
||||||
true,
|
true,
|
||||||
null, null, null, null,
|
null, null, null, null,
|
||||||
|
@ -77,7 +77,10 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi {
|
|||||||
* A single-element array, initially containing
|
* A single-element array, initially containing
|
||||||
* <code>ImageInputStream.class</code>, to be returned from
|
* <code>ImageInputStream.class</code>, to be returned from
|
||||||
* <code>getInputTypes</code>.
|
* <code>getInputTypes</code>.
|
||||||
|
* @deprecated Instead of using this field, directly create
|
||||||
|
* the equivalent array <code>{ ImageInputStream.class }<code>.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final Class[] STANDARD_INPUT_TYPE =
|
public static final Class[] STANDARD_INPUT_TYPE =
|
||||||
{ ImageInputStream.class };
|
{ ImageInputStream.class };
|
||||||
|
|
||||||
@ -227,7 +230,11 @@ public abstract class ImageReaderSpi extends ImageReaderWriterSpi {
|
|||||||
throw new IllegalArgumentException
|
throw new IllegalArgumentException
|
||||||
("inputTypes.length == 0!");
|
("inputTypes.length == 0!");
|
||||||
}
|
}
|
||||||
this.inputTypes = (Class[])inputTypes.clone();
|
|
||||||
|
this.inputTypes = (inputTypes == STANDARD_INPUT_TYPE) ?
|
||||||
|
new Class<?>[] { ImageInputStream.class } :
|
||||||
|
inputTypes.clone();
|
||||||
|
|
||||||
// If length == 0, leave it null
|
// If length == 0, leave it null
|
||||||
if (writerSpiNames != null && writerSpiNames.length > 0) {
|
if (writerSpiNames != null && writerSpiNames.length > 0) {
|
||||||
this.writerSpiNames = (String[])writerSpiNames.clone();
|
this.writerSpiNames = (String[])writerSpiNames.clone();
|
||||||
|
@ -77,9 +77,12 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A single-element array, initially containing
|
* A single-element array, initially containing
|
||||||
* <code>ImageInputStream.class</code>, to be returned from
|
* <code>ImageOutputStream.class</code>, to be returned from
|
||||||
* <code>getInputTypes</code>.
|
* <code>getOutputTypes</code>.
|
||||||
|
* @deprecated Instead of using this field, directly create
|
||||||
|
* the equivalent array <code>{ ImageOutputStream.class }<code>.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static final Class[] STANDARD_OUTPUT_TYPE =
|
public static final Class[] STANDARD_OUTPUT_TYPE =
|
||||||
{ ImageOutputStream.class };
|
{ ImageOutputStream.class };
|
||||||
|
|
||||||
@ -228,7 +231,11 @@ public abstract class ImageWriterSpi extends ImageReaderWriterSpi {
|
|||||||
throw new IllegalArgumentException
|
throw new IllegalArgumentException
|
||||||
("outputTypes.length == 0!");
|
("outputTypes.length == 0!");
|
||||||
}
|
}
|
||||||
this.outputTypes = (Class[])outputTypes.clone();
|
|
||||||
|
this.outputTypes = (outputTypes == STANDARD_OUTPUT_TYPE) ?
|
||||||
|
new Class<?>[] { ImageOutputStream.class } :
|
||||||
|
outputTypes.clone();
|
||||||
|
|
||||||
// If length == 0, leave it null
|
// If length == 0, leave it null
|
||||||
if (readerSpiNames != null && readerSpiNames.length > 0) {
|
if (readerSpiNames != null && readerSpiNames.length > 0) {
|
||||||
this.readerSpiNames = (String[])readerSpiNames.clone();
|
this.readerSpiNames = (String[])readerSpiNames.clone();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user