diff options
30 files changed, 101 insertions, 141 deletions
diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java index c1201cb5..ccf4b80e 100644 --- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java +++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/DeveloperMain.java @@ -24,28 +24,8 @@ package at.gv.egiz.pdfas.cli; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.common.utils.StreamUtils; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSink; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.StatusRequest; -import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; -import at.gv.egiz.pdfas.lib.impl.VerifyParameterImpl; -import at.gv.egiz.pdfas.lib.impl.signing.pdfbox.PADESPDFBOXSigner; -import at.gv.egiz.pdfas.sigs.pades.PAdESSigner; -import at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedSigner; -import at.gv.egiz.sl.util.BKUSLConnector; -import at.gv.egiz.sl.util.MOAConnector; public class DeveloperMain { @@ -62,7 +42,7 @@ public class DeveloperMain { String user_home = System.getProperty("user.home"); String pdfas_dir = user_home + File.separator + ".pdfas"; - PdfAs pdfas = PdfAsFactory.createPdfAs(new File(pdfas_dir)); + /*PdfAs pdfas = */PdfAsFactory.createPdfAs(new File(pdfas_dir)); System.out.println(PdfAsFactory.getVersion()); return; diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java index e9bbdc59..34e384ad 100644 --- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java +++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java @@ -46,12 +46,10 @@ import at.gv.egiz.pdfas.lib.api.PdfAs; import at.gv.egiz.pdfas.lib.api.PdfAsFactory; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.sign.SignResult; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.sigs.pades.PAdESSigner; import at.gv.egiz.pdfas.sigs.pades.PAdESSignerKeystore; -import at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedSigner; import at.gv.egiz.sl.util.BKUSLConnector; import at.gv.egiz.sl.util.MOAConnector; @@ -393,7 +391,7 @@ public class Main { signParameter.setSignatureProfileId(profilID); System.out.println("Starting signature for " + pdfFile); System.out.println("Selected signature Profile " + profilID); - SignResult result = pdfAs.sign(signParameter); + /*SignResult result = */pdfAs.sign(signParameter); FileOutputStream fos = new FileOutputStream(outputPdfFile, false); fos.write(dataSink.getData()); diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java index 07370eed..3a9284cc 100644 --- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java +++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java @@ -41,7 +41,7 @@ public class TempFileHelper implements IProfileConstants { private static final Logger logger = LoggerFactory.getLogger(TempFileHelper.class); - private final String tmpFilePrefix = "/tmp/"; + //private final String tmpFilePrefix = "/tmp/"; private static final String tmpFileSuffix = ".tmppdf"; private String tmpDir = "tmp"; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java index 6f84e9bc..bb747bc6 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAsFactory.java @@ -33,10 +33,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; -import java.util.jar.Attributes; -import java.util.jar.Manifest; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -57,10 +53,10 @@ public class PdfAsFactory { private static final String DEFAULT_CONFIG_RES = "config/config.zip"; - private static final String MAN_ATTRIBUTE = "JARMANIFEST"; - private static final String PDF_AS_LIB = "PDF-AS-LIB"; - private static final String IMPL_VERSION = "Implementation-Version"; - private static final String SCM_REVISION = "SCMREVISION"; +// private static final String MAN_ATTRIBUTE = "JARMANIFEST"; +// private static final String PDF_AS_LIB = "PDF-AS-LIB"; +// private static final String IMPL_VERSION = "Implementation-Version"; +// private static final String SCM_REVISION = "SCMREVISION"; static { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java index 78bde7ec..f2864a07 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/configuration/GlobalConfiguration.java @@ -24,7 +24,6 @@ package at.gv.egiz.pdfas.lib.impl.configuration; import at.gv.egiz.pdfas.common.settings.ISettings; -import at.gv.egiz.pdfas.lib.api.Configuration; import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; public class GlobalConfiguration extends SpecificBaseConfiguration diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java index 4fe2ba6c..6c1934ff 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PdfboxSignerWrapper.java @@ -45,7 +45,8 @@ public class PdfboxSignerWrapper implements PDFASSignatureInterface { .getLogger(PdfboxSignerWrapper.class); private IPlainSigner signer; - private PDSignature signature; + @SuppressWarnings("unused") + private PDSignature signature; private int[] byteRange; private Calendar date; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java index 3308f784..e667f0ea 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/sig_interface/SignatureDataInjector.java @@ -25,7 +25,6 @@ package at.gv.egiz.pdfas.lib.impl.signing.sig_interface; import iaik.x509.X509Certificate; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Calendar; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java index 42f81f42..e5b8acd0 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java @@ -38,7 +38,6 @@ import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; import at.gv.egiz.pdfas.common.utils.DNUtils; import at.gv.egiz.pdfas.common.utils.OgnlUtils; import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; public class CertificateResolver implements IResolver { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/IResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/IResolver.java index 8c38039f..03529d5a 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/IResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/IResolver.java @@ -25,7 +25,6 @@ package at.gv.egiz.pdfas.lib.impl.stamping; import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; /** * Created with IntelliJ IDEA. 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 038e9a88..429aa6d0 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 @@ -23,25 +23,29 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl.stamping; +import static at.gv.egiz.pdfas.common.utils.StringUtils.extractLastID; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Vector; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.gv.egiz.pdfas.common.settings.IProfileConstants; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.knowcenter.wag.egov.egiz.pdf.sig.SignatureEntry; import at.knowcenter.wag.egov.egiz.table.Entry; import at.knowcenter.wag.egov.egiz.table.Style; import at.knowcenter.wag.egov.egiz.table.Table; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.*; - -import static at.gv.egiz.pdfas.common.utils.StringUtils.extractLastID; - public class TableFactory implements IProfileConstants { + @SuppressWarnings("unused") private static final Logger logger = LoggerFactory.getLogger(TableFactory.class); /** @@ -120,7 +124,7 @@ public class TableFactory implements IProfileConstants { String table_def_key = table_def_iter.next(); int dot_idx = (table_def_key.lastIndexOf(".") > 0 ? table_def_key.lastIndexOf(".") + 1 : table_def_key.length()); String table_def = table_def_key.substring(dot_idx); - String table_def_keys_prefix = table_def_key.substring(0, dot_idx-1); + //String table_def_keys_prefix = table_def_key.substring(0, dot_idx-1); String table_def_string = configuration.getValue(table_def_key); if (table_def.matches("\\D*")) { @@ -294,6 +298,7 @@ public class TableFactory implements IProfileConstants { * the key to get the caption for * @return a caption for the given key */ + @SuppressWarnings("unused") private static String getSigCaption(String key) { diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java index ebd5c962..b05fc52c 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java @@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.settings.IProfileConstants; import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; /** * Created with IntelliJ IDEA. User: afitzek Date: 9/11/13 Time: 11:11 AM To diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java index 8da6d149..0b183c08 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureBuilder.java @@ -254,7 +254,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder { private PDFAsVisualSignatureProperties properties; private ISettings settings; - private List<PDFont> addedFonts = new ArrayList<PDFont>(); +// private List<PDFont> addedFonts = new ArrayList<PDFont>(); private PDResources innerFormResources; private Map<String, ImageObject> images = new HashMap<String, ImageObject>(); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java index bd516100..b2183753 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFAsVisualSignatureDesigner.java @@ -6,7 +6,6 @@ import java.io.ByteArrayOutputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.Arrays; import java.util.List; import javax.imageio.ImageIO; @@ -14,17 +13,11 @@ import javax.imageio.ImageIO; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.common.PDRectangle; -import org.apache.pdfbox.pdmodel.font.PDType1Font; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSignDesigner; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.knowcenter.wag.egov.egiz.table.Table; public class PDFAsVisualSignatureDesigner { - private static final Logger logger = LoggerFactory.getLogger(PDFAsVisualSignatureDesigner.class); - +// private static final Logger logger = LoggerFactory.getLogger(PDFAsVisualSignatureDesigner.class); + private Float sigImgWidth; private Float sigImgHeight; private float xAxis; @@ -36,7 +29,7 @@ public class PDFAsVisualSignatureDesigner { private float[] formaterRectangleParams = { 0, 0, 100, 50 }; // default private byte[] AffineTransformParams = { 1, 0, 0, 1, 0, 0 }; // default private float imageSizeInPercents; - private PDDocument document = null; +// private PDDocument document = null; PDFAsVisualSignatureProperties properties; /** diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java index 2ef653d8..9cde5fe6 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PDFBoxTable.java @@ -285,38 +285,38 @@ public class PDFBoxTable { return lines.toArray(new String[0]); } - private String[] breakString(String value, PDFont f, float maxwidth) throws IOException { - String[] words = value.split(" "); - List<String> lines = new ArrayList<String>(); - int cLine = 0; - String cLineValue = ""; - for (int i = 0; i < words.length; i++) { - String word = words[i]; - String[] lineBreaks = word.split("\n"); - if (lineBreaks.length > 1) { - for (int j = 0; j < lineBreaks.length; j++) { - String subword = lineBreaks[j]; - // if (cLine + subword.length() > maxline) { - lines.add(cLineValue.trim()); - cLineValue = ""; - cLine = 0; - // } - cLineValue += subword + " "; - cLine += subword.length(); - } - } else { - if (f.getStringWidth(cLineValue + word) > maxwidth && cLineValue.length() != 0) { - lines.add(cLineValue.trim()); - cLineValue = ""; - cLine = 0; - } - cLineValue += word + " "; - cLine += word.length(); - } - } - lines.add(cLineValue.trim()); - return lines.toArray(new String[0]); - } +// private String[] breakString(String value, PDFont f, float maxwidth) throws IOException { +// String[] words = value.split(" "); +// List<String> lines = new ArrayList<String>(); +// int cLine = 0; +// String cLineValue = ""; +// for (int i = 0; i < words.length; i++) { +// String word = words[i]; +// String[] lineBreaks = word.split("\n"); +// if (lineBreaks.length > 1) { +// for (int j = 0; j < lineBreaks.length; j++) { +// String subword = lineBreaks[j]; +// // if (cLine + subword.length() > maxline) { +// lines.add(cLineValue.trim()); +// cLineValue = ""; +// cLine = 0; +// // } +// cLineValue += subword + " "; +// cLine += subword.length(); +// } +// } else { +// if (f.getStringWidth(cLineValue + word) > maxwidth && cLineValue.length() != 0) { +// lines.add(cLineValue.trim()); +// cLineValue = ""; +// cLine = 0; +// } +// cLineValue += word + " "; +// cLine += word.length(); +// } +// } +// lines.add(cLineValue.trim()); +// return lines.toArray(new String[0]); +// } private float getCellHeight(Entry cell, float width) throws IOException { boolean isValue = true; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PdfBoxStamper.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PdfBoxStamper.java index 1bd4fed5..762f22e9 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PdfBoxStamper.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/PdfBoxStamper.java @@ -2,11 +2,6 @@ package at.gv.egiz.pdfas.lib.impl.stamping.pdfbox; import java.io.IOException; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDFTemplateBuilder; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.impl.stamping.IPDFStamper; @@ -17,12 +12,12 @@ import at.knowcenter.wag.egov.egiz.table.Table; public class PdfBoxStamper implements IPDFStamper { - private static final Logger logger = LoggerFactory.getLogger(PdfBoxStamper.class); - - private PDFTemplateBuilder pdfBuilder; - +// private static final Logger logger = LoggerFactory.getLogger(PdfBoxStamper.class); + +// private PDFTemplateBuilder pdfBuilder; + public PdfBoxStamper() { - this.pdfBuilder = new PDVisibleSigBuilder(); +// this.pdfBuilder = new PDVisibleSigBuilder(); } public IPDFVisualObject createVisualPDFObject(PDFObject pdf, Table table) throws IOException { 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 95be4512..9545b32f 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 @@ -32,12 +32,10 @@ import javax.xml.bind.JAXBException; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java index 0001d855..d8aa2672 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/sl/util/BaseSLConnector.java @@ -24,7 +24,6 @@ package at.gv.egiz.sl.util; import java.math.BigInteger; -import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 cdfedcc9..7ea4e4d1 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 @@ -48,8 +48,11 @@ */ package at.knowcenter.wag.egov.egiz.pdf; -import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.*; -import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.*; +import java.awt.Rectangle; +import java.awt.geom.GeneralPath; +import java.io.IOException; +import java.util.List; +import java.util.Map; import org.apache.commons.lang3.math.NumberUtils; import org.apache.pdfbox.cos.COSName; @@ -68,12 +71,21 @@ import org.apache.pdfbox.util.operator.OperatorProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.awt.*; -import java.awt.geom.GeneralPath; -import java.io.IOException; -import java.io.Writer; -import java.util.List; -import java.util.Map; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.ClosePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.CurveTo; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.CurveToReplicateFinalPoint; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.CurveToReplicateInitialPoint; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.LineTo; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.construction.MoveTo; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.CloseAndStrokePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.CloseFillEvenOddAndStrokePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.CloseFillNonZeroAndStrokePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.EndPath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.FillEvenOddAndStrokePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.FillNonZeroAndStrokePath; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.FillPathEvenOddRule; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.FillPathNonZeroWindingNumberRule; +import at.knowcenter.wag.egov.egiz.pdf.operator.path.painting.StrokePath; /** * PDFPage is an inner class that is used to calculate the page length of a PDF 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 9bc9d38c..4a9b6886 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 @@ -51,12 +51,12 @@ package at.knowcenter.wag.egov.egiz.pdf; import java.io.IOException; import java.util.List; -import at.gv.egiz.pdfas.common.exceptions.PDFIOException; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDResources; -import org.apache.pdfbox.pdmodel.interactive.pagenavigation.PDThreadBead; + +import at.gv.egiz.pdfas.common.exceptions.PDFIOException; /** 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 cba9b927..b14565c0 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 @@ -1,11 +1,8 @@ package at.gv.egiz.pdfas.lib.test.mains; import iaik.x509.X509Certificate; -import java.awt.Graphics; -import java.awt.geom.AffineTransform; import java.io.File; import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; @@ -13,9 +10,7 @@ import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.common.PDRectangle; -import org.apache.pdfbox.pdmodel.common.PDStream; import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; -import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -180,7 +175,7 @@ public class TestPDFBoxTable { renderTable(main); - PDStream stream1; +// PDStream stream1; PDDocument document = new PDDocument(); PDPage page = new PDPage(); 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 beac8a09..6beff606 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 @@ -34,7 +34,6 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; -import org.apache.http.HttpRequest; import org.apache.log4j.BasicConfigurator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java index 99e51d31..f9b42ef2 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PDFASSession.java @@ -32,11 +32,15 @@ import at.gv.egiz.pdfas.lib.api.sign.SignParameter; public class PDFASSession implements Serializable { + private static final long serialVersionUID = 1L; + public static final String SESSION_TAG = "PDFASSession"; - + private StatusRequest statusRequest; private SignParameter signParameter; + @SuppressWarnings("unused") private Configuration config; + @SuppressWarnings("unused") private PdfAs pdfAs; public PDFASSession(SignParameter parameter) { 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 db933a6b..2d14a99a 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 @@ -458,8 +458,8 @@ public class PdfAsHelper { HttpSession session = request.getSession(); StatusRequest statusRequest = (StatusRequest) session .getAttribute(PDF_STATUS); - IPlainSigner plainSigner = (IPlainSigner) session - .getAttribute(PDF_SIGNER); +// IPlainSigner plainSigner = (IPlainSigner) session +// .getAttribute(PDF_SIGNER); String connector = (String) session.getAttribute(PDF_SL_INTERACTIVE); @@ -470,8 +470,8 @@ public class PdfAsHelper { // TODO Handle logic for BKU interaction - Configuration config = (Configuration) session - .getAttribute(PDF_CONFIG); +// Configuration config = (Configuration) session +// .getAttribute(PDF_CONFIG); if (statusRequest.needCertificate()) { logger.info("Needing Certificate from BKU"); 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 bc485131..28ce628a 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 @@ -39,7 +39,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.web.config.WebConfiguration; import at.gv.egiz.pdfas.web.exception.PdfAsWebException; import at.gv.egiz.pdfas.web.helper.DigestHelper; @@ -259,7 +258,7 @@ public class ExternSignServlet extends HttpServlet { logger.debug("Starting signature creation with: " + connector); - IPlainSigner signer; + //IPlainSigner signer; if (connector.equals("bku") || connector.equals("onlinebku") || connector.equals("mobilebku")) { // start asynchronous signature creation diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java index db27d0b3..82bbc34f 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/ProvidePDFServlet.java @@ -24,7 +24,6 @@ package at.gv.egiz.pdfas.web.servlets; import java.io.IOException; -import java.io.PrintWriter; import java.net.URLEncoder; import javax.servlet.ServletException; @@ -32,7 +31,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.http.client.utils.URLEncodedUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 342e95de..f6b65245 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 @@ -23,8 +23,6 @@ ******************************************************************************/ package at.gv.egiz.pdfas.web.servlets; -import iaik.x509.X509Certificate; - import java.io.File; import java.io.IOException; import java.util.List; @@ -41,12 +39,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.PdfAs; -import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.web.exception.PdfAsWebException; import at.gv.egiz.pdfas.web.helper.PdfAsHelper; import at.gv.egiz.pdfas.web.helper.PdfAsParameterExtractor; diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index 0a29c588..16a56c90 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -62,6 +62,7 @@ import at.gv.egiz.pdfas.lib.util.CertificateUtils; public class PAdESSignerKeystore implements IPlainSigner { + @SuppressWarnings("unused") private static final Logger logger = LoggerFactory .getLogger(PAdESSignerKeystore.class); diff --git a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java index 85446486..7b45a45a 100644 --- a/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java +++ b/signature-standards/sigs-pkcs7detached/src/main/java/at/gv/egiz/pdfas/sigs/pkcs7detached/PKCS7DetachedSigner.java @@ -101,8 +101,7 @@ public class PKCS7DetachedSigner implements IPlainSigner { si.addSignerInfo(signer1); InputStream dataIs = si.getInputStream(); byte[] buf = new byte[1024]; - int r; - while ((r = dataIs.read(buf)) > 0) + while ((dataIs.read(buf)) > 0) ; // skip data ContentInfo ci = new ContentInfo(si); logger.info("PKCS7 signature done."); diff --git a/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextVisualObject.java b/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextVisualObject.java index b2c20668..0dafdd47 100644 --- a/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextVisualObject.java +++ b/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextVisualObject.java @@ -24,7 +24,7 @@ package at.gv.egiz.pdfas.stmp.itext; import at.gv.egiz.pdfas.lib.impl.stamping.IPDFVisualObject; -import at.knowcenter.wag.egov.egiz.pdf.Pos; + import com.lowagie.text.pdf.PdfPTable; public class ITextVisualObject implements IPDFVisualObject { diff --git a/stamper/stmp-itext/src/main/java/com/lowagie/text/pdf/ITextStamperAccess.java b/stamper/stmp-itext/src/main/java/com/lowagie/text/pdf/ITextStamperAccess.java index e50f1552..d4fcb7e1 100644 --- a/stamper/stmp-itext/src/main/java/com/lowagie/text/pdf/ITextStamperAccess.java +++ b/stamper/stmp-itext/src/main/java/com/lowagie/text/pdf/ITextStamperAccess.java @@ -38,6 +38,7 @@ import com.lowagie.text.Image; public class ITextStamperAccess { + @SuppressWarnings("unused") private static final Logger logger = LoggerFactory.getLogger(ITextStamperAccess.class); public static void replacePlaceholder(PdfStamper stamper, int pageNr, String placeholderName) |