diff options
30 files changed, 88 insertions, 63 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderContext.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderContext.java index f09202ae..3c8a6d76 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderContext.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderContext.java @@ -54,7 +54,7 @@ package at.gv.egiz.pdfas.lib.impl.placeholder; */ public class SignaturePlaceholderContext { - private ThreadLocal sigHolder = new ThreadLocal(); + private ThreadLocal<SignaturePlaceholderData> sigHolder = new ThreadLocal<SignaturePlaceholderData>(); private static SignaturePlaceholderContext instance = new SignaturePlaceholderContext(); @@ -72,7 +72,7 @@ public class SignaturePlaceholderContext { * @return */ public static SignaturePlaceholderData getSignaturePlaceholderData(){ - return (SignaturePlaceholderData)instance.sigHolder.get(); + return instance.sigHolder.get(); } /** diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java index 52e25781..816ca04f 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/SignaturePlaceholderExtractor.java @@ -59,6 +59,7 @@ import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.exceptions.WrappedIOException; import org.apache.pdfbox.pdmodel.PDDocument; @@ -107,7 +108,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { public static final int PLACEHOLDER_MATCH_MODE_MODERATE = 1; public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; - private List placeholders = new Vector(); + private List<SignaturePlaceholderData> placeholders = new Vector<SignaturePlaceholderData>(); private int currentPage = 0; private SignaturePlaceholderExtractor(String placeholderId, int placeholderMatchMode) throws IOException { @@ -143,8 +144,8 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { } catch (IOException e2) { throw new PDFIOException("error.pdf.io.04", e2); } - List pages = doc.getDocumentCatalog().getAllPages(); - Iterator iter = pages.iterator(); + List<?> pages = doc.getDocumentCatalog().getAllPages(); + Iterator<?> iter = pages.iterator(); int pageNr = 0; while (iter.hasNext()) { pageNr++; @@ -185,7 +186,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { } private static SignaturePlaceholderData matchPlaceholderDocument( - List placeholders, String placeholderId, int matchMode) throws PlaceholderExtractionException { + List<SignaturePlaceholderData> placeholders, String placeholderId, int matchMode) throws PlaceholderExtractionException { if (matchMode == PLACEHOLDER_MATCH_MODE_STRICT) throw new PlaceholderExtractionException("error.pdf.stamp.09"); @@ -195,24 +196,24 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { for (int i = 0; i < placeholders.size(); i++) { - SignaturePlaceholderData spd = (SignaturePlaceholderData)placeholders.get(i); + SignaturePlaceholderData spd = placeholders.get(i); if (spd.getId() == null) return spd; } if (matchMode == PLACEHOLDER_MATCH_MODE_LENIENT) - return (SignaturePlaceholderData)placeholders.get(0); + return placeholders.get(0); return null; } - private static SignaturePlaceholderData matchPlaceholderPage(List placeholders, + private static SignaturePlaceholderData matchPlaceholderPage(List<SignaturePlaceholderData> placeholders, String placeholderId, int matchMode) { if (placeholders.size() == 0) return null; for (int i = 0; i < placeholders.size(); i++) { - SignaturePlaceholderData data = (SignaturePlaceholderData)placeholders.get(i); + SignaturePlaceholderData data = placeholders.get(i); if (placeholderId != null && placeholderId.equals(data.getId())) return data; if (placeholderId == null && data.getId() == null) @@ -225,13 +226,14 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { this.currentPage = pageNr; } - protected void processOperator( PDFOperator operator, List arguments ) throws IOException + @Override + protected void processOperator(PDFOperator operator, List<COSBase> arguments) throws IOException { String operation = operator.getOperation(); if( operation.equals( "Do" ) ) { COSName objectName = (COSName)arguments.get( 0 ); - Map xobjects = getResources().getXObjects(); + Map<?, ?> xobjects = getResources().getXObjects(); PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() ); if( xobject instanceof PDXObjectImage ) { @@ -278,7 +280,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { } else { - super.processOperator( operator, arguments ); + super.processOperator(operator, arguments); } } @@ -311,8 +313,8 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { Result result; long before = System.currentTimeMillis(); try { - Hashtable hints = new Hashtable(); - Vector formats = new Vector(); + Hashtable<DecodeHintType, Vector<BarcodeFormat>> hints = new Hashtable<DecodeHintType, Vector<BarcodeFormat>>(); + Vector<BarcodeFormat> formats = new Vector<BarcodeFormat>(); formats.add(BarcodeFormat.QR_CODE); hints.put(DecodeHintType.POSSIBLE_FORMATS, formats); result = new MultiFormatReader().decode(bitmap, hints); @@ -326,7 +328,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { if (text.startsWith(QR_PLACEHOLDER_IDENTIFIER)) { String[] data = text.split(";"); if (data.length > 1) { - for (int i = 1; i < data.length; i++) { + for (int i = 1; i < data.length; i++) { String kvPair = data[i]; String[] kv = kvPair.split("="); if (kv.length != 2) { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java index 42dee32d..ffed4da6 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/StamperFactory.java @@ -33,9 +33,11 @@ public class StamperFactory { public static IPDFStamper createDefaultStamper(ISettings settings) throws PdfAsException { try { - Class<? extends IPDFStamper> cls = (Class<? extends IPDFStamper>) - Class.forName(DEFAULT_STAMPER_CLASS); - IPDFStamper stamper = cls.newInstance(); + Class<?> cls = Class.forName(DEFAULT_STAMPER_CLASS); + Object st = cls.newInstance(); + if (!(st instanceof IPDFStamper)) + throw new ClassCastException(); + IPDFStamper stamper = (IPDFStamper) st; stamper.setSettings(settings); return stamper; } catch (Throwable e) { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/TableFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/TableFactory.java index 429aa6d0..8f945414 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/TableFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/TableFactory.java @@ -66,7 +66,7 @@ public class TableFactory implements IProfileConstants { /** * Reference from signature key to there corresponding value */ - private static Hashtable sigEntries_ = new Hashtable(8); + private static Hashtable<String, SignatureEntry> sigEntries_ = new Hashtable<String, SignatureEntry>(8); static { setDefaultStyles(); @@ -151,7 +151,7 @@ public class TableFactory implements IProfileConstants { { // analyse the row definition String[] elems = table_def_string.split("\\|"); - ArrayList row = new ArrayList(); + ArrayList<Entry> row = new ArrayList<Entry>(); for (int elem_idx = 0; elem_idx < elems.length; elem_idx++) { String elem = elems[elem_idx]; @@ -268,7 +268,7 @@ public class TableFactory implements IProfileConstants { SignatureEntry sigEntry = null; if (sigEntries_.containsKey(key)) { - sigEntry = (SignatureEntry) sigEntries_.get(key); + sigEntry = sigEntries_.get(key); value = sigEntry.getValue(); } /* @@ -305,7 +305,7 @@ public class TableFactory implements IProfileConstants { String caption = null; if (sigEntries_.containsKey(key)) { - caption = ((SignatureEntry) sigEntries_.get(key)).getCaption(); + caption = sigEntries_.get(key).getCaption(); if (caption == null) { caption = key; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java index 509494b2..4fb883a3 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java @@ -69,9 +69,11 @@ public class VerifierDispatcher { try { for (int i = 0; i < currentClasses.length; i++) { String clsName = currentClasses[i]; - Class<? extends IVerifyFilter> cls = (Class<? extends IVerifyFilter>) Class - .forName(clsName); - IVerifyFilter filter = cls.newInstance(); + Class<?> cls = Class.forName(clsName); + Object f = cls.newInstance(); + if (!(f instanceof IVerifyFilter)) + throw new ClassCastException(); + IVerifyFilter filter = (IVerifyFilter) f; filter.setConfiguration((Configuration) settings); List<FilterEntry> entries = filter.getFiters(); Iterator<FilterEntry> it = entries.iterator(); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java index 9545b32f..c0a0b8aa 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BKUSLConnector.java @@ -104,10 +104,9 @@ public class BKUSLConnector extends BaseSLConnector { } } - @SuppressWarnings("rawtypes") public InfoboxReadResponseType sendInfoboxReadRequest( InfoboxReadRequestType request) throws PdfAsException { - JAXBElement element = null; + JAXBElement<?> element = null; String slRequest; try { slRequest = SLMarschaller.marshalToString(of @@ -116,7 +115,7 @@ public class BKUSLConnector extends BaseSLConnector { String slResponse = performHttpRequestToBKU(slRequest); - element = (JAXBElement) SLMarschaller + element = (JAXBElement<?>) SLMarschaller .unmarshalFromString(slResponse); } catch (JAXBException e) { @@ -146,7 +145,7 @@ public class BKUSLConnector extends BaseSLConnector { public CreateCMSSignatureResponseType sendCMSRequest( CreateCMSSignatureRequestType request) throws PdfAsException { - JAXBElement element = null; + JAXBElement<?> element = null; String slRequest; try { slRequest = SLMarschaller.marshalToString(of @@ -155,7 +154,7 @@ public class BKUSLConnector extends BaseSLConnector { String slResponse = performHttpRequestToBKU(slRequest); - element = (JAXBElement) SLMarschaller + element = (JAXBElement<?>) SLMarschaller .unmarshalFromString(slResponse); } catch (JAXBException e) { throw new PDFIOException("error.pdf.io.03", e); diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java index 7ea4e4d1..540179b8 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java @@ -55,6 +55,7 @@ import java.util.List; import java.util.Map; import org.apache.commons.lang3.math.NumberUtils; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.pdmodel.PDPage; @@ -158,7 +159,6 @@ public class PDFPage extends PDFTextStripper { * * @author Datentechnik Innovation GmbH */ - @SuppressWarnings("unchecked") private void registerCustomPathOperators() { // *** path construction @@ -281,7 +281,7 @@ public class PDFPage extends PDFTextStripper { } } - protected void processOperator(PDFOperator operator, List arguments) + protected void processOperator(PDFOperator operator, List<COSBase> arguments) throws IOException { logger.trace("operator = " + operator); super.processOperator(operator, arguments); @@ -366,14 +366,14 @@ public class PDFPage extends PDFTextStripper { this.mypage = page; } - public void process(PDFOperator operator, List arguments) + public void process(PDFOperator operator, List<COSBase> arguments) throws IOException { COSName name = (COSName) arguments.get(0); // PDResources res = context.getResources(); - Map xobjects = context.getXObjects(); - PDXObject xobject = (PDXObject) xobjects.get(name.getName()); + Map<String, PDXObject> xobjects = context.getXObjects(); + PDXObject xobject = xobjects.get(name.getName()); PDStream stream = xobject.getPDStream(); COSStream cos_stream = stream.getStream(); diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java index 4a9b6886..c68f6229 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java @@ -69,7 +69,7 @@ public abstract class PDFUtilities { public static float calculatePageLength(PDDocument document, int page, float effectivePageHeight, /*int pagerotation,*/ boolean legacy32) throws PDFIOException { //int last_page_id = document.getNumberOfPages(); - List allPages = document.getDocumentCatalog().getAllPages(); + List<?> allPages = document.getDocumentCatalog().getAllPages(); PDPage pdpage = (PDPage) allPages.get(page); //pdpage.setRotation(pagerotation); return calculatePageLength(pdpage, effectivePageHeight, legacy32); diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/ClosePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/ClosePath.java index 48248f3b..8bb76fb5 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/ClosePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/ClosePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.io.IOException; @@ -73,7 +74,7 @@ public class ClosePath extends PathConstructionOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveTo.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveTo.java index 982f72d8..0eb10a52 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveTo.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveTo.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.util.PDFOperator; @@ -74,7 +75,7 @@ public class CurveTo extends PathConstructionOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateFinalPoint.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateFinalPoint.java index 8a467c7e..1020842e 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateFinalPoint.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateFinalPoint.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.util.PDFOperator; @@ -74,7 +75,7 @@ public class CurveToReplicateFinalPoint extends PathConstructionOperatorProcesso } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateInitialPoint.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateInitialPoint.java index e05be319..42a52033 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateInitialPoint.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/CurveToReplicateInitialPoint.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.util.PDFOperator; @@ -74,7 +75,7 @@ public class CurveToReplicateInitialPoint extends PathConstructionOperatorProces } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/LineTo.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/LineTo.java index 872cbede..a47d3fe6 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/LineTo.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/LineTo.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.util.PDFOperator; @@ -72,7 +73,7 @@ public class LineTo extends PathConstructionOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/MoveTo.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/MoveTo.java index 2b7275e4..49d92761 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/MoveTo.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/construction/MoveTo.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathConstructionOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSNumber; import org.apache.pdfbox.util.PDFOperator; @@ -74,7 +75,7 @@ public class MoveTo extends PathConstructionOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseAndStrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseAndStrokePath.java index 78f2369c..552a033c 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseAndStrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseAndStrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.io.IOException; @@ -70,7 +71,7 @@ public class CloseAndStrokePath extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { if (log.isTraceEnabled()) { log.trace("Closing and stroking path."); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java index 3c8b55a9..718fe362 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.io.IOException; @@ -71,7 +72,7 @@ public class CloseFillEvenOddAndStrokePath extends PathPaintingOperatorProcessor } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { if (log.isTraceEnabled()) { log.trace("Closing, filling (even odd rule) and stroking path."); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java index 529ad6c6..523f6681 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.io.IOException; @@ -71,7 +72,7 @@ public class CloseFillNonZeroAndStrokePath extends PathPaintingOperatorProcessor } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { if (log.isTraceEnabled()) { log.trace("Closing, filling (non zero rule) and stroking path."); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/EndPath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/EndPath.java index 0812c3e4..5134ed2f 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/EndPath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/EndPath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.io.IOException; @@ -71,7 +72,7 @@ public class EndPath extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillEvenOddAndStrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillEvenOddAndStrokePath.java index f03bc31f..13623648 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillEvenOddAndStrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillEvenOddAndStrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.awt.geom.GeneralPath; @@ -73,7 +74,7 @@ public class FillEvenOddAndStrokePath extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillNonZeroAndStrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillNonZeroAndStrokePath.java index 911169a9..485411a8 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillNonZeroAndStrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillNonZeroAndStrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.awt.geom.GeneralPath; @@ -73,7 +74,7 @@ public class FillNonZeroAndStrokePath extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathEvenOddRule.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathEvenOddRule.java index 7a20b52e..bb3d3411 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathEvenOddRule.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathEvenOddRule.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.awt.*; @@ -71,7 +72,7 @@ public class FillPathEvenOddRule extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java index 4a2f4ff9..6196c466 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.awt.*; @@ -72,7 +73,7 @@ public class FillPathNonZeroWindingNumberRule extends PathPaintingOperatorProces } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/StrokePath.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/StrokePath.java index 240a5967..b114b60b 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/StrokePath.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/operator/path/painting/StrokePath.java @@ -50,6 +50,7 @@ import at.knowcenter.wag.egov.egiz.pdf.PDFPage; import at.knowcenter.wag.egov.egiz.pdf.operator.path.PathPaintingOperatorProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.util.PDFOperator; import java.awt.*; @@ -71,7 +72,7 @@ public class StrokePath extends PathPaintingOperatorProcessor { } @Override - public void process(PDFOperator operator, List operands) throws IOException { + public void process(PDFOperator operator, List<COSBase> operands) throws IOException { try { PDFPage pdfPage = (PDFPage) context; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Table.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Table.java index 72bdfc4d..c138ac22 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Table.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/table/Table.java @@ -197,7 +197,7 @@ public class Table implements Serializable ArrayList<ArrayList<Entry>> rows = new ArrayList<ArrayList<Entry>>(); for (int row_idx = 1; row_idx <= rows_.size(); row_idx++) { - ArrayList<Entry> row = (ArrayList<Entry>) rows_.get("" + row_idx); + ArrayList<Entry> row = rows_.get(String.valueOf(row_idx)); rows.add(row); } return rows; @@ -237,7 +237,7 @@ public class Table implements Serializable String row_prefix = "\n ++ ROW " + row_idx + " ++ "; for (int entry_idx = 0; entry_idx < row.size(); entry_idx++) { - the_string += row_prefix + ((Entry) row.get(entry_idx)).toString(); + the_string += row_prefix + row.get(entry_idx).toString(); } } the_string += "\n#### TABLE " + name_ + " END #####"; diff --git a/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/mains/TestPDFBoxTable.java b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/mains/TestPDFBoxTable.java index b14565c0..2c4ea18d 100644 --- a/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/mains/TestPDFBoxTable.java +++ b/pdf-as-lib/src/test/java/at/gv/egiz/pdfas/lib/test/mains/TestPDFBoxTable.java @@ -90,9 +90,9 @@ public class TestPDFBoxTable { float textx = x+cellMargin; float texty = y-15; for(int i = 0; i < abstractTable.getRows().size(); i++){ - ArrayList row = (ArrayList) abstractTable.getRows().get(i); + ArrayList<Entry> row = abstractTable.getRows().get(i); for(int j = 0 ; j < row.size(); j++) { - Entry cell = (Entry) row.get(j); + Entry cell = row.get(j); String text = cell.toString(); text = "Hallo"; COSName name = COSName.getPDFName("ANDI_TAG!"); @@ -125,16 +125,15 @@ public class TestPDFBoxTable { private static void renderTable(Table abstractTable) { - ArrayList rows = abstractTable.getRows(); + ArrayList<ArrayList<Entry>> rows = abstractTable.getRows(); Style table_style = abstractTable.getStyle(); for (int row_idx = 0; row_idx < rows.size(); row_idx++) { - @SuppressWarnings("rawtypes") - ArrayList row = (ArrayList) rows.get(row_idx); + ArrayList<Entry> row = rows.get(row_idx); logger.info("## Row:" + row_idx + " ## of table:" + abstractTable.getName()); for (int entry_idx = 0; entry_idx < row.size(); entry_idx++) { - Entry cell = (Entry) row.get(entry_idx); + Entry cell = row.get(entry_idx); // 03.11.2010 changed by exthex - swapped the two params, was probably a bug Style inherit_style = Style.doInherit(table_style, cell.getStyle()); cell.setStyle(inherit_style); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java index 6beff606..085976f0 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/filter/ExceptionCatchFilter.java @@ -70,6 +70,7 @@ public class ExceptionCatchFilter implements Filter { logger.debug("Processing Parameters into Attributes"); HttpServletRequest httpRequest = (HttpServletRequest)request; PdfAsHelper.logAccess(httpRequest); + @SuppressWarnings("unchecked") Enumeration<String> parameterNames = httpRequest.getParameterNames(); while(parameterNames.hasMoreElements()) { String name = parameterNames.nextElement(); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index 2d14a99a..47243a43 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -774,12 +774,17 @@ public class PdfAsHelper { session.setAttribute(VERIFICATION_RESULT, value); } + @SuppressWarnings("unchecked") public static List<VerifyResult> getVerificationResult( HttpServletRequest request) { HttpSession session = request.getSession(); Object obj = session.getAttribute(VERIFICATION_RESULT); if (obj != null) { try { + if (!(obj instanceof List<?>)) { + logger.error("Invalid object type"); + return null; + } return (List<VerifyResult>) obj; } catch (Throwable e) { logger.error("Invalid object type"); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java index ecdc4a8c..cf25c2f2 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java @@ -83,7 +83,7 @@ public class DataURLServlet extends HttpServlet { //System.out.println(xmlResponse); - JAXBElement jaxbObject = (JAXBElement) SLMarschaller.unmarshalFromString(xmlResponse); + JAXBElement<?> jaxbObject = (JAXBElement<?>) SLMarschaller.unmarshalFromString(xmlResponse); if(jaxbObject.getValue() instanceof InfoboxReadResponseType) { InfoboxReadResponseType infoboxReadResponseType = (InfoboxReadResponseType)jaxbObject.getValue(); logger.info("Got InfoboxReadResponseType"); diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java index 28ce628a..ac22f6c8 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ExternSignServlet.java @@ -157,7 +157,7 @@ public class ExternSignServlet extends HttpServlet { uploadDir.mkdir(); } - List formItems = upload.parseRequest(request); + List<?> formItems = upload.parseRequest(request); logger.debug(formItems.size() + " Items in form data"); if (formItems.size() < 1) { // No Uploaded data! diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java index f6b65245..42a5175a 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/VerifyServlet.java @@ -143,7 +143,7 @@ public class VerifyServlet extends HttpServlet { uploadDir.mkdir(); } - List formItems = upload.parseRequest(request); + List<?> formItems = upload.parseRequest(request); logger.debug(formItems.size() + " Items in form data"); if (formItems.size() < 1) { // No Uploaded data! |