--- pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java	(revision 1092577)
+++ pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java	(working copy)
@@ -16,7 +16,6 @@
  */
 package org.apache.pdfbox.pdmodel;
 
-import java.io.File;
 import junit.framework.TestCase;
 
 public class TestPDDocumentCatalog extends TestCase {
@@ -62,13 +61,29 @@
             doc = PDDocument.load(TestPDDocumentCatalog.class.getResourceAsStream("page_label.pdf"));
             PDDocumentCatalog cat = doc.getDocumentCatalog();
             // getLabelsByPageIndices() should not throw an exception
-            String[] labels = cat.getPageLabels().getLabelsByPageIndices();
+            cat.getPageLabels().getLabelsByPageIndices();
         } catch(Exception e) {
-            e.printStackTrace();
             fail("Threw exception!");
         } finally {
             if(doc != null)
                 doc.close();
         }
     }
+
+    /**
+     * Test case for
+     * <a href="https://issues.apache.org/jira/browse/PDFBOX-911"
+     *   >PDFBOX-911</a> - Method PDDocument.getNumberOfPages() returns wrong
+     * number of pages
+     */
+    public void testGetNumberOfPages() throws Exception {
+        PDDocument doc = null;
+        try {
+            doc = PDDocument.load(TestPDDocumentCatalog.class.getResource("test.unc.pdf"));
+            assertEquals(4, doc.getNumberOfPages());
+        } finally {
+            if(doc != null)
+                doc.close();
+        }
+    }
 }
Index: pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
===================================================================
--- pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java	(revision 1092577)
+++ pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java	(working copy)
@@ -43,7 +43,7 @@
      * The name-value pairs of this dictionary. The pairs are kept in the
      * order they were added to the dictionary.
      */
-    private final Map<COSName, COSBase> items =
+    protected final Map<COSName, COSBase> items =
         new LinkedHashMap<COSName, COSBase>();
 
     /**
@@ -1410,12 +1410,18 @@
     /**
      * {@inheritDoc}
      */
-    public String toString()
-    {
+    @Override
+    public String toString() {
         StringBuilder retVal = new StringBuilder("COSDictionary{");
-        for( COSName key : items.keySet() )
-        {
-            retVal.append("(" + key + ":" + getDictionaryObject(key).toString() + ") ");
+        for(COSName key : items.keySet()) {
+            retVal.append("(");
+            retVal.append(key);
+            retVal.append(":");
+            if(getDictionaryObject(key) != null)
+                retVal.append(getDictionaryObject(key).toString());
+            else
+                retVal.append("<null>");
+            retVal.append(") ");
         }
         retVal.append("}");
         return retVal.toString();
Index: pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java
===================================================================
--- pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java	(revision 1092577)
+++ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java	(working copy)
@@ -110,6 +110,10 @@
      */
     protected final boolean forceParsing;
 
+    public BaseParser() {
+        this.forceParsing = FORCE_PARSING;
+    }
+
     /**
      * Constructor.
      *
@@ -876,7 +880,7 @@
             throw new IOException("expected='/' actual='" + (char)c + "'-" + c + " " + pdfSource );
         }
         // costruisce il nome
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         c = pdfSource.read();
         while( c != -1 )
         {
@@ -1063,7 +1067,7 @@
         {
             if( Character.isDigit(c) || c == '-' || c == '+' || c == '.')
             {
-                StringBuffer buf = new StringBuffer();
+                StringBuilder buf = new StringBuilder();
                 int ic = pdfSource.read();
                 c = (char)ic;
                 while( Character.isDigit( c )||
@@ -1118,7 +1122,7 @@
     protected String readString() throws IOException
     {
         skipSpaces();
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         int c = pdfSource.read();
         while( !isEndOfName((char)c) && !isClosing(c) && c != -1 )
         {
@@ -1148,7 +1152,7 @@
         {
             c = pdfSource.read();
         }
-        StringBuffer buffer = new StringBuffer( theString.length() );
+        StringBuilder buffer = new StringBuilder( theString.length() );
         int charsRead = 0;
         while( !isEOL(c) && c != -1 && charsRead < theString.length() )
         {
@@ -1194,7 +1198,7 @@
 
         //average string size is around 2 and the normal string buffer size is
         //about 16 so lets save some space.
-        StringBuffer buffer = new StringBuffer(length);
+        StringBuilder buffer = new StringBuilder(length);
         while( !isWhitespace(c) && !isClosing(c) && c != -1 && buffer.length() < length &&
                 c != '[' &&
                 c != '<' &&
@@ -1250,7 +1254,7 @@
             throw new IOException( "Error: End-of-File, expected line");
         }
 
-        StringBuffer buffer = new StringBuffer( 11 );
+        StringBuilder buffer = new StringBuilder( 11 );
        
         int c;
         while ((c = pdfSource.read()) != -1) 
@@ -1300,10 +1304,9 @@
     }
 
     /**
-     * This will tell if the next byte is whitespace or not.
-     *
+     * This will tell if the next byte is whitespace or not.  These values are
+     * specified in table 1 (page 12) of ISO 32000-1:2008.
      * @param c The character to check against whitespace
-     *
      * @return true if the next byte in the stream is a whitespace character.
      */
     protected boolean isWhitespace( int c )
