From 4e14449c2d0097e421bedc5f01647c8b09f1c49c Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 2 Oct 2013 11:29:09 +0200 Subject: Initial legacy API checkin --- .../pdfas/api/exceptions/ConfigUtilsException.java | 122 +++++++++++++++++++++ .../at/gv/egiz/pdfas/api/exceptions/ErrorCode.java | 115 +++++++++++++++++++ .../egiz/pdfas/api/exceptions/PdfAsException.java | 98 +++++++++++++++++ .../gv/egiz/pdfas/api/exceptions/package-info.java | 8 ++ 4 files changed, 343 insertions(+) create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/package-info.java (limited to 'pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions') diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java new file mode 100644 index 00000000..644f74ee --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java @@ -0,0 +1,122 @@ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * @author Thomas Knall + */ +public class ConfigUtilsException extends Exception { + + /** + * Marker for serialization. + */ + private static final long serialVersionUID = 1L; + + /** + * The underlying exception. + */ + private Exception wrappedException; + + /** + * Returns the underlying exception. + * + * @return The underlying exception. + */ + public Exception getException() { + return this.wrappedException; + } + + /** + * Returns the message of the wrapped exception. + * + * @return The message of the wrapped exception. + */ + public String getMessage() { + String message = super.getMessage(); + if (message == null && this.wrappedException != null) { + return this.wrappedException.getMessage(); + } else { + return message; + } + } + + /** + * Instantiation of a new exception based on a message and another (wrapped) + * exception. + * + * @param message + * The exception message. + * @param exception + * Another exception. + */ + public ConfigUtilsException(final String message, final Exception exception) { + super(message); + this.wrappedException = exception; + } + + /** + * Instantiated a new exception based on a message. + * + * @param message + * The message of the new exception. + */ + public ConfigUtilsException(final String message) { + super(message); + this.wrappedException = null; + } + + /** + * Instantiates a new exception based on another (wrapped) exception. + * + * @param exception + * The wrapped exception. + */ + public ConfigUtilsException(final Exception exception) { + super(); + this.wrappedException = exception; + } + + /** + * Instantiates a new (unspecified) exception. + */ + public ConfigUtilsException() { + super(); + this.wrappedException = null; + + } + + /** + * Returns the text representation of this instance. + * + * @return The text representation of this instance. + */ + public String toString() { + if (this.wrappedException != null) { + return this.wrappedException.toString(); + } else { + return super.toString(); + } + } + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java new file mode 100644 index 00000000..91dd8d8a --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java @@ -0,0 +1,115 @@ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * Contains constants for the error codes. + * + *

+ * In Java 1.5 this would be an enum. + *

+ * + * @author wprinz + */ +public final class ErrorCode +{ + public static final int EXTERNAL_ERROR = 0; + public static final int UNKNOWN_ERROR = 6; + public static final int OUT_OF_MEMORY_ERROR = 7; + + public static final int SETTING_NOT_FOUND = 100; + public static final int SETTINGS_EXCEPTION = 101; + 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 CIRCULAR_INCLUDE_INSTRUCTION_DETECTED = 106; + public static final int UNABLE_TO_LOAD_DEFAULT_CONFIG = 107; + + public static final int DOCUMENT_CANNOT_BE_READ = 201; + public static final int TEXT_EXTRACTION_EXCEPTION = 202; + public static final int CANNOT_WRITE_PDF = 205; + public static final int DOCUMENT_NOT_SIGNED = 206; + public static final int SIGNATURE_TYPES_EXCEPTION = 223; + public static final int FONT_NOT_FOUND = 230; + public static final int DOCUMENT_IS_PROTECTED = 231; + public static final int INVALID_SIGNATURE_DICTIONARY = 232; +//23.11.2010 changed by exthex - added error code for failed extraction + public static final int SIGNATURE_PLACEHOLDER_EXTRACTION_FAILED = 233; + + /** + * Error code for {@code SignatureException}s occurring when trying to sign with a certain signature profile that + * is not allowed to be used for signature, e.g. because ist has been set to + *

+ * {@code sig_obj.types. = verify_only} + * @author Datentechnik Innovation GmbH + */ + public static final int SIGNATURE_PROFILE_IS_NOT_ALLOWED_FOR_SIGNATURE = 234; + + public static final int INVALID_SIGNATURE_POSITION = 224; + public static final int NO_TEXTUAL_CONTENT = 251; + + public static final int SIGNATURE_COULDNT_BE_CREATED = 300; + public static final int SIGNED_TEXT_EMPTY = 301; + public static final int PROFILE_NOT_DEFINED = 302; + public static final int SERIAL_NUMBER_INVALID = 303; + public static final int SIG_CERTIFICATE_CANNOT_BE_READ = 304; + public static final int PROFILE_NOT_USABLE_FOR_TEXT = 305; + + public static final int COULDNT_VERIFY = 310; + + public static final int CERTIFICATE_NOT_FOUND = 313; + public static final int NOT_SEMANTICALLY_EQUAL = 314; + + public static final int MODIFIED_AFTER_SIGNATION = 316; + public static final int NON_BINARY_SIGNATURES_PRESENT = 317; + + public static final int UNSUPPORTED_REPLACES_NAME = 318; + public static final int UNSUPPORTED_SIGNATURE = 319; + + public static final int DETACHED_SIGNATURE_NOT_SUPPORTED = 370; + + public static final int SIGNATURE_VERIFICATION_NOT_SUPPORTED = 371; + public static final int INVALID_SIGNING_TIME = 372; + + public static final int BKU_NOT_SUPPORTED = 373; + + public static final int WEB_EXCEPTION = 330; + public static final int UNABLE_TO_RECEIVE_SUITABLE_RESPONSE = 340; + + + public static final int NORMALIZER_EXCEPTION = 400; + + public static final int SESSION_EXPIRED = 600; + + public static final int PLACEHOLDER_EXCEPTION = 700; + public static final int CAPTION_NOT_FOUND_EXCEPTION = 701; + + public static final int UNABLE_TO_PARSE_ID = 800; + public static final int CORRECTOR_EXCEPTION = 801; + public static final int EXTERNAL_CORRECTOR_TIMEOUT_REACHED = 802; + + + public static final int FUNCTION_NOT_AVAILABLE = 999; +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java new file mode 100644 index 00000000..1fb556a5 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java @@ -0,0 +1,98 @@ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * This exception is the base for all PDF-AS exceptions. + * + *

+ * Every PDF-AS Exception has an error code. + *

+ * + * @author wprinz + */ +public class PdfAsException extends Exception +{ + /** + * The error code. + */ + protected int errorCode = -1; + + /** + * Constructor. + * + * @param errorCode + * The error code. + * @param message + * The detail message. + */ + public PdfAsException(int errorCode, String message) + { + super(message); + + this.errorCode = errorCode; + } + + /** + * Constructor. + * + * @param errorCode + * The error code. + * @param message + * The detail message. + * @param cause + * The cause. + */ + public PdfAsException(int errorCode, String message, Throwable cause) + { + super(message, cause); + + this.errorCode = errorCode; + } + + /** + * Constructor. + * + * @param errorCode + * The error code. + * @param cause + * The cause. + */ + public PdfAsException(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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/package-info.java new file mode 100644 index 00000000..51f23335 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author afitzek + * + */ +package at.gv.egiz.pdfas.api.exceptions; \ No newline at end of file -- cgit v1.2.3