From 3d982813b34f6f230baf4a467cdc37ec92a77595 Mon Sep 17 00:00:00 2001 From: netconomy Date: Fri, 17 Aug 2007 06:10:56 +0000 Subject: Performance git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@167 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../egov/egiz/exceptions/ConnectorException.java | 10 ++-- .../egiz/exceptions/ConnectorFactoryException.java | 22 +++++---- .../egov/egiz/exceptions/ErrorCodeException.java | 10 ++-- .../egov/egiz/exceptions/InvalidIDException.java | 5 -- .../egov/egiz/exceptions/NormalizeException.java | 30 +++--------- .../egov/egiz/exceptions/PDFDocumentException.java | 11 +---- .../egov/egiz/exceptions/PlaceholderException.java | 4 +- .../egov/egiz/exceptions/PresentableException.java | 23 +++++++-- .../egiz/exceptions/SettingNotFoundException.java | 25 +++++----- .../egov/egiz/exceptions/SettingsException.java | 15 ++---- .../egiz/exceptions/SignatorFactoryException.java | 4 +- .../egov/egiz/exceptions/SignatureException.java | 7 +-- .../egiz/exceptions/SignatureTypesException.java | 34 ++++++++----- .../wag/egov/egiz/exceptions/WebException.java | 56 ++++++++++------------ 14 files changed, 123 insertions(+), 133 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/exceptions') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorException.java index e660bb7..34c27b2 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorException.java @@ -9,7 +9,7 @@ package at.knowcenter.wag.egov.egiz.exceptions; * * @author wprinz */ -public class ConnectorException extends SignatureException +public class ConnectorException extends PresentableException { /** @@ -45,12 +45,8 @@ public class ConnectorException extends SignatureException super(error_code, cause); } - /** - * @param error_code - */ - public ConnectorException(int error_code) + public ConnectorException(PresentableException cause) { - super(error_code); + super(cause.getErrorCode(), cause); } - } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorFactoryException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorFactoryException.java index 733ccb6..924400f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorFactoryException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/ConnectorFactoryException.java @@ -17,6 +17,8 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * This exception is thrown when the connector factory encounters an error * during providing a connector. @@ -41,24 +43,24 @@ public class ConnectorFactoryException extends PresentableException */ public ConnectorFactoryException(String message) { - super(message); + super(ErrorCode.SETTINGS_EXCEPTION, message); } - /** - * @param message - * @param cause - */ - public ConnectorFactoryException(String message, Throwable cause) - { - super(message, cause); - } +// /** +// * @param message +// * @param cause +// */ +// public ConnectorFactoryException(String message, Throwable cause) +// { +// super(message, cause); +// } /** * @param cause */ public ConnectorFactoryException(Throwable cause) { - super(cause); + super(ErrorCode.SETTINGS_EXCEPTION, cause); } } 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 42fe597..ec21fb5 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 @@ -44,6 +44,8 @@ import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; * @author wlackner * @author wprinz (enforced error code) * + * @deprecated + * * @see at.knowcenter.wag.egov.egiz.cfg.SettingsReader */ public class ErrorCodeException extends PresentableException @@ -96,7 +98,7 @@ public class ErrorCodeException extends PresentableException */ public ErrorCodeException(final int error_code) { - super("error code " + error_code); + super(error_code, "just an error code"); this.error_code_ = error_code; loadSettings(); } @@ -112,7 +114,7 @@ public class ErrorCodeException extends PresentableException */ public ErrorCodeException(final int error_code, String message) { - super("error code " + error_code + ": " + message); + super(error_code, message); this.error_code_ = error_code; loadSettings(); } @@ -130,7 +132,7 @@ public class ErrorCodeException extends PresentableException */ public ErrorCodeException(final int error_code, String message, Throwable cause) { - super("error code " + error_code + ": " + message, cause); + super(error_code, message, cause); this.error_code_ = error_code; loadSettings(); } @@ -146,7 +148,7 @@ public class ErrorCodeException extends PresentableException */ public ErrorCodeException(final int error_code, Throwable cause) { - super("error code " + error_code, cause); + super(error_code, cause); this.error_code_ = error_code; loadSettings(); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/InvalidIDException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/InvalidIDException.java index 33d189b..15f30ca 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/InvalidIDException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/InvalidIDException.java @@ -44,9 +44,4 @@ public class InvalidIDException extends SignatureException super(error_code, cause); } - public InvalidIDException(int error_code) - { - super(error_code); - } - } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/NormalizeException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/NormalizeException.java index 3675edb..2dd6cd4 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/NormalizeException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/NormalizeException.java @@ -19,13 +19,15 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * This exception is thrown by the processing a normalizer. * * @author wlackner */ -public class NormalizeException extends ErrorCodeException { +public class NormalizeException extends PresentableException { /** * SVUID. @@ -37,36 +39,18 @@ public class NormalizeException extends ErrorCodeException { * @param message * @param cause */ - public NormalizeException(int error_code, String message, Throwable cause) + public NormalizeException(String message, Throwable cause) { - super(error_code, message, cause); + super(ErrorCode.NORMALIZER_EXCEPTION, message, cause); } /** * @param error_code * @param message */ - public NormalizeException(int error_code, String message) - { - super(error_code, message); - } - - /** - * @param error_code - * @param cause - */ - public NormalizeException(int error_code, Throwable cause) - { - super(error_code, cause); - } - - /** - * @param error_code - */ - public NormalizeException(int error_code) + public NormalizeException(String message) { - super(error_code); + super(ErrorCode.NORMALIZER_EXCEPTION, message); } - } \ No newline at end of file diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PDFDocumentException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PDFDocumentException.java index a0cf56a..f7fd09d 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PDFDocumentException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PDFDocumentException.java @@ -22,11 +22,11 @@ package at.knowcenter.wag.egov.egiz.exceptions; * * @author wlackner */ -public class PDFDocumentException extends ErrorCodeException +public class PDFDocumentException extends PresentableException { /** - * + * SVUID. */ private static final long serialVersionUID = -4595955288382226408L; @@ -58,12 +58,5 @@ public class PDFDocumentException extends ErrorCodeException super(error_code, cause); } - /** - * @param error_code - */ - public PDFDocumentException(int error_code) - { - super(error_code); - } } \ No newline at end of file diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PlaceholderException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PlaceholderException.java index 1c82c3c..7fdc06b 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PlaceholderException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PlaceholderException.java @@ -17,6 +17,8 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * @author wprinz */ @@ -33,7 +35,7 @@ public class PlaceholderException extends PDFDocumentException public PlaceholderException(String field, int missing) { - super(700, field + ":" + missing); + super(ErrorCode.PLACEHOLDER_EXCEPTION, field + ":" + missing); this.field = field; this.missing = missing; diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PresentableException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PresentableException.java index ab87002..218109d 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PresentableException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/PresentableException.java @@ -36,30 +36,47 @@ public class PresentableException extends Exception * SVUID. */ private static final long serialVersionUID = -102406558526000792L; + + protected int errorCode = -1; /** * @param message */ - public PresentableException(String message) + public PresentableException(int errorCode, String message) { super(message); + + this.errorCode = errorCode; } /** * @param message * @param cause */ - public PresentableException(String message, Throwable cause) + public PresentableException(int errorCode, String message, Throwable cause) { super(message, cause); + + this.errorCode = errorCode; } /** * @param cause */ - public PresentableException(Throwable cause) + public PresentableException(int errorCode, Throwable cause) { super(cause); + + this.errorCode = errorCode; + } + + /** + * Returns the error code of this exception. + * @return Returns the error code of this exception. + */ + public int getErrorCode () + { + return this.errorCode; } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingNotFoundException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingNotFoundException.java index 02a3b5b..b117fdb 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingNotFoundException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingNotFoundException.java @@ -17,13 +17,15 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * This exception is thrown by the SettingsReader if a property key is not * found. * * @author wlackner */ -public class SettingNotFoundException extends ErrorCodeException +public class SettingNotFoundException extends PresentableException { /** @@ -36,35 +38,32 @@ public class SettingNotFoundException extends ErrorCodeException * @param message * @param cause */ - public SettingNotFoundException(int error_code, String message, Throwable cause) + public SettingNotFoundException(String message, Throwable cause) { - super(error_code, message, cause); + super(ErrorCode.SETTING_NOT_FOUND, message, cause); } /** * @param error_code * @param message */ - public SettingNotFoundException(int error_code, String message) + public SettingNotFoundException(String message) { - super(error_code, message); + super(ErrorCode.SETTING_NOT_FOUND, message); } /** * @param error_code * @param cause */ - public SettingNotFoundException(int error_code, Throwable cause) + public SettingNotFoundException(Throwable cause) { - super(error_code, cause); + super(ErrorCode.SETTING_NOT_FOUND, cause); } - - /** - * @param error_code - */ - public SettingNotFoundException(int error_code) + + protected SettingNotFoundException(int errorCode, String message) { - super(error_code); + super(errorCode, message); } } \ No newline at end of file diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingsException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingsException.java index c53e6f2..d781577 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingsException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SettingsException.java @@ -17,6 +17,8 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * Thrown when the settings couldn't be loaded. * @@ -40,7 +42,7 @@ public class SettingsException extends PresentableException */ public SettingsException(String message) { - super(message); + super(ErrorCode.SETTINGS_EXCEPTION, message); } /** @@ -49,15 +51,6 @@ public class SettingsException extends PresentableException */ public SettingsException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param cause - */ - public SettingsException(Throwable cause) - { - super(cause); + super(ErrorCode.SETTINGS_EXCEPTION, message, cause); } - } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatorFactoryException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatorFactoryException.java index dea7cfc..53a88de 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatorFactoryException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatorFactoryException.java @@ -17,6 +17,8 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * Exception coming out of the SignatorFactory. * @author wprinz @@ -31,7 +33,7 @@ public class SignatorFactoryException extends PresentableException public SignatorFactoryException(String message) { - super(message); + super(ErrorCode.SETTINGS_EXCEPTION, message); } } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureException.java index f036f49..dc69722 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureException.java @@ -25,7 +25,7 @@ package at.knowcenter.wag.egov.egiz.exceptions; * * @author wlackner */ -public class SignatureException extends ErrorCodeException { +public class SignatureException extends PresentableException { /** * SVUID. @@ -62,10 +62,11 @@ public class SignatureException extends ErrorCodeException { /** * @param error_code + * @param cause */ - public SignatureException(int error_code) + public SignatureException(PresentableException cause) { - super(error_code); + super(cause.getErrorCode(), cause); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureTypesException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureTypesException.java index 4f51418..d8f46db 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureTypesException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/SignatureTypesException.java @@ -17,8 +17,11 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * Exception for Signature Type problems. + * * @author wprinz */ public class SignatureTypesException extends PresentableException @@ -34,24 +37,31 @@ public class SignatureTypesException extends PresentableException */ public SignatureTypesException(String message) { - super(message); + super(ErrorCode.SIGNATURE_TYPES_EXCEPTION, message); } - /** - * @param message - * @param cause - */ - public SignatureTypesException(String message, Throwable cause) - { - super(message, cause); - } +// /** +// * @param message +// * @param cause +// */ +// public SignatureTypesException(String message, Throwable cause) +// { +// super(ErrorCode.SIGNATURE_TYPES_EXCEPTION, message, cause); +// } + + // /** + // * @param cause + // */ + // public SignatureTypesException(Throwable cause) + // { + // super(ErrorCode.SIGNATURE_TYPES_EXCEPTION, cause); + // } /** * @param cause */ - public SignatureTypesException(Throwable cause) + public SignatureTypesException(PresentableException cause) { - super(cause); + super(cause.getErrorCode(), cause); } - } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/WebException.java b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/WebException.java index 5f72211..7d06b6a 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/WebException.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/exceptions/WebException.java @@ -19,54 +19,48 @@ */ package at.knowcenter.wag.egov.egiz.exceptions; +import at.gv.egiz.pdfas.exceptions.ErrorCode; + /** * Exception for web problems. * @author wlackner */ -public class WebException extends ErrorCodeException { +public class WebException extends PresentableException { /** * SVUID. */ private static final long serialVersionUID = 4329890155872840492L; +// /** +// * @param error_code +// * @param message +// * @param cause +// */ +// public WebException(int error_code, String message, Throwable cause) +// { +// super(error_code, message, cause); +// } +// +// /** +// * @param error_code +// * @param message +// */ +// public WebException(int error_code, String message) +// { +// super(error_code, message); +// } +// + /** * @param error_code - * @param message * @param cause */ - public WebException(int error_code, String message, Throwable cause) + public WebException(Throwable cause) { - super(error_code, message, cause); + super(ErrorCode.WEB_EXCEPTION, cause); } - /** - * @param error_code - * @param message - */ - public WebException(int error_code, String message) - { - super(error_code, message); - } - - /** - * @param error_code - * @param cause - */ - public WebException(int error_code, Throwable cause) - { - super(error_code, cause); - } - - /** - * @param error_code - */ - public WebException(int error_code) - { - super(error_code); - } - - } -- cgit v1.2.3