pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1454877 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/ main/java/org/apache/pdfbox/pdmodel/ main/java/org/apache/pdfbox/pdmodel/common/ test/java/org/apache/pdfbox/ test/java/org/apache/pdfbox/pdmodel/common/
Date Sun, 10 Mar 2013 17:07:26 GMT
Author: lehmi
Date: Sun Mar 10 17:07:26 2013
New Revision: 1454877

URL: http://svn.apache.org/r1454877
Log:
PDFBOX-1380: improved calculation of the Limits values based on a proposal by Dominic Tubach

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/ExtractText.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDestinationNameTreeNode.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDEmbeddedFilesNameTreeNode.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/TestAll.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNameTreeNode.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/ExtractText.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/ExtractText.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/ExtractText.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/ExtractText.java Sun Mar 10 17:07:26
2013
@@ -28,6 +28,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
 import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
 import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
 import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile;
 import org.apache.pdfbox.pdmodel.encryption.AccessPermission;
@@ -281,9 +282,9 @@ public class ExtractText
                     PDEmbeddedFilesNameTreeNode embeddedFiles = names.getEmbeddedFiles();
                     if (embeddedFiles != null)
                     {
-                        Map<String,Object> embeddedFileNames = embeddedFiles.getNames();
+                        Map<String,COSObjectable> embeddedFileNames = embeddedFiles.getNames();
                         if (embeddedFileNames != null) {
-                            for (Map.Entry<String,Object> ent : embeddedFileNames.entrySet())

+                            for (Map.Entry<String,COSObjectable> ent : embeddedFileNames.entrySet())

                             {
                                 if (debug)
                                 {

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDestinationNameTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDestinationNameTreeNode.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDestinationNameTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDestinationNameTreeNode.java
Sun Mar 10 17:07:26 2013
@@ -21,6 +21,7 @@ import java.io.IOException;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.PDNameTreeNode;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination;
@@ -55,7 +56,7 @@ public class PDDestinationNameTreeNode e
     /**
      * {@inheritDoc}
      */
-    protected Object convertCOSToPD( COSBase base ) throws IOException
+    protected COSObjectable convertCOSToPD( COSBase base ) throws IOException
     {
         COSBase destination = base;
         if( base instanceof COSDictionary )

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDEmbeddedFilesNameTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDEmbeddedFilesNameTreeNode.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDEmbeddedFilesNameTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDEmbeddedFilesNameTreeNode.java
Sun Mar 10 17:07:26 2013
@@ -20,6 +20,7 @@ import java.io.IOException;
 
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.PDNameTreeNode;
 import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
 
@@ -52,10 +53,9 @@ public class PDEmbeddedFilesNameTreeNode
     /**
      * {@inheritDoc}
      */
-    protected Object convertCOSToPD( COSBase base ) throws IOException
+    protected COSObjectable convertCOSToPD( COSBase base ) throws IOException
     {
-        COSBase destination = base;
-        return new PDComplexFileSpecification( (COSDictionary)destination );
+        return new PDComplexFileSpecification( (COSDictionary)base );
     }
 
     /**

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDJavascriptNameTreeNode.java
Sun Mar 10 17:07:26 2013
@@ -22,6 +22,7 @@ import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.cos.COSString;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
 import org.apache.pdfbox.pdmodel.common.PDNameTreeNode;
 import org.apache.pdfbox.pdmodel.common.PDTextStream;
 
@@ -54,7 +55,7 @@ public class PDJavascriptNameTreeNode ex
     /**
      * {@inheritDoc}
      */
-    protected Object convertCOSToPD( COSBase base ) throws IOException
+    protected COSObjectable convertCOSToPD( COSBase base ) throws IOException
     {
         PDTextStream stream = null;
         if( base instanceof COSString )

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDNameTreeNode.java
Sun Mar 10 17:07:26 2013
@@ -17,15 +17,14 @@
 package org.apache.pdfbox.pdmodel.common;
 
 import java.io.IOException;
-import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
@@ -33,7 +32,7 @@ import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSString;
 
 /**
- * This class represends a PDF Name tree.  See the PDF Reference 1.5 section 3.8.5
+ * This class represents a PDF Name tree.  See the PDF Reference 1.5 section 3.8.5
  * for more details.
  *
  * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
@@ -41,16 +40,17 @@ import org.apache.pdfbox.cos.COSString;
  */
 public class PDNameTreeNode implements COSObjectable
 {
-    private static final Log log = LogFactory.getLog(PDNameTreeNode.class);
+    private static final Log LOG = LogFactory.getLog(PDNameTreeNode.class);
     private COSDictionary node;
-    private Class valueType = null;
+    private Class<? extends COSObjectable> valueType = null;
+    private PDNameTreeNode parent = null;
 
     /**
      * Constructor.
      *
      * @param valueClass The PD Model type of object that is the value.
      */
-    public PDNameTreeNode( Class valueClass )
+    public PDNameTreeNode( Class<? extends COSObjectable> valueClass )
     {
         node = new COSDictionary();
         valueType = valueClass;
@@ -62,7 +62,7 @@ public class PDNameTreeNode implements C
      * @param dict The dictionary that holds the name information.
      * @param valueClass The PD Model type of object that is the value.
      */
-    public PDNameTreeNode( COSDictionary dict, Class valueClass )
+    public PDNameTreeNode( COSDictionary dict, Class<? extends COSObjectable> valueClass
)
     {
         node = dict;
         valueType = valueClass;
@@ -89,23 +89,53 @@ public class PDNameTreeNode implements C
     }
 
     /**
+     * Returns the parent node.
+     * 
+     * @return parent node
+     */
+    public PDNameTreeNode getParent()
+    {
+        return parent;
+    }
+
+    /**
+     * Sets the parent to the given node.
+     * 
+     * @param parentNode the node to be set as parent
+     */
+    public void setParent(PDNameTreeNode parentNode)
+    {
+        parent = parentNode;
+        calculateLimits();
+    }
+    
+    /**
+     * Determines if this is a root node or not.
+     * 
+     * @return true if this is a root node
+     */
+    public boolean isRootNode()
+    {
+        return parent == null;
+    }
+    /**
      * Return the children of this node.  This list will contain PDNameTreeNode objects.
      *
      * @return The list of children or null if there are no children.
      */
-    public List getKids()
+    public List<PDNameTreeNode> getKids()
     {
 
-        List retval = null;
+        List<PDNameTreeNode> retval = null;
         COSArray kids = (COSArray)node.getDictionaryObject( COSName.KIDS );
         if( kids != null )
         {
-            List pdObjects = new ArrayList();
+            List<PDNameTreeNode> pdObjects = new ArrayList<PDNameTreeNode>();
             for( int i=0; i<kids.size(); i++ )
             {
                 pdObjects.add( createChildNode( (COSDictionary)kids.getObject(i) ) );
             }
-            retval = new COSArrayList(pdObjects,kids);
+            retval = new COSArrayList<PDNameTreeNode>(pdObjects,kids);
         }
 
         return retval;
@@ -116,20 +146,68 @@ public class PDNameTreeNode implements C
      *
      * @param kids The children of this named tree.
      */
-    public void setKids( List kids )
+    public void setKids( List<? extends PDNameTreeNode> kids )
     {
         if (kids != null && kids.size() > 0)
         {
-            PDNameTreeNode firstKid = (PDNameTreeNode) kids.get(0);
-            PDNameTreeNode lastKid = (PDNameTreeNode) kids.get(kids.size() - 1);
-            String lowerLimit = firstKid.getLowerLimit();
-            this.setLowerLimit(lowerLimit);
-            String upperLimit = lastKid.getUpperLimit();
-            this.setUpperLimit(upperLimit);
+            for (PDNameTreeNode kidsNode : kids)
+                kidsNode.setParent(this);
+            node.setItem( COSName.KIDS, COSArrayList.converterToCOSArray( kids ) );
+            calculateLimits();
+        }
+        else 
+        {
+            // Remove Names and Limits if there are no kids
+            node.setItem(COSName.NAMES, null);
+            node.setItem(COSName.LIMITS, null);
+            node.setItem(COSName.KIDS, null);
         }
-        node.setItem( "Kids", COSArrayList.converterToCOSArray( kids ) );
     }
 
+    private void calculateLimits()
+    {
+        if (isRootNode())
+        {
+            node.setItem(COSName.LIMITS, null);
+        }
+        else
+        {
+            List<PDNameTreeNode> kids = getKids();
+            if (kids != null && kids.size() > 0)
+            {
+                PDNameTreeNode firstKid = kids.get(0);
+                PDNameTreeNode lastKid = kids.get(kids.size() - 1);
+                String lowerLimit = firstKid.getLowerLimit();
+                setLowerLimit(lowerLimit);
+                String upperLimit = lastKid.getUpperLimit();
+                setUpperLimit(upperLimit);
+            }
+            else
+            {
+                try 
+                {
+                    Map<String, COSObjectable> names = getNames();
+                    if (names != null && names.size() >= 2)
+                    {
+                        Object[] keys = names.keySet().toArray();
+                        String lowerLimit = (String)keys[0];
+                        setLowerLimit(lowerLimit);
+                        String upperLimit = (String)keys[keys.length-1];
+                        setUpperLimit(upperLimit);
+                    }
+                    else
+                    {
+                        node.setItem(COSName.LIMITS, null);
+                    }
+                }
+                catch (IOException exception)
+                {
+                    node.setItem(COSName.LIMITS, null);
+                    LOG.error("Error while calculating the Limits of a PageNameTreeNode:",
exception);
+                }
+            }
+        }
+    }
     /**
      * The name to retrieve.
      *
@@ -142,19 +220,19 @@ public class PDNameTreeNode implements C
     public Object getValue( String name ) throws IOException
     {
         Object retval = null;
-        Map names = getNames();
+        Map<String, COSObjectable> names = getNames();
         if( names != null )
         {
             retval = names.get( name );
         }
         else
         {
-            List kids = getKids();
-            if (kids != null) 
+            List<PDNameTreeNode> kids = getKids();
+            if (kids != null)
             {
                 for( int i=0; i<kids.size() && retval == null; i++ )
                 {
-                    PDNameTreeNode childNode = (PDNameTreeNode)kids.get( i );
+                    PDNameTreeNode childNode = kids.get( i );
                     if( childNode.getLowerLimit().compareTo( name ) <= 0 &&
                         childNode.getUpperLimit().compareTo( name ) >= 0 )
                     {
@@ -164,7 +242,7 @@ public class PDNameTreeNode implements C
             }
             else
             {
-                log.warn("NameTreeNode does not have \"names\" nor \"kids\" objects.");
+                LOG.warn("NameTreeNode does not have \"names\" nor \"kids\" objects.");
             }
         }
         return retval;
@@ -179,17 +257,17 @@ public class PDNameTreeNode implements C
      *         contains no 'Names' entry
      * @throws IOException If there is an error while creating the sub types.
      */
-    public Map<String, Object> getNames() throws IOException
+    public Map<String, COSObjectable> getNames() throws IOException
     {
         COSArray namesArray = (COSArray)node.getDictionaryObject( COSName.NAMES );
         if( namesArray != null )
         {
-            Map<String, Object> names = new LinkedHashMap<String, Object>();
+            Map<String, COSObjectable> names = new LinkedHashMap<String, COSObjectable>();
             for( int i=0; i<namesArray.size(); i+=2 )
             {
                 COSString key = (COSString)namesArray.getObject(i);
                 COSBase cosValue = namesArray.getObject( i+1 );
-                names.put( key.getString(), convertCOSToPD( cosValue ) );
+                names.put( key.getString(), convertCOSToPD(cosValue) );
             }
             return Collections.unmodifiableMap(names);
         }
@@ -200,28 +278,17 @@ public class PDNameTreeNode implements C
     }
 
     /**
-     * Method to convert the COS value in the name tree to the PD Model object.  The
-     * default implementation will simply use reflection to create the correct object
-     * type.  Subclasses can do whatever they want.
+     * Method to convert the COS value in the name tree to the PD Model object. The
+     * default implementation will simply return the given COSBase object.
+     * Subclasses should do something specific.
      *
      * @param base The COS object to convert.
      * @return The converted PD Model object.
      * @throws IOException If there is an error during creation.
      */
-    protected Object convertCOSToPD( COSBase base ) throws IOException
+    protected COSObjectable convertCOSToPD( COSBase base ) throws IOException
     {
-        Object retval = null;
-        try
-        {
-            Constructor ctor = valueType.getConstructor( new Class[] { base.getClass() }
);
-            retval = ctor.newInstance( new Object[] { base } );
-        }
-        catch( Throwable t )
-        {
-            throw new IOException( "Error while trying to create value in named tree:" +
t.getMessage());
-
-        }
-        return retval;
+        return base;
     }
 
     /**
@@ -246,7 +313,7 @@ public class PDNameTreeNode implements C
     {
         if( names == null )
         {
-            node.setItem( "Names", (COSObjectable)null );
+            node.setItem( COSName.NAMES, (COSObjectable)null );
             node.setItem( COSName.LIMITS, (COSObjectable)null);
         }
         else
@@ -254,13 +321,13 @@ public class PDNameTreeNode implements C
             COSArray array = new COSArray();
             List<String> keys = new ArrayList<String>(names.keySet());
             Collections.sort(keys);
-            for (String key : keys) {
+            for (String key : keys) 
+            {
                 array.add(new COSString(key));
                 array.add(names.get(key));
             }
-            setLowerLimit(keys.get(0));
-            setUpperLimit(keys.get(keys.size() - 1));
-            node.setItem("Names", array);
+            node.setItem(COSName.NAMES, array);
+            calculateLimits();
         }
     }
 

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/TestAll.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/TestAll.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/TestAll.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/TestAll.java Sun Mar 10 17:07:26 2013
@@ -31,6 +31,8 @@ import org.apache.pdfbox.io.ccitt.TestPa
 import org.apache.pdfbox.pdmodel.TestFDF;
 import org.apache.pdfbox.pdmodel.TestPDDocumentCatalog;
 import org.apache.pdfbox.pdmodel.TestPDDocumentInformation;
+import org.apache.pdfbox.pdmodel.common.TestPDNameTreeNode;
+import org.apache.pdfbox.pdmodel.common.TestPDNumberTreeNode;
 import org.apache.pdfbox.pdmodel.edit.TestPDPageContentStream;
 import org.apache.pdfbox.pdmodel.interactive.form.TestFields;
 import org.apache.pdfbox.util.TestDateUtil;
@@ -99,6 +101,9 @@ public class TestAll extends TestCase
         suite.addTestSuite( TestExtractText.class );
         
         suite.addTestSuite(TestPDPageContentStream.class);
+        
+        suite.addTestSuite(TestPDNameTreeNode.class);
+        suite.addTestSuite(TestPDNumberTreeNode.class);
 
         return suite;
     }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNameTreeNode.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNameTreeNode.java?rev=1454877&r1=1454876&r2=1454877&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNameTreeNode.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestPDNameTreeNode.java
Sun Mar 10 17:07:26 2013
@@ -22,7 +22,6 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.pdfbox.cos.COSInteger;
-import org.apache.pdfbox.cos.COSObject;
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
@@ -44,50 +43,49 @@ public class TestPDNameTreeNode extends 
     @Override
     protected void setUp() throws Exception
     {
-        this.node5 = new PDNameTreeNode(COSObject.class);
-        SortedMap<String, COSObject> names = new TreeMap<String, COSObject>();
-        COSInteger i = COSInteger.get(89);
-        names.put("Actinium", new COSObject(i));
-        names.put("Aluminum", new COSObject(COSInteger.get(13)));
-        names.put("Americium", new COSObject(COSInteger.get(95)));
-        names.put("Antimony", new COSObject(COSInteger.get(51)));
-        names.put("Argon", new COSObject(COSInteger.get(18)));
-        names.put("Arsenic", new COSObject(COSInteger.get(33)));
-        names.put("Astatine", new COSObject(COSInteger.get(85)));
+        this.node5 = new PDNameTreeNode(COSInteger.class);
+        SortedMap<String, COSObjectable> names = new TreeMap<String, COSObjectable>();
+        names.put("Actinium", COSInteger.get(89));
+        names.put("Aluminum", COSInteger.get(13));
+        names.put("Americium", COSInteger.get(95));
+        names.put("Antimony", COSInteger.get(51));
+        names.put("Argon", COSInteger.get(18));
+        names.put("Arsenic", COSInteger.get(33));
+        names.put("Astatine", COSInteger.get(85));
         this.node5.setNames(names);
 
-        this.node24 = new PDNameTreeNode(COSObject.class);
-        names = new TreeMap<String, COSObject>();
-        names.put("Xenon", new COSObject(COSInteger.get(54)));
-        names.put("Ytterbium", new COSObject(COSInteger.get(70)));
-        names.put("Yttrium", new COSObject(COSInteger.get(39)));
-        names.put("Zinc", new COSObject(COSInteger.get(30)));
-        names.put("Zirconium", new COSObject(COSInteger.get(40)));
+        this.node24 = new PDNameTreeNode(COSInteger.class);
+        names = new TreeMap<String, COSObjectable>();
+        names.put("Xenon", COSInteger.get(54));
+        names.put("Ytterbium", COSInteger.get(70));
+        names.put("Yttrium", COSInteger.get(39));
+        names.put("Zinc", COSInteger.get(30));
+        names.put("Zirconium", COSInteger.get(40));
         this.node24.setNames(names);
 
-        this.node2 = new PDNameTreeNode(COSObject.class);
+        this.node2 = new PDNameTreeNode(COSInteger.class);
         List<PDNameTreeNode> kids = this.node2.getKids();
         if (kids == null)
         {
-            kids = new COSArrayList();
+            kids = new COSArrayList<PDNameTreeNode>();
         }
         kids.add(this.node5);
         this.node2.setKids(kids);
 
-        this.node4 = new PDNameTreeNode(COSObject.class);
+        this.node4 = new PDNameTreeNode(COSInteger.class);
         kids = this.node4.getKids();
         if (kids == null)
         {
-            kids = new COSArrayList();
+            kids = new COSArrayList<PDNameTreeNode>();
         }
         kids.add(this.node24);
         this.node4.setKids(kids);
 
-        this.node1 = new PDNameTreeNode(COSObject.class);
+        this.node1 = new PDNameTreeNode(COSInteger.class);
         kids = this.node1.getKids();
         if (kids == null)
         {
-            kids = new COSArrayList();
+            kids = new COSArrayList<PDNameTreeNode>();
         }
         kids.add(this.node2);
         kids.add(this.node4);
@@ -103,7 +101,7 @@ public class TestPDNameTreeNode extends 
         Assert.assertEquals("Zirconium", this.node24.getUpperLimit());
         Assert.assertEquals("Zirconium", this.node4.getUpperLimit());
 
-        Assert.assertEquals("Zirconium", this.node1.getUpperLimit());
+        Assert.assertEquals(null, this.node1.getUpperLimit());
     }
 
     public void testLowerLimit() throws IOException
@@ -114,7 +112,7 @@ public class TestPDNameTreeNode extends 
         Assert.assertEquals("Xenon", this.node24.getLowerLimit());
         Assert.assertEquals("Xenon", this.node4.getLowerLimit());
 
-        Assert.assertEquals("Actinium", this.node1.getLowerLimit());
+        Assert.assertEquals(null, this.node1.getLowerLimit());
     }
 
 }



Mime
View raw message