From c45c60eecc2f4445ae552a870aa095039644420c Mon Sep 17 00:00:00 2001 From: tknall Date: Tue, 17 Jun 2008 06:33:31 +0000 Subject: (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 --- src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java | 4 ++-- .../knowcenter/wag/egov/egiz/cfg/SettingsReader.java | 4 ++-- .../wag/egov/egiz/exceptions/ErrorCodeException.java | 4 ++-- .../wag/egov/egiz/framework/VerificationFilter.java | 4 ++-- .../verificators/BinaryVerificator_1_0_0.java | 2 +- .../wag/egov/egiz/ldap/api/LDAPAPIImpl.java | 10 +++++----- .../wag/egov/egiz/pdf/BinarySignature.java | 12 ++++++------ .../wag/egov/egiz/pdf/PDFSignatureObjectIText.java | 17 ----------------- .../at/knowcenter/wag/egov/egiz/pdf/Placeholder.java | 8 ++++---- .../at/knowcenter/wag/egov/egiz/pdf/StringInfo.java | 7 ++++++- .../wag/egov/egiz/sig/ConnectorFactory.java | 2 +- .../knowcenter/wag/egov/egiz/sig/DummyLDAPAPI.java | 10 +++++++++- .../wag/egov/egiz/sig/SignatureObject.java | 17 ++++++++--------- .../wag/egov/egiz/sig/SignatureResponse.java | 2 +- .../knowcenter/wag/egov/egiz/sig/SignatureTypes.java | 6 +----- .../at/knowcenter/wag/egov/egiz/sig/X509Cert.java | 11 ++++++----- .../wag/egov/egiz/sig/connectors/MOAConnector.java | 4 ---- .../wag/egov/egiz/sig/sigid/DetachedIdFormatter.java | 2 +- .../egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java | 2 +- .../wag/egov/egiz/sig/sigkz/SigKZIDHelper.java | 12 ++++++++++-- .../knowcenter/wag/egov/egiz/tools/DebugHelper.java | 2 +- .../knowcenter/wag/egov/egiz/tools/Normalizer.java | 8 ++++---- .../wag/egov/egiz/web/LocalRequestHelper.java | 15 ++++++++++----- .../egov/egiz/web/PdfASServletContextListener.java | 2 +- .../wag/egov/egiz/web/servlets/DataURLServlet.java | 6 +++--- .../egov/egiz/web/servlets/ProvidePDFServlet.java | 2 +- .../web/servlets/RetrieveSignatureDataServlet.java | 2 +- .../egov/egiz/web/servlets/SignPreviewServlet.java | 8 +++++++- .../wag/egov/egiz/web/servlets/SignServlet.java | 20 +++++++++----------- .../egov/egiz/web/servlets/VerifyPreviewServlet.java | 4 ++-- .../wag/egov/egiz/web/servlets/VerifyServlet.java | 2 +- 31 files changed, 108 insertions(+), 103 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov/egiz') 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 b9987ff..8593cf1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -96,7 +96,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.0.6"; + public static final String PDFAS_VERSION = "3.0.6-20080616"; /** * The key of the strict mode setting. @@ -143,7 +143,7 @@ public abstract class PdfAS } catch (SettingsException e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } return false; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java index c7e5933..6cd5e61 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java @@ -570,14 +570,14 @@ public class SettingsReader implements Serializable { if (logger_.isWarnEnabled()) { - logger_.warn("Can not convert " + value + " to int."); + logger_.warn("Can not convert " + value + " to int.", e); } } catch (SettingNotFoundException e) { if (logger_.isWarnEnabled()) { - logger_.warn("Setting " + key + " not found, return default value:" + defaultValue); + logger_.warn("Setting " + key + " not found, return default value:" + defaultValue, e); } } return int_property; diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java index ec21fb5..584e716 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ErrorCodeException.java @@ -167,7 +167,7 @@ public class ErrorCodeException extends PresentableException catch (SettingsException e) { String log_message = "Can not load pdf signature settings. Cause:\n" + e.getMessage(); - logger_.error(log_message); + logger_.error(log_message, e); } } } @@ -293,7 +293,7 @@ public class ErrorCodeException extends PresentableException } catch (SettingsException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } return err_msg; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java index 6309ad4..415aa04 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java @@ -308,7 +308,7 @@ public class VerificationFilter } catch (InvalidIDException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } if (kz != null && kz.getType().equals(SignatorFactory.TYPE_BINARY)) { @@ -527,7 +527,7 @@ public class VerificationFilter } catch (InvalidIDException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } writer.println(" holder[" + i + "]: " + holder.getSignatureObject().getSignationType() + ", KZ=" + kz); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java index b389a25..a6b87dc 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java @@ -269,7 +269,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/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIImpl.java b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIImpl.java index d6f3e7c..1409ae8 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIImpl.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/ldap/api/LDAPAPIImpl.java @@ -81,11 +81,11 @@ public class LDAPAPIImpl implements LDAPAPI { } } catch (SettingsException e) { - this.log.error(e); + this.log.error(e.getMessage(), e); } catch (SettingNotFoundException e) { - this.log.error(e); + this.log.error(e.getMessage(), e); } catch (LDAPException e) { - this.log.error(e); + this.log.error(e.getMessage(), e); } ; } @@ -98,7 +98,7 @@ public class LDAPAPIImpl implements LDAPAPI { LDAPClient client = this.ldapClientFactory.createClient(issuer); url = client.getUrl().toString(); } catch (LDAPException e) { - this.log.error(e); + this.log.error(e.getMessage(), e); } return url; } @@ -113,7 +113,7 @@ public class LDAPAPIImpl implements LDAPAPI { base64CertData = Util.Base64Encode(x509certificate.toByteArray()); } } catch (LDAPException e) { - this.log.error(e); + this.log.error(e.getMessage(), e); } return base64CertData; } 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 bb34040..24840e6 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 @@ -1526,7 +1526,7 @@ public abstract class BinarySignature } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } // sort replaces @@ -1597,7 +1597,7 @@ public abstract class BinarySignature } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } throw new KZSettingNotFoundException("Field " + SignatureTypes.SIG_KZ + " not found."); } @@ -1648,7 +1648,7 @@ public abstract class BinarySignature } catch (IOException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); return false; } @@ -1713,7 +1713,7 @@ public abstract class BinarySignature } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); return false; } } @@ -1849,7 +1849,7 @@ public abstract class BinarySignature } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); return -1; } } @@ -1893,7 +1893,7 @@ public abstract class BinarySignature } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } } 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 ad3a24c..2053264 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 @@ -311,9 +311,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject Image image = Image.getInstance(img_file.getCanonicalPath()); logger_.debug("Using image file \"" + img_file.getCanonicalPath() + "\"."); - // TODO[tknall]: enable image scaling defined by configuration image.scaleToFit(80.0f, 80.0f); - // tknall end boolean fit = true; Style.ImageScaleToFit istf = cell_style.getImageScaleToFit(); if (istf != null) @@ -326,13 +324,6 @@ public class PDFSignatureObjectIText implements PDFSignatureObject } catch (BadElementException e) { - if (logger_.isDebugEnabled()) - { - if (logger_.isDebugEnabled()) - { - e.printStackTrace(); - } - } if (logger_.isEnabledFor(Level.ERROR)) { logger_.error("BadElementException:" + e.getMessage()); @@ -342,10 +333,6 @@ public class PDFSignatureObjectIText implements PDFSignatureObject } catch (MalformedURLException e) { - if (logger_.isDebugEnabled()) - { - e.printStackTrace(); - } if (logger_.isEnabledFor(Level.ERROR)) { logger_.error("MalformedURLException:" + e.getMessage()); @@ -355,10 +342,6 @@ public class PDFSignatureObjectIText implements PDFSignatureObject } catch (IOException e) { - if (logger_.isDebugEnabled()) - { - e.printStackTrace(); - } if (logger_.isEnabledFor(Level.ERROR)) { logger_.error("Error Code: 222, IOException:" + e.getMessage()); 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 6523db9..9155f15 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 @@ -66,7 +66,7 @@ public abstract class Placeholder } catch (IOException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); return null; } } @@ -189,7 +189,7 @@ public abstract class Placeholder } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); return null; } return replace_bytes; @@ -212,7 +212,7 @@ public abstract class Placeholder } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); return null; } @@ -298,7 +298,7 @@ public abstract class Placeholder } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); return null; } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java index 5933e4b..d2b28a4 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java @@ -20,6 +20,9 @@ package at.knowcenter.wag.egov.egiz.pdf; import java.io.Serializable; import java.io.UnsupportedEncodingException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * Specifies a certain data area within the pdf. * @@ -37,6 +40,8 @@ public class StringInfo implements Serializable */ private static final long serialVersionUID = 5834801907046737048L; + protected static Log logger = LogFactory.getLog(StringInfo.class); + /** * The PDF document this range belongs to. */ @@ -85,7 +90,7 @@ public class StringInfo implements Serializable } catch (UnsupportedEncodingException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); return "(" + this.string_start + "," + this.string_length + ")"; } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/ConnectorFactory.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/ConnectorFactory.java index 9d744e1..e8deb39 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/ConnectorFactory.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/ConnectorFactory.java @@ -337,7 +337,7 @@ public abstract class ConnectorFactory is_id_field_visible = SettingsReader.getInstance().getValueFromKey(MOA_ID_VISIBLE_PROPERTY_KEY); } catch (SettingsException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } // if not setted in config, show it diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/DummyLDAPAPI.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/DummyLDAPAPI.java index 47d1d20..0ab1d25 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/DummyLDAPAPI.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/DummyLDAPAPI.java @@ -20,6 +20,9 @@ package at.knowcenter.wag.egov.egiz.sig; import java.io.File; import java.io.FileInputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; import at.knowcenter.wag.egov.egiz.ldap.api.LDAPAPIException; import at.knowcenter.wag.egov.egiz.ldap.client.LDAPIssuerNameFilter; @@ -36,6 +39,11 @@ public class DummyLDAPAPI implements LDAPAPI { String url_ = null; + /** + * The Logger. + */ + protected static Log logger = LogFactory.getLog(DummyLDAPAPI.class); + public DummyLDAPAPI(String url) { this.url_ = url; @@ -70,7 +78,7 @@ public byte[] loadBase64CertificateFromLDAP(String serial_number, String issuer) } catch (Exception e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); data = null; } } 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 1b9b6a6..a765e8d 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 @@ -47,7 +47,6 @@ import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException; import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; import at.knowcenter.wag.egov.egiz.exceptions.SignatureException; import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException; -import at.knowcenter.wag.egov.egiz.framework.SignatorFactory; import at.knowcenter.wag.egov.egiz.ldap.api.LDAPAPIException; import at.knowcenter.wag.egov.egiz.ldap.api.LDAPAPIFactory; import at.knowcenter.wag.egov.egiz.ldap.client.LDAPIssuerNameFilter; @@ -197,7 +196,7 @@ public class SignatureObject implements Serializable try { name = parser.parse(); } catch (RFC2253NameParserException e) { - logger_.error(e); + logger_.error(e.getMessage(), e); } return name; } @@ -465,7 +464,7 @@ public class SignatureObject implements Serializable } catch (InvalidIDException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } return kz; } @@ -705,7 +704,7 @@ public class SignatureObject implements Serializable } catch (CertificateEncodingException e) { - logger_.error(e); + logger_.error(e.getMessage(), e); } } @@ -872,7 +871,7 @@ public class SignatureObject implements Serializable } catch (InvalidIDException e) { - logger_.error(e); + logger_.error(e.getMessage(), e); return false; } } @@ -891,7 +890,7 @@ public class SignatureObject implements Serializable } catch (InvalidIDException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } return SigKZIDHelper.isTextual(kz); } @@ -910,7 +909,7 @@ public class SignatureObject implements Serializable } catch (InvalidIDException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } return SigKZIDHelper.isBinary(kz); @@ -1175,7 +1174,7 @@ public class SignatureObject implements Serializable Name issuerName = new RFC2253NameParser(issuer).parse(); cert = loadCertificateFromCertstore(serialNumber, issuerName.getRFC2253String(false)); } catch (RFC2253NameParserException e) { - logger_.error(e); + logger_.error(e.getMessage(), e); } } @@ -1245,7 +1244,7 @@ public class SignatureObject implements Serializable this.setSignationIssuer(cert.getIssuerName()); } } catch (IOException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); return; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java index deedb6d..6a5c95a 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureResponse.java @@ -136,7 +136,7 @@ public class SignatureResponse } catch (SignatureException e) { - logger_.warn(e.getMessage()); + logger_.warn(e.getMessage(), e); } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java index 13fdf2f..3dd6f67 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java @@ -388,11 +388,7 @@ public class SignatureTypes } catch (SignatureException e) { - if (logger_.isDebugEnabled()) - { - logger_.debug(e.getMessage()); - } - e.printStackTrace(); + logger_.error(e.getMessage(), e); } } } 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 148ac41..8aaa49a 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 @@ -157,12 +157,12 @@ public class X509Cert implements Serializable catch (java.security.cert.CertificateException ce) { // nothing to do, cause certString is not X509 conformc - ce.printStackTrace(); + logger_.error(ce.getMessage(), ce); } catch (IOException ioe) { // nothing to do, cause certString is not X509 conform - ioe.printStackTrace(); + logger_.error(ioe.getMessage(), ioe); } return x509_cert; } @@ -217,12 +217,13 @@ public class X509Cert implements Serializable catch (java.security.cert.CertificateException ce) { // nothing to do, cause certString is not X509 conformc - ce.printStackTrace(); + logger_.error(ce.getMessage(), ce); + } catch (IOException ioe) { // nothing to do, cause certString is not X509 conform - ioe.printStackTrace(); + logger_.error(ioe.getMessage(), ioe); } return x509_cert; @@ -453,7 +454,7 @@ public class X509Cert implements Serializable } catch (CertificateParsingException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } return null; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java index 5e1aeed..5ec7f20 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/MOAConnector.java @@ -214,10 +214,6 @@ public class MOAConnector implements Connector } catch (WebException we) { - if (logger_.isDebugEnabled()) - { - we.printStackTrace(); - } SignatureException se = new SignatureException(we.getErrorCode(), we); throw se; } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java index 7e67d0d..1b24a98 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedIdFormatter.java @@ -40,7 +40,7 @@ public class DetachedIdFormatter implements IdFormatter try { SIG_ID_PREFIX = SettingsReader.getInstance().getValueFromKey(SIG_ID_PROPERTY_KEY); } catch (SettingsException e) { - e.printStackTrace(); + log.error(e.getMessage(), e); } // ids algorithm: diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java index 89f9503..14fb41e 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigid/DetachedLocRefMOAIdFormatter.java @@ -44,7 +44,7 @@ public class DetachedLocRefMOAIdFormatter implements IdFormatter SIG_ID_PREFIX = SettingsReader.getInstance().getValueFromKey(SIG_ID_PROPERTY_KEY); } catch (SettingsException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java index f2ec571..5206ed1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java @@ -3,6 +3,9 @@ */ package at.knowcenter.wag.egov.egiz.sig.sigkz; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; @@ -18,6 +21,11 @@ import at.knowcenter.wag.egov.egiz.sig.sigid.HotfixIdFormatter; public final class SigKZIDHelper { + /** + * The Logger. + */ + protected static Log logger = LogFactory.getLog(SigKZIDHelper.class); + public static boolean isTextual(PdfASID sig_kz) { if (sig_kz == null) @@ -73,7 +81,7 @@ public final class SigKZIDHelper } catch (InvalidIDException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } } @@ -124,7 +132,7 @@ public final class SigKZIDHelper } catch (InvalidIDException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/DebugHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/DebugHelper.java index e273437..8ff5faf 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/DebugHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/DebugHelper.java @@ -64,7 +64,7 @@ public final class DebugHelper } catch (Exception e) { - log.error(e); + log.error(e.getMessage(), e); } } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java b/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java index 397f910..3dafb31 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/tools/Normalizer.java @@ -139,7 +139,7 @@ public class Normalizer implements Serializable { if (logger_.isEnabledFor(Level.FATAL)) { logger_.fatal("Class not found:" + class_name); } - throw new NormalizeException("Can not load normalizer library"); + throw new NormalizeException("Can not load normalizer library", e); } try { normalize_ = (Normalize) normalize_class.newInstance(); @@ -147,12 +147,12 @@ public class Normalizer implements Serializable { if (logger_.isEnabledFor(Level.FATAL)) { logger_.fatal("Can not instantiate:" + class_name); } - throw new NormalizeException("Can not load normalizer library"); + throw new NormalizeException("Can not load normalizer library", e); } catch (IllegalAccessException e) { if (logger_.isEnabledFor(Level.FATAL)) { logger_.fatal("Can not access:" + class_name); } - throw new NormalizeException("Can not load normalizer library"); + throw new NormalizeException("Can not load normalizer library", e); } } @@ -264,7 +264,7 @@ public class Normalizer implements Serializable { settings_ = SettingsReader.getInstance(); } catch (SettingsException e) { String log_message = "Can not load normalizer settings. Cause:\n" + e.getMessage(); - logger_.error(log_message); + logger_.error(log_message, e); throw new NormalizeException(log_message, e); } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java index 2f02944..15792b9 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/LocalRequestHelper.java @@ -26,8 +26,9 @@ import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.pdfas.impl.input.TextDataSourceImpl; -import at.gv.egiz.pdfas.framework.input.DataSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import at.gv.egiz.pdfas.web.CurrentLocalOperation; import at.gv.egiz.pdfas.web.SignSessionInformation; import at.gv.egiz.pdfas.web.VerifySessionInformation; @@ -39,10 +40,8 @@ import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException; import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; import at.knowcenter.wag.egov.egiz.exceptions.SignatureException; -import at.knowcenter.wag.egov.egiz.pdf.BinarySignatureHolder; import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder; import at.knowcenter.wag.egov.egiz.sig.SignatureData; -import at.knowcenter.wag.egov.egiz.sig.SignatureDataImpl; import at.knowcenter.wag.egov.egiz.sig.SignatureObject; import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorChooser; import at.knowcenter.wag.egov.egiz.sig.connectors.LocalConnector; @@ -56,6 +55,12 @@ import at.knowcenter.wag.egov.egiz.sig.signatureobject.SignatureObjectHelper; */ public abstract class LocalRequestHelper { + + /** + * The logger. + */ + protected static Log logger = LogFactory.getLog(LocalRequestHelper.class); + /** * The resource of the null request page jsp. */ @@ -426,7 +431,7 @@ public abstract class LocalRequestHelper } catch (MalformedURLException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); } String loc_server = response.encodeURL(local_server.toString()); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java index 95cb041..cdd3df1 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/PdfASServletContextListener.java @@ -98,7 +98,7 @@ public class PdfASServletContextListener implements ServletContextListener try { SettingsReader.getInstance(); } catch (SettingsException e) { - logger.error(e); + logger.error(e.getMessage(), e); } SettingsReader.clearTemporaryDirectory(); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java index cbb33ba..19a82c3 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/DataURLServlet.java @@ -133,7 +133,7 @@ public class DataURLServlet extends HttpServlet } catch (PresentableException e) { - log.error(e); + log.error(e.getMessage(), e); SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } @@ -147,9 +147,9 @@ public class DataURLServlet extends HttpServlet // if (request.getCharacterEncoding() == null || request.getCharacterEncoding().equals("UTF-8")) //$NON-NLS-1$ if (request.getCharacterEncoding() == null || request.getCharacterEncoding().length() <= 0) //$NON-NLS-1$ { - log.error("The BKU didn't set a character encoding for the request."); //$NON-NLS-1$ + log.info("The BKU didn't set a character encoding for the request."); //$NON-NLS-1$ - log.warn("Manually setting character encoding to UTF-8"); //$NON-NLS-1$ + log.info("Manually setting character encoding to UTF-8"); //$NON-NLS-1$ request.setCharacterEncoding("UTF-8"); //$NON-NLS-1$ } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java index 03bd074..a8ff426 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/ProvidePDFServlet.java @@ -88,7 +88,7 @@ public class ProvidePDFServlet extends HttpServlet { response.getOutputStream().flush(); signedDocuments.remove(current); } catch (IOException e) { - log.warn("IO excepton while providing pdf document: " + e.getMessage()); + log.error("IO excepton while providing pdf document: " + e.getMessage(), e); } } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/RetrieveSignatureDataServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/RetrieveSignatureDataServlet.java index 61996da..1b32db8 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/RetrieveSignatureDataServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/RetrieveSignatureDataServlet.java @@ -86,7 +86,7 @@ public class RetrieveSignatureDataServlet extends HttpServlet } catch (SessionExpiredException e) { - log.error(e); + log.error(e.getMessage(), e); SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignPreviewServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignPreviewServlet.java index aec4f25..fa6b734 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignPreviewServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignPreviewServlet.java @@ -25,6 +25,9 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import at.gv.egiz.pdfas.web.SignSessionInformation; import at.gv.egiz.pdfas.web.helper.SessionHelper; import at.gv.egiz.pdfas.web.helper.SignServletHelper; @@ -36,6 +39,8 @@ import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; public class SignPreviewServlet extends HttpServlet { + protected static Log logger = LogFactory.getLog(SignPreviewServlet.class); + /** * SVUID. */ @@ -63,7 +68,8 @@ public class SignPreviewServlet extends HttpServlet } catch (PresentableException e) { - e.printStackTrace(); + logger.error(e.getMessage(), e); + SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java index 9b340e6..6330f0c 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/SignServlet.java @@ -34,15 +34,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.pdfas.exceptions.ErrorCode; -import at.gv.egiz.pdfas.exceptions.ErrorCodeHelper; -import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException; -import at.gv.egiz.pdfas.framework.input.PdfDataSource; -import at.gv.egiz.pdfas.impl.input.FileBasedPdfDataSourceImpl; -import at.gv.egiz.pdfas.web.SignSessionInformation; -import at.gv.egiz.pdfas.web.helper.SignServletHelper; -import at.gv.egiz.pdfas.web.helper.TempDirHelper; - import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; @@ -50,6 +41,13 @@ import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import at.gv.egiz.pdfas.exceptions.ErrorCode; +import at.gv.egiz.pdfas.exceptions.ErrorCodeHelper; +import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException; +import at.gv.egiz.pdfas.framework.input.PdfDataSource; +import at.gv.egiz.pdfas.web.SignSessionInformation; +import at.gv.egiz.pdfas.web.helper.SignServletHelper; +import at.gv.egiz.pdfas.web.helper.TempDirHelper; import at.knowcenter.wag.egov.egiz.PdfAS; import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; @@ -197,7 +195,7 @@ public class SignServlet extends HttpServlet } catch (PDFDocumentException e) { - log.warn("Unable to create signature position object: " + e.getMessage()); + log.warn("Unable to create signature position object: " + e.getMessage(), e); } } else { log.debug("No signature position provided."); @@ -308,7 +306,7 @@ public class SignServlet extends HttpServlet } catch (PresentableException e) { - e.printStackTrace(); + log.error(e.getMessage(), e); prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyPreviewServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyPreviewServlet.java index 9a91567..9b8583d 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyPreviewServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyPreviewServlet.java @@ -582,7 +582,7 @@ public class VerifyPreviewServlet extends HttpServlet } catch (PresentableException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } @@ -702,7 +702,7 @@ public class VerifyPreviewServlet extends HttpServlet } catch (PresentableException e) { - e.printStackTrace(); + logger_.error(e.getMessage(), e); SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error.jsp"); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java index 97a1e6f..387ae08 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java @@ -175,7 +175,7 @@ public class VerifyServlet extends HttpServlet } catch (PresentableException e) { - e.printStackTrace(); + log.error(e.getMessage(), e); SignServlet.prepareDispatchToErrorPage(e, request); dispatch(request, response, "/jsp/error_verify.jsp"); } -- cgit v1.2.3