java.lang.IllegalStateException: Cannot read while there is an open stream writer

Stack Overflow | RDR | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    java.lang.IllegalStateException: Cannot read while there is an open stream writer

    Stack Overflow | 7 months ago | RDR
    java.lang.IllegalStateException: Cannot read while there is an open stream writer

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Cannot read while there is an open stream writer

      at org.apache.pdfbox.cos.COSStream.createRawInputStream()
    2. Apache PDFBox
      PDDocument.save
      1. org.apache.pdfbox.cos.COSStream.createRawInputStream(COSStream.java:129)
      2. org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:1177)
      3. org.apache.pdfbox.cos.COSStream.accept(COSStream.java:372)
      4. org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:561)
      5. org.apache.pdfbox.pdfwriter.COSWriter.doWriteObjects(COSWriter.java:490)
      6. org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:474)
      7. org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:1073)
      8. org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:419)
      9. org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1331)
      10. org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1229)
      11. org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1095)
      12. org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1067)
      13. org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1055)
      13 frames
    3. com.helper
      ScreenshotPDF.screenshotPDF
      1. com.helper.ScreenshotPDF.screenshotPDF(ScreenshotPDF.java:50)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      4. java.lang.reflect.Method.invoke(Unknown Source)
      4 frames
    5. TestNG
      RemoteTestNG.main
      1. org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
      2. org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
      3. org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
      4. org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
      5. org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
      6. org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
      7. org.testng.TestRunner.privateRun(TestRunner.java:774)
      8. org.testng.TestRunner.run(TestRunner.java:624)
      9. org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
      10. org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
      11. org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
      12. org.testng.SuiteRunner.run(SuiteRunner.java:261)
      13. org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      14. org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      15. org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
      16. org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
      17. org.testng.TestNG.run(TestNG.java:1048)
      18. org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
      19. org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
      20. org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)
      20 frames