< prev index next >

src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java

Print this page

        

*** 656,686 **** this(tag, type, count, createArrayForType(type, count)); } /** * Constructs a {@code TIFFField} with a single non-negative integral ! * value. ! * The field will have type ! * {@link TIFFTag#TIFF_SHORT TIFF_SHORT} if ! * {@code val < 65536} and type ! * {@link TIFFTag#TIFF_LONG TIFF_LONG} otherwise. The count ! * of the field will be unity. * * @param tag The tag to associate with this field. * @param value The value to associate with this field. * @throws NullPointerException if {@code tag == null}. ! * @throws IllegalArgumentException if the derived type is unacceptable ! * for the supplied {@code TIFFTag}. ! * @throws IllegalArgumentException if {@code value < 0}. */ ! public TIFFField(TIFFTag tag, int value) { if(tag == null) { throw new NullPointerException("tag == null!"); } if (value < 0) { throw new IllegalArgumentException("value < 0!"); } this.tag = tag; this.tagNumber = tag.getNumber(); this.count = 1; --- 656,690 ---- this(tag, type, count, createArrayForType(type, count)); } /** * Constructs a {@code TIFFField} with a single non-negative integral ! * value. The field will have type {@link TIFFTag#TIFF_SHORT TIFF_SHORT} ! * if {@code value} is in {@code [0,65535]}, and type ! * {@link TIFFTag#TIFF_LONG TIFF_LONG} if {@code value} is in ! * {@code [65536,4294967295]}. The count of the field will be unity. * * @param tag The tag to associate with this field. * @param value The value to associate with this field. * @throws NullPointerException if {@code tag == null}. ! * @throws IllegalArgumentException if {@code value} is not in ! * {@code [0,4294967295]}. ! * @throws IllegalArgumentException if {@code value} is in {@code [0,65535]} ! * and {@code TIFF_SHORT} is an unacceptable type for the {@code TIFFTag}, ! * or if {@code value} is in {@code [65536,4294967295]} and ! * {@code TIFF_LONG} is an unacceptable type for the {@code TIFFTag}. */ ! public TIFFField(TIFFTag tag, long value) { if(tag == null) { throw new NullPointerException("tag == null!"); } if (value < 0) { throw new IllegalArgumentException("value < 0!"); } + if (value > 0xffffffffL) { + throw new IllegalArgumentException("value > 4294967295!"); + } this.tag = tag; this.tagNumber = tag.getNumber(); this.count = 1;
< prev index next >