Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-1306

ClassCastException WARN [main] (COSDocument.java:303) - java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName in o.a.t.parser.pdf.PDFParserTest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.5
    • 1.6
    • parser
    • None

    Description

      The below is a stack trace highlighted by setting up the nightly builds.
      Annie Burgess and I were also able to confirm this Exception in a recent fresh checkout and mvn clean install of Tika trunk 1.6-SNAPSHOT.

      We should address this as it may be a problem with main code which we should address.

      Running org.apache.tika.parser.pdf.PDFParserTest
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 26441
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 2314576
       WARN [main] (COSDocument.java:303) - java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName
      java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName
      	at org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:295)
      	at org.apache.pdfbox.cos.COSDocument.dereferenceObjectStreams(COSDocument.java:657)
      	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:244)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1239)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1204)
      	at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:118)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
      	at org.apache.tika.TikaTest.getText(TikaTest.java:125)
      	at org.apache.tika.TikaTest.getText(TikaTest.java:133)
      	at org.apache.tika.parser.pdf.PDFParserTest.testSequentialParser(PDFParserTest.java:552)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 12324
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5969
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5500
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5592
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5592
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5592
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 5687
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 116
      ERROR [main] (NonSequentialPDFParser.java:1887) - Can't find the object xref at offset 8777
       WARN [main] (COSDocument.java:303) - java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName
      java.lang.ClassCastException: org.apache.pdfbox.cos.COSString cannot be cast to org.apache.pdfbox.cos.COSName
      	at org.apache.pdfbox.cos.COSDocument.getObjectsByType(COSDocument.java:295)
      	at org.apache.pdfbox.cos.COSDocument.dereferenceObjectStreams(COSDocument.java:657)
      	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:244)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1239)
      	at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1204)
      	at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:118)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
      	at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:120)
      	at org.apache.tika.parser.pdf.PDFParserTest.testMultipleAuthors(PDFParserTest.java:755)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
      	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lewismc Lewis John McGibbney
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: