diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-11-17 14:37:47 +0100 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2015-11-19 09:03:42 +0100 |
commit | 4cd769dfdf1133b61935f042e3897c3980f6327b (patch) | |
tree | ef09c3c447e8178547ab73ac30e5f41a5046880a /pdf-as-pdfbox/src/main/java/at/gv/egiz | |
parent | 95ae6ca046fe56c033a92a4342cb230b1c811221 (diff) | |
download | pdf-as-4-4cd769dfdf1133b61935f042e3897c3980f6327b.tar.gz pdf-as-4-4cd769dfdf1133b61935f042e3897c3980f6327b.tar.bz2 pdf-as-4-4cd769dfdf1133b61935f042e3897c3980f6327b.zip |
Concurrency Problem iwith static StringBuilder
Diffstat (limited to 'pdf-as-pdfbox/src/main/java/at/gv/egiz')
-rw-r--r-- | pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/TableDrawUtils.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/TableDrawUtils.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/TableDrawUtils.java index 7388090c..e29766d8 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/TableDrawUtils.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/TableDrawUtils.java @@ -50,16 +50,12 @@ public class TableDrawUtils { public static final String TABLE_DEBUG = "debug.table"; - private static StringBuilder alternateTableCaption; - public static void drawTable(PDPage page, PDPageContentStream contentStream, float x, float y, float width, float height, PDFBoxTable abstractTable, PDDocument doc, boolean subtable, PDResources formResources, Map<String, ImageObject> images, ISettings settings, IDGenerator generator, PDFAsVisualSignatureProperties properties) throws PdfAsException { - - alternateTableCaption = new StringBuilder(); logger.debug("Drawing Table: X {} Y {} WIDTH {} HEIGHT {} \n{}", x, y, width, height, abstractTable.getOrigTable().toString()); @@ -87,7 +83,7 @@ public class TableDrawUtils { float contenty = y + height; float padding = abstractTable.getPadding(); float[] colsSizes = getColSizes(abstractTable); - + StringBuilder alternateTableCaption = new StringBuilder(); for (int i = 0; i < abstractTable.getRowCount(); i++) { ArrayList<Entry> row = abstractTable.getRow(i); for (int j = 0; j < row.size(); j++) { @@ -118,13 +114,13 @@ public class TableDrawUtils { drawCaption(page, contentStream, contentx, contenty, colWidth, abstractTable.getRowHeights()[i], padding, abstractTable, doc, cell, formResources, settings); - addToAlternateTableCaption(cell); + addToAlternateTableCaption(cell, alternateTableCaption); break; case Entry.TYPE_VALUE: drawValue(page, contentStream, contentx, contenty, colWidth, abstractTable.getRowHeights()[i], padding, abstractTable, doc, cell, formResources, settings); - addToAlternateTableCaption(cell); + addToAlternateTableCaption(cell, alternateTableCaption); break; case Entry.TYPE_IMAGE: drawImage(page, contentStream, contentx, contenty, @@ -600,7 +596,7 @@ public class TableDrawUtils { return ""; } - private static void addToAlternateTableCaption(Entry cell){ + private static void addToAlternateTableCaption(Entry cell, StringBuilder alternateTableCaption){ alternateTableCaption.append(cell.getValue()); alternateTableCaption.append("\n");//better for screen reader } |