java.lang.AssertionError: Expected: null but: was "sun.font.CFontManager" <Click to see difference>

Apache's JIRA Issue Tracker | David Pilato | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm using Tika 1.7. I'm parsing an encrypted PDF document which raise an exception. So far, so good. My concern is that after that I have a new System property set {{sun.font.CFontManager}}. Code to reproduce the error: {code:java} @Test public void testSystem() { Properties props = System.getProperties(); assertThat(props.get("sun.font.fontmanager"), nullValue()); try { tika().parseToString(new URL("https://github.com/elasticsearch/elasticsearch-mapper-attachments/raw/master/src/test/resources/org/elasticsearch/index/mapper/xcontent/encrypted.pdf")); } catch (Throwable e) { } assertThat(props.get("sun.font.fontmanager"), nullValue()); } {code} With Tika 1.7: {code} [2015-02-11 16:43:36,166][INFO ][org.apache.pdfbox.pdfparser.PDFParser] Document is encrypted [2015-02-11 16:43:36,837][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,837][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,838][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,838][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,839][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,840][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,840][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,841][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,841][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,842][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException java.lang.AssertionError: Expected: null but: was "sun.font.CFontManager" <Click to see difference> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.elasticsearch.plugin.mapper.attachments.test.TikaSystemTest.testSystem(TikaSystemTest.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {code} With Tika 1.6: {code} [2015-02-11 16:38:42,922][INFO ][org.apache.pdfbox.pdfparser.PDFParser] Document is encrypted {code} Note also that it logs a lot of errors which was not the case in Tika 1.6.

    Apache's JIRA Issue Tracker | 2 years ago | David Pilato
    java.lang.AssertionError: Expected: null but: was "sun.font.CFontManager" <Click to see difference>
  2. 0

    I'm using Tika 1.7. I'm parsing an encrypted PDF document which raise an exception. So far, so good. My concern is that after that I have a new System property set {{sun.font.CFontManager}}. Code to reproduce the error: {code:java} @Test public void testSystem() { Properties props = System.getProperties(); assertThat(props.get("sun.font.fontmanager"), nullValue()); try { tika().parseToString(new URL("https://github.com/elasticsearch/elasticsearch-mapper-attachments/raw/master/src/test/resources/org/elasticsearch/index/mapper/xcontent/encrypted.pdf")); } catch (Throwable e) { } assertThat(props.get("sun.font.fontmanager"), nullValue()); } {code} With Tika 1.7: {code} [2015-02-11 16:43:36,166][INFO ][org.apache.pdfbox.pdfparser.PDFParser] Document is encrypted [2015-02-11 16:43:36,837][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,837][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,838][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,838][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,839][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,840][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,840][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,841][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,841][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException [2015-02-11 16:43:36,842][ERROR][org.apache.pdfbox.filter.FlateFilter] FlateFilter: stop reading corrupt stream due to a DataFormatException java.lang.AssertionError: Expected: null but: was "sun.font.CFontManager" <Click to see difference> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8) at org.elasticsearch.plugin.mapper.attachments.test.TikaSystemTest.testSystem(TikaSystemTest.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) {code} With Tika 1.6: {code} [2015-02-11 16:38:42,922][INFO ][org.apache.pdfbox.pdfparser.PDFParser] Document is encrypted {code} Note also that it logs a lot of errors which was not the case in Tika 1.6.

    Apache's JIRA Issue Tracker | 2 years ago | David Pilato
    java.lang.AssertionError: Expected: null but: was "sun.font.CFontManager" <Click to see difference>
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Build not working in Windows

    GitHub | 2 years ago | hypery2k
    java.lang.AssertionError: Expected: iterable containing ["some-component/specs/image.png"] but: item 0: was "some-component/specs\image.png"
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.AssertionError

    Expected: null but: was "sun.font.CFontManager" <Click to see difference>

    at org.hamcrest.MatcherAssert.assertThat()
  2. Hamcrest
    MatcherAssert.assertThat
    1. org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
    2. org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
    2 frames
  3. org.elasticsearch.plugin
    TikaSystemTest.testSystem
    1. org.elasticsearch.plugin.mapper.attachments.test.TikaSystemTest.testSystem(TikaSystemTest.java:41)
    1 frame
  4. Java RT
    DelegatingMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    3 frames
  5. JUnit
    JUnitCore.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    13. org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    14. org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    14 frames
  6. IntelliJ junit4 module
    JUnit4IdeaTestRunner.startRunnerWithArgs
    1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    1 frame
  7. IDEA
    JUnitStarter.main
    1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
    2 frames
  8. Java RT
    NativeMethodAccessorImpl.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    2 frames
  9. IDEA
    AppMain.main
    1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
    1 frame