java.lang.ArrayIndexOutOfBoundsException: 2

ICEsoft JIRA Issue Tracker | Tyler Johnson | 7 years 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

    I had a hang just now on disposal of a Document. Because ICEpdf is taking up the event dispatch thread, the application can no longer be used. On the screen where this happened, multiple PDF documents are opened one after another, one at a time. The disposal may have occurred while the document was still being loaded, or while it was rendering. I got this error on stderr which might be related: java.lang.ArrayIndexOutOfBoundsException: 2 at org.icepdf.core.pobjects.filters.CCITTFax.addRun(Unknown Source) at org.icepdf.core.pobjects.filters.CCITTFax.resetRuns(Unknown Source) at org.icepdf.core.pobjects.filters.CCITTFax.Group4Decode(Unknown Source) at org.icepdf.core.pobjects.Stream.ccittfaxDecode(Unknown Source) at org.icepdf.core.pobjects.Stream.decodeCCITTFaxDecodeOrDCTDecodeImage(Unknown Source) at org.icepdf.core.pobjects.Stream.getImage(Unknown Source) ..... Reproducing the issue requires opening and closing dozens of PDF files relatively quickly and frequently, in order to get an interrupt during the PDF engine initialising or rendering. This is what we're actually doing: @Override public Image getPageImage(int pageNumber, float zoomLevel, ImageObserver observer) { // Library limitation, we can only pass in a fixed zoom for both X and Y. float actualZoom = (float) (zoomLevel / unitsToScreen.getScaleX()); // ICEpdf doesn't support ImageObserver for incremental painting. // In some respects this is good as it means one less thread hanging around doing stuff // in the background, but we do lose the functionality of Sun's pdfrenderer which would // display very quickly and then paint the page in a background thread. return document.getPageImage(pageNumber - 1, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0.0f, // rotation actualZoom); } @Override public void close() { document.dispose(); } And it's the dispose() which for some reason deadlocks. at org.icepdf.core.pobjects.Stream.getImage(Unknown Source) at org.icepdf.core.pobjects.Resources.getImage(Unknown Source) at org.icepdf.core.util.ContentParser.parse(Unknown Source) at org.icepdf.core.pobjects.Page.init(Unknown Source) at org.icepdf.core.pobjects.Page.paint(Unknown Source)

    ICEsoft JIRA Issue Tracker | 7 years ago | Tyler Johnson
    java.lang.ArrayIndexOutOfBoundsException: 2
  2. 0

    I had a hang just now on disposal of a Document. Because ICEpdf is taking up the event dispatch thread, the application can no longer be used. On the screen where this happened, multiple PDF documents are opened one after another, one at a time. The disposal may have occurred while the document was still being loaded, or while it was rendering. I got this error on stderr which might be related: java.lang.ArrayIndexOutOfBoundsException: 2 at org.icepdf.core.pobjects.filters.CCITTFax.addRun(Unknown Source) at org.icepdf.core.pobjects.filters.CCITTFax.resetRuns(Unknown Source) at org.icepdf.core.pobjects.filters.CCITTFax.Group4Decode(Unknown Source) at org.icepdf.core.pobjects.Stream.ccittfaxDecode(Unknown Source) at org.icepdf.core.pobjects.Stream.decodeCCITTFaxDecodeOrDCTDecodeImage(Unknown Source) at org.icepdf.core.pobjects.Stream.getImage(Unknown Source) ..... Reproducing the issue requires opening and closing dozens of PDF files relatively quickly and frequently, in order to get an interrupt during the PDF engine initialising or rendering. This is what we're actually doing: @Override public Image getPageImage(int pageNumber, float zoomLevel, ImageObserver observer) { // Library limitation, we can only pass in a fixed zoom for both X and Y. float actualZoom = (float) (zoomLevel / unitsToScreen.getScaleX()); // ICEpdf doesn't support ImageObserver for incremental painting. // In some respects this is good as it means one less thread hanging around doing stuff // in the background, but we do lose the functionality of Sun's pdfrenderer which would // display very quickly and then paint the page in a background thread. return document.getPageImage(pageNumber - 1, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, 0.0f, // rotation actualZoom); } @Override public void close() { document.dispose(); } And it's the dispose() which for some reason deadlocks. at org.icepdf.core.pobjects.Stream.getImage(Unknown Source) at org.icepdf.core.pobjects.Resources.getImage(Unknown Source) at org.icepdf.core.util.ContentParser.parse(Unknown Source) at org.icepdf.core.pobjects.Page.init(Unknown Source) at org.icepdf.core.pobjects.Page.paint(Unknown Source)

    ICEsoft JIRA Issue Tracker | 7 years ago | Tyler Johnson
    java.lang.ArrayIndexOutOfBoundsException: 2

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      2

      at org.icepdf.core.pobjects.filters.CCITTFax.addRun()
    2. org.icepdf.core
      Stream.getImage
      1. org.icepdf.core.pobjects.filters.CCITTFax.addRun(Unknown Source)
      2. org.icepdf.core.pobjects.filters.CCITTFax.resetRuns(Unknown Source)
      3. org.icepdf.core.pobjects.filters.CCITTFax.Group4Decode(Unknown Source)
      4. org.icepdf.core.pobjects.Stream.ccittfaxDecode(Unknown Source)
      5. org.icepdf.core.pobjects.Stream.decodeCCITTFaxDecodeOrDCTDecodeImage(Unknown Source)
      6. org.icepdf.core.pobjects.Stream.getImage(Unknown Source)
      6 frames