Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.0.4
-
Fix Version/s: 6.2.4
-
Component/s: Core/Parsing
-
Labels:None
-
Environment:Windows Server 2008
-
Workaround Description:Set the system property -Dorg.icepdf.core.imageProxy=false
Description
Sometimes I see this stacktrace in javamelody:
ajp-apr-8009-exec-40
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:969)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1281)
java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:218)
java.util.concurrent.FutureTask.get(FutureTask.java:83)
org.icepdf.core.pobjects.graphics.ImageReference.createImage(ImageReference.java:107)
org.icepdf.core.pobjects.graphics.CachedImageReference.getImage(CachedImageReference.java:55)
org.icepdf.core.pobjects.graphics.ImageReference.drawImage(ImageReference.java:71)
org.icepdf.core.pobjects.graphics.commands.ImageDrawCmd.paintOperand(ImageDrawCmd.java:50)
org.icepdf.core.pobjects.graphics.Shapes.paint(Shapes.java:136)
org.icepdf.core.pobjects.Page.paintPageContent(Page.java:543)
org.icepdf.core.pobjects.Page.paint(Page.java:500)
org.icepdf.core.pobjects.Page.paint(Page.java:432)
org.icepdf.core.pobjects.Document.getPageImage(Document.java:1097)
What could be the problem? The code is:
byte[][] data = new byte[end - start + 1][];
try {
int index = 0;
for (int i = start - 1; i < end; i++) {
baous = new ByteArrayOutputStream();
image = (BufferedImage) document.getPageImage(
i, GraphicsRenderingHints.PRINT, Page.BOUNDARY_CROPBOX, 0, scale);
ImageIO.write(image, "png", baous);
data[index] = baous.toByteArray();
index++;
image.flush();
image = null;
baous.flush();
baous.close();
}
} finally {
document.dispose();
}
ajp-apr-8009-exec-40
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:969)
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1281)
java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:218)
java.util.concurrent.FutureTask.get(FutureTask.java:83)
org.icepdf.core.pobjects.graphics.ImageReference.createImage(ImageReference.java:107)
org.icepdf.core.pobjects.graphics.CachedImageReference.getImage(CachedImageReference.java:55)
org.icepdf.core.pobjects.graphics.ImageReference.drawImage(ImageReference.java:71)
org.icepdf.core.pobjects.graphics.commands.ImageDrawCmd.paintOperand(ImageDrawCmd.java:50)
org.icepdf.core.pobjects.graphics.Shapes.paint(Shapes.java:136)
org.icepdf.core.pobjects.Page.paintPageContent(Page.java:543)
org.icepdf.core.pobjects.Page.paint(Page.java:500)
org.icepdf.core.pobjects.Page.paint(Page.java:432)
org.icepdf.core.pobjects.Document.getPageImage(Document.java:1097)
What could be the problem? The code is:
byte[][] data = new byte[end - start + 1][];
try {
int index = 0;
for (int i = start - 1; i < end; i++) {
baous = new ByteArrayOutputStream();
image = (BufferedImage) document.getPageImage(
i, GraphicsRenderingHints.PRINT, Page.BOUNDARY_CROPBOX, 0, scale);
ImageIO.write(image, "png", baous);
data[index] = baous.toByteArray();
index++;
image.flush();
image = null;
baous.flush();
baous.close();
}
} finally {
document.dispose();
}
Do you have a test file that shows this issue?