aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-17 06:33:31 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-06-17 06:33:31 +0000
commitc45c60eecc2f4445ae552a870aa095039644420c (patch)
treec2ea17b0d533d0376b8e209a3b239f01f0ebaaec /src/main/java/at/gv/egiz/pdfas
parentec360bb2794115d33b6203b3171f7cca23ac544e (diff)
downloadpdf-as-3-c45c60eecc2f4445ae552a870aa095039644420c.tar.gz
pdf-as-3-c45c60eecc2f4445ae552a870aa095039644420c.tar.bz2
pdf-as-3-c45c60eecc2f4445ae552a870aa095039644420c.zip
(Default) configuration updated regarding new configuration keys.
Update concerting exclusion of minimal layout profiles for verification. APIDemo updated. Many printStackTraces replaces with logger-messages. Web-Application: New error code (251) introduced: Textual signature of files with no extractable textual content (e.g. files that solely contain images) is prevented. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@293 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/commandline/Main.java5
-rw-r--r--src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java4
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java10
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java11
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java3
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java6
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/input/correction/ExternalCorrector.java2
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/output/FileBasedDataSink.java3
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java11
-rw-r--r--src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java2
10 files changed, 33 insertions, 24 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
index d65ef45..c84b417 100644
--- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
+++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
@@ -182,7 +182,10 @@ public abstract class Main
} else {
System.out.println("Default configuration has NOT been deployed. Maybe the configuration already exists.");
}
-// System.exit(0);
+ if (args.length == 1) {
+ // no other parameters supplied; exit application
+ System.exit(0);
+ }
} catch (ConfigUtilsException e) {
System.err.println("Deployment of default configuration failed: " + e.getMessage());
System.exit(1);
diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java
index 5b37bdf..237a496 100644
--- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java
@@ -35,11 +35,11 @@ public class ErrorCodeHelper
}
catch (SettingsException e)
{
- log.warn(e);
+ log.warn(e.getMessage(), e);
}
catch (SettingNotFoundException e)
{
- log.warn(e);
+ log.warn(e.getMessage(), e);
}
return null;
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
index 635ef89..40da270 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java
@@ -238,8 +238,14 @@ public class PdfAsObject implements PdfAs
String connectorId = CommandlineConnectorChooser.chooseCommandlineConnectorForSign(signParameters.getSignatureDevice());
- SignatorInformation si = PdfAS
- .signCommandline(new PdfDataSourceAdapter(signParameters.getDocument()), new DataSinkAdapter(signParameters.getOutput()), signatorId, connectorId, signParameters.getSignatureProfileId(), pos);
+ SignatorInformation si = PdfAS.signCommandline(
+ new PdfDataSourceAdapter(signParameters.getDocument()),
+ new DataSinkAdapter(signParameters.getOutput()),
+ signatorId,
+ connectorId,
+ signParameters.getSignatureProfileId(),
+ pos
+ );
return new SignResultImpl(signParameters.getOutput(), si.getSignSignatureObject().getX509Certificate(), new ActualSignaturePositionAdapter(si.getActualTablePos()));
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java b/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
index bf3f57b..83d4db0 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/api/verify/VerifyResultAdapter.java
@@ -8,6 +8,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import at.gv.egiz.pdfas.api.verify.SignatureCheck;
import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.gv.egiz.pdfas.impl.api.commons.SignatureInformationAdapter;
@@ -15,6 +18,7 @@ import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
+
/**
* Implements the VerifyResult interface.
*
@@ -24,6 +28,11 @@ public class VerifyResultAdapter extends SignatureInformationAdapter implements
{
protected SignatureResponse sigRes = null;
+ /**
+ * The log.
+ */
+ private static final Log logger_ = LogFactory.getLog(VerifyResultAdapter.class);
+
protected Date vTime = null;
/**
@@ -100,7 +109,7 @@ public class VerifyResultAdapter extends SignatureInformationAdapter implements
}
catch (SettingNotFoundException e)
{
- e.printStackTrace();
+ logger_.error(e.getMessage(), e);
return new ArrayList();
}
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
index a3a0803..57e572f 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedPdfDataSourceImpl.java
@@ -97,8 +97,7 @@ public class FileBasedPdfDataSourceImpl implements PdfDataSource, FileBased
}
catch (IOException e)
{
- log.error("Couldn't create InputStream for file " + getFile() + ". Returning null.");
- log.error(e);
+ log.error("Couldn't create InputStream for file " + getFile() + ". Returning null.", e);
return null;
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
index 1988519..6e0f50b 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/FileBasedTextDataSourceImpl.java
@@ -88,8 +88,7 @@ public class FileBasedTextDataSourceImpl implements TextDataSource, FileBased
}
catch (IOException e)
{
- log.error("Couldn't read text for file " + getFile() + ". Returning null.");
- log.error(e);
+ log.error("Couldn't read text for file " + getFile() + ". Returning null.", e);
return null;
}
@@ -107,8 +106,7 @@ public class FileBasedTextDataSourceImpl implements TextDataSource, FileBased
}
catch (IOException e)
{
- log.error("Couldn't create InputStream for file " + getFile() + ". Returning null.");
- log.error(e);
+ log.error("Couldn't create InputStream for file " + getFile() + ". Returning null.", e);
return null;
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/input/correction/ExternalCorrector.java b/src/main/java/at/gv/egiz/pdfas/impl/input/correction/ExternalCorrector.java
index e244746..25df6a8 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/input/correction/ExternalCorrector.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/input/correction/ExternalCorrector.java
@@ -202,7 +202,7 @@ public class ExternalCorrector implements Corrector
}
catch (IOException e)
{
- log.error(e);
+ log.error(e.getMessage(), e);
}
}
}
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/output/FileBasedDataSink.java b/src/main/java/at/gv/egiz/pdfas/impl/output/FileBasedDataSink.java
index 4e1e3b7..4631800 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/output/FileBasedDataSink.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/output/FileBasedDataSink.java
@@ -78,8 +78,7 @@ public class FileBasedDataSink implements DataSink, FileBased
}
catch (IOException e)
{
- log.error("Couldn't create OutputStream for file " + getFile() + ". Returning null.");
- log.error(e);
+ log.error("Couldn't create OutputStream for file " + getFile() + ". Returning null.", e);
return null;
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java
index b52e97f..c2ec8ff 100644
--- a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java
+++ b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java
@@ -18,22 +18,17 @@
package at.gv.egiz.pdfas.impl.verificator.binary;
import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.apache.log4j.Logger;
+
import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.framework.input.PdfDataSource;
import at.gv.egiz.pdfas.framework.verificator.Verificator;
-import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.CompoundPdfDataSourceImpl;
import at.gv.egiz.pdfas.impl.input.DelimitedPdfDataSource;
-import at.gv.egiz.pdfas.impl.input.helper.DataSourceHelper;
-
-import org.apache.log4j.Logger;
-
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
@@ -275,7 +270,7 @@ public class BinaryVerificator_1_0_0 implements Verificator
}
catch (Exception e)
{
- e.printStackTrace();
+ logger_.error(e.getMessage(), e);
}
}
diff --git a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
index f9cb809..a904ad4 100644
--- a/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/web/helper/SignServletHelper.java
@@ -112,7 +112,7 @@ public class SignServletHelper
// check if document is empty
if (si.si.getSignatureData() == null || si.si.getSignatureData().getDataSource().getLength() == 0) {
- throw new PDFDocumentException(250, "The document is empty.");
+ throw new PDFDocumentException(251, "Unable to extract and textual content.");
}
log.debug("connector = " + si.connector); //$NON-NLS-1$