aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/afp
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/afp')
-rw-r--r--src/java/org/apache/fop/afp/apps/FontPatternExtractor.java1
-rw-r--r--src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java10
2 files changed, 9 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java b/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java
index 7a2b8ed36..66150dda3 100644
--- a/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java
+++ b/src/java/org/apache/fop/afp/apps/FontPatternExtractor.java
@@ -63,6 +63,7 @@ public class FontPatternExtractor {
}
ByteArrayInputStream bin = new ByteArrayInputStream(baout.toByteArray());
+ IOUtils.closeQuietly(baout);
DataInputStream din = new DataInputStream(bin);
long len = din.readInt() & 0xFFFFFFFFL;
println("Length: " + len);
diff --git a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java
index 7a4575cd3..54826a2ec 100644
--- a/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java
+++ b/src/java/org/apache/fop/afp/goca/GraphicsSetProcessColor.java
@@ -21,10 +21,11 @@ package org.apache.fop.afp.goca;
import java.awt.Color;
import java.awt.color.ColorSpace;
-import java.io.DataOutput;
+import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.xmlgraphics.java2d.color.CIELabColorSpace;
@@ -105,6 +106,7 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder {
ColorSpace cs = color.getColorSpace();
int colSpaceType = cs.getType();
ByteArrayOutputStream baout = new ByteArrayOutputStream();
+ DataOutputStream dout = null;
byte[] colsizes;
if (colSpaceType == ColorSpace.TYPE_CMYK) {
colspace = CMYK;
@@ -121,7 +123,7 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder {
} else if (cs instanceof CIELabColorSpace) {
colspace = CIELAB;
colsizes = new byte[] {0x08, 0x08, 0x08, 0x00};
- DataOutput dout = new java.io.DataOutputStream(baout);
+ dout = new DataOutputStream(baout);
//According to GOCA, I'd expect the multiplicator below to be 255f, not 100f
//But only IBM AFP Workbench seems to support Lab colors and it requires "c * 100f"
int l = Math.round(colorComponents[0] * 100f);
@@ -131,6 +133,8 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder {
dout.writeByte(a);
dout.writeByte(b);
} else {
+ IOUtils.closeQuietly(dout);
+ IOUtils.closeQuietly(baout);
throw new IllegalStateException();
}
@@ -151,6 +155,8 @@ public class GraphicsSetProcessColor extends AbstractGraphicsDrawingOrder {
os.write(data);
baout.writeTo(os);
+ IOUtils.closeQuietly(dout);
+ IOUtils.closeQuietly(baout);
}
/** {@inheritDoc} */