aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-04 10:12:25 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-04 10:12:25 +0000
commit1c2600e7328c84a3327719cc682731bb470417e3 (patch)
treec4c8caf6a7005885d5363dee9b6438318f62f713 /src/main/java
parentf471d8a5ac76cff2f6a6c833c7c4aa08d24fecab (diff)
downloadpdf-as-3-1c2600e7328c84a3327719cc682731bb470417e3.tar.gz
pdf-as-3-1c2600e7328c84a3327719cc682731bb470417e3.tar.bz2
pdf-as-3-1c2600e7328c84a3327719cc682731bb470417e3.zip
- fixed: handling incomplete response from citizen card environment (missing headers "user-agent" or "Server")
- fixed: do not try to delete non-existing file git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@743 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/commandline/Main.java12
-rw-r--r--src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java1
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUPostConnection.java5
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactory.java3
6 files changed, 18 insertions, 7 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 ec75d34..a910ebf 100644
--- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
+++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
@@ -523,12 +523,14 @@ public abstract class Main
if (output != null)
{
- logger_.debug("Deleting output file on error.");
File oFile = new File(output);
- boolean deleted = oFile.delete();
- if (!deleted)
- {
- logger_.error("Couldn't delete output file " + output);
+ if (oFile.exists()) {
+ logger_.debug("Deleting output file on error.");
+ boolean deleted = oFile.delete();
+ if (!deleted)
+ {
+ logger_.error("Couldn't delete output file " + output);
+ }
}
}
}
diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
index 64d1470..79f17aa 100644
--- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
+++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java
@@ -23,6 +23,7 @@ public final class ErrorCode
public static final int KZ_SETTING_NOT_FOUND = 102;
public static final int NO_EMBEDABLE_TTF_CONFIGURED_FOR_PDFA = 103;
public static final int INVALID_SIGNATURE_LAYOUT_IMPL_CONFIGURED = 104;
+ public static final int MISSING_HEADER_SERVER_USER_AGENT = 105;
public static final int DOCUMENT_CANNOT_BE_READ = 201;
public static final int TEXT_EXTRACTION_EXCEPTION = 202;
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 01077f9..a084ab0 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java
@@ -107,7 +107,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.2-SNAPSHOT (20110201)";
+ public static final String PDFAS_VERSION = "3.2-SNAPSHOT (20110204)";
/**
* The key of the strict mode setting.
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUPostConnection.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUPostConnection.java
index 5fa1877..8b1da4c 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUPostConnection.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUPostConnection.java
@@ -152,6 +152,11 @@ public final class BKUPostConnection
response_properties.setProperty(RESPONSE_STRING_KEY, response_string);
log.debug("doPostRequestMultipart finished."); //$NON-NLS-1$
+
+ // FIXME: remove
+ response_properties.remove("BKU-Signature-Layout");
+ response_properties.remove("BKU-Server-Header");
+
return response_properties;
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java
index 80a80bc..2726bd4 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java
@@ -134,7 +134,7 @@ public class DetachedBKUConnector implements Connector, LocalConnector
String response_string = response_properties.getProperty(BKUPostConnection.RESPONSE_STRING_KEY);
String bkuIdentifier = BKUHelper.getBKUIdentifier(response_properties);
- log.debug("BKU identifier: \"" + bkuIdentifier + "\"");
+ log.debug("BKU identifier: " + (bkuIdentifier != null ? ("\"" + bkuIdentifier + "\"") : "n/a"));
SignatureLayoutHandler sigLayout;
try {
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactory.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactory.java
index c56b5f6..a98208b 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactory.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/signaturelayout/SignatureLayoutHandlerFactory.java
@@ -53,6 +53,9 @@ public class SignatureLayoutHandlerFactory {
* @throws SettingsException Thrown in case of an error within the configuration.
*/
public static SignatureLayoutHandler getSignatureLayoutHandlerInstance(String bkuIdentifier) throws ConnectorException, SettingsException {
+ if (bkuIdentifier == null) {
+ throw new SettingsException(ErrorCode.MISSING_HEADER_SERVER_USER_AGENT, "Unable to determine type of citizen card environment. Response header \"Server\" resp. \"User-Agent\" is missing. Refer to security layer specification, section 3.3.2.");
+ }
SignatureLayoutHandler signatureLayoutHandler = (SignatureLayoutHandler) instances.get(bkuIdentifier);
if (signatureLayoutHandler == null) {