From 5302ecdbff769171e41aabbef529d19bb5346b0c Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 3 May 2016 09:48:02 -0700 Subject: [PATCH] 8149560: TIFFField#createFromMetadataNode throws a NullPointerException when the node is set with "tagNumber" attribute In the specification of createFromMetadataNode() change "tagNumber" to "number" and add two throws clauses which match the behavior. Reviewed-by: prr --- .../share/classes/javax/imageio/plugins/tiff/TIFFField.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java index 168e6b17328..3ac06d98414 100644 --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java @@ -412,7 +412,7 @@ public class TIFFField implements Cloneable { /** * Creates a {@code TIFFField} from a TIFF native image - * metadata node. If the value of the "tagNumber" attribute + * metadata node. If the value of the "number" attribute * of the node is not found in {@code tagSet} then a new * {@code TIFFTag} with name {@code TIFFTag.UNKNOWN_TAG_NAME} * will be created and assigned to the field. @@ -424,6 +424,10 @@ public class TIFFField implements Cloneable { * {@code null}. * @throws IllegalArgumentException if the name of the node is not * {@code "TIFFField"}. + * @throws NullPointerException if the node does not contain any data. + * @throws IllegalArgumentException if the combination of node attributes + * and data is not legal per the {@link #TIFFField(TIFFTag,int,int,Object)} + * constructor specification. * @return A new {@code TIFFField}. */ public static TIFFField createFromMetadataNode(TIFFTagSet tagSet,