< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFFieldNode.java

Print this page

        

@@ -36,13 +36,18 @@
 /**
  * The {@code Node} representation of a {@code TIFFField}
  * wherein the child node is procedural rather than buffered.
  */
 public class TIFFFieldNode extends IIOMetadataNode {
+    private static boolean isIFD(TIFFField f) {
+        int type = f.getType();
+        return f.hasDirectory() &&
+            (type == TIFFTag.TIFF_LONG || type == TIFFTag.TIFF_IFD_POINTER);
+    }
+
     private static String getNodeName(TIFFField f) {
-        return (f.hasDirectory() || f.getData() instanceof TIFFDirectory) ?
-            "TIFFIFD" : "TIFFField";
+        return isIFD(f) ? "TIFFIFD" : "TIFFField";
     }
 
     private boolean isIFD;
 
     private Boolean isInitialized = Boolean.FALSE;

@@ -50,12 +55,11 @@
     private TIFFField field;
 
     public TIFFFieldNode(TIFFField field) {
         super(getNodeName(field));
 
-        isIFD = field.hasDirectory() ||
-            field.getData() instanceof TIFFDirectory;
+        isIFD = isIFD(field);
 
         this.field = field;
 
         TIFFTag tag = field.getTag();
         int tagNumber = tag.getNumber();
< prev index next >