aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-14 17:03:02 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-01-14 17:03:02 +0000
commit3231b0d2c665d5493e3a1e63106b8bc934d9094b (patch)
tree7916522e394a974f8562488295998dbcdbc9d50d /src/main/java/at/knowcenter/wag/egov
parenta60dc1973ad78883bf067f15bdc8dd749509cd2b (diff)
downloadpdf-as-3-3231b0d2c665d5493e3a1e63106b8bc934d9094b.tar.gz
pdf-as-3-3231b0d2c665d5493e3a1e63106b8bc934d9094b.tar.bz2
pdf-as-3-3231b0d2c665d5493e3a1e63106b8bc934d9094b.zip
- Errorcode for unsupported signature method introduced
- Errorcode for unknown (internal error) introduced - Fixed issue: in case of unexpected error (RunTimeException for instance) the output file was not deleted - Some System.out.println commands replaced by log.debug messages - Typos fixed - "can-break-after" character list extended: "." added - Configuration updated - DefaultConfiguration updated - internal version set to 3.1 in preparation for release - maven2-repository updated (pdfbox-0.7.2-pdfas-2 compiled for log4j) - pdfbox-0.7.2-pdfas-2 updated (some debug messages) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@552 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java23
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java5
8 files changed, 29 insertions, 13 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
index 57e003a..59a6220 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -99,7 +99,7 @@ public abstract class PdfAS
* The current version of the pdf-as library. This version string is logged on every invocation
* of the api or the web application.
*/
- public static final String PDFAS_VERSION = "3.1-snapshot (20091221)";
+ public static final String PDFAS_VERSION = "3.1 (20100114)";
/**
* The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
index 21dd5bf..a746612 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java
@@ -482,9 +482,10 @@ public abstract class Main
}
FileBasedDataSink dataSink = null;
+ File outputFile = null;
try
{
- File outputFile = new File(output);
+ outputFile = new File(output);
dataSink = new FileBasedDataSink(outputFile);
}
@@ -493,7 +494,25 @@ public abstract class Main
throw new PDFDocumentException(ErrorCode.CANNOT_WRITE_PDF, e);
}
- processSign(pdfDataSource, connector, signature_mode, signature_type, pos_string, dataSink);
+ try {
+ processSign(pdfDataSource, connector, signature_mode, signature_type, pos_string, dataSink);
+ } catch (Exception e) {
+ // Exception caught in order to delete file based datasink
+ if (outputFile != null && outputFile.exists())
+ {
+ logger_.debug("Deleting output file on error.");
+ boolean deleted = outputFile.delete();
+ if (!deleted)
+ {
+ logger_.error("Couldn't delete output file " + output);
+ }
+ }
+ if (e instanceof PresentableException) {
+ throw (PresentableException)e;
+ } else {
+ throw new PresentableException(ErrorCode.UNKNOWN_ERROR, e);
+ }
+ }
// for performance measurement
if (logger_.isInfoEnabled()) {
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
index 4672cc5..ef4e1c2 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java
@@ -1556,7 +1556,7 @@ public abstract class BinarySignature
if (!value.equals(restored_value))
{
// debug:
- System.out.println("WinAnsiEncoding doesn't fit - using URL instead!");
+ logger.warn("WinAnsiEncoding doesn't fit - using URL instead!");
// /debug!
replace_bytes = Placeholder.applyURLEncoding(value);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java
index dc85a4f..a843369 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java
@@ -323,7 +323,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject
String pdfa = SettingsReader.getInstance().getSetting("sig_obj." +profileid+".key."+SIG_PDFA1_B_VALID, "default."+SIG_PDFA1_B_VALID, "false");
pdfaValid= "true".equalsIgnoreCase(pdfa);
SubsetLocal.set(!pdfaValid);
- logger_.trace("Sign PDF/A complient:"+pdfa);
+ logger_.trace("Sign PDF/A compliant:"+pdfa);
} catch (SettingsException e1)
{
logger_.error(e1);
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
index 31b5945..643eff7 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java
@@ -354,7 +354,7 @@ public abstract class Placeholder
*/
protected static boolean canBreakAfter(byte character)
{
- return (character == ' ' || character == ',' || character == ';' || character == '-' || character == '\n') ;
+ return (character == ' ' || character == '.' || character == ',' || character == ';' || character == '-' || character == '\n') ;
}
/**
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
index 1581047..d628fdb 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java
@@ -1133,7 +1133,7 @@ public class SignatureObject implements Serializable
boolean deleted = cert_file.delete();
if (deleted == false)
{
- System.err.println("couldn't delete:" + cert_file.getAbsolutePath());
+ logger_.error("couldn't delete:" + cert_file.getAbsolutePath());
}
}
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java
index 1a2ccbc..b18b7ac 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java
@@ -449,10 +449,6 @@ public class X509Cert implements Serializable
try
{
list = x509Cert_.getExtendedKeyUsage();
- if (list == null)
- {
- System.err.println("is realy null");
- }
}
catch (CertificateParsingException e)
{
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
index 7188273..96f2311 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java
@@ -7,6 +7,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.api.commons.Constants;
+import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.framework.ConnectorParameters;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
@@ -164,7 +165,7 @@ public final class ConnectorChooser
return new LocRefDetachedBKUConnector(cp, loc_ref_url);
}
- throw new ConnectorException(310, "The SIG_KZ version '" + sig_kz.getVersion() + "' is unknown.");
+ throw new ConnectorException(ErrorCode.UNSUPPORTED_SIGNATURE_METHOD, "The SIG_KZ version '" + sig_kz.getVersion() + "' is unknown.");
}
public static Connector chooseWebConnectorForVerify(String connector,
@@ -204,7 +205,7 @@ public final class ConnectorChooser
return new MOASoapWithAttachmentConnector(cp);
}
- throw new ConnectorException(310, "The SIG_KZ version '" + sig_kz.getVersion() + "' is unknown.");
+ throw new ConnectorException(ErrorCode.UNSUPPORTED_SIGNATURE_METHOD, "The SIG_KZ version '" + sig_kz.getVersion() + "' is unknown.");
}
// public static Connector chooseCommandlineConnectorForVerify(String connector,