| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| nl.toolforge.karma.core.cmd.util.DependencyException |
|
|
| 1 | /* |
|
| 2 | Karma core - Core of the Karma application |
|
| 3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, write to the Free Software |
|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 18 | */ |
|
| 19 | package nl.toolforge.karma.core.cmd.util; |
|
| 20 | ||
| 21 | import nl.toolforge.karma.core.ErrorCode; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * Thrown when |
|
| 25 | * |
|
| 26 | * @author D.A. Smedes |
|
| 27 | * @version $Id: DependencyException.java,v 1.10 2004/11/02 23:57:06 asmedes Exp $ |
|
| 28 | */ |
|
| 29 | public class DependencyException extends Exception { |
|
| 30 | ||
| 31 | 0 | private ErrorCode errorCode = null; |
| 32 | 0 | private Object[] messageArguments = null; |
| 33 | ||
| 34 | public static final String EXCEPTION_PREFIX = "DEP-"; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * A dependency is configured, but cannot be found on a developers machine. |
|
| 38 | */ |
|
| 39 | 0 | public static final ErrorCode DEPENDENCY_NOT_FOUND = new ErrorCode(EXCEPTION_PREFIX + "00001"); |
| 40 | ||
| 41 | /** A dependency on a module has been defined, but the module is not in the manifest */ |
|
| 42 | 0 | public static final ErrorCode MODULE_NOT_IN_MANIFEST = new ErrorCode(EXCEPTION_PREFIX + "00004"); |
| 43 | ||
| 44 | 0 | public static final ErrorCode DUPLICATE_ARTIFACT_VERSION = new ErrorCode(EXCEPTION_PREFIX + "00002"); |
| 45 | 0 | public static final ErrorCode EAR_DEPENDENCY_NOT_DEFINED = new ErrorCode(EXCEPTION_PREFIX + "00003"); |
| 46 | 0 | public static final ErrorCode EAR_DEPENDENCY_NOT_FOUND = new ErrorCode(EXCEPTION_PREFIX + "00005"); |
| 47 | ||
| 48 | public DependencyException(ErrorCode errorCode) { |
|
| 49 | 0 | this(errorCode, null); |
| 50 | 0 | } |
| 51 | ||
| 52 | public DependencyException(ErrorCode errorCode, Object[] messageArguments) { |
|
| 53 | 0 | super(); |
| 54 | 0 | this.errorCode = errorCode; |
| 55 | 0 | this.messageArguments = messageArguments; |
| 56 | 0 | } |
| 57 | ||
| 58 | public DependencyException(Throwable t, ErrorCode errorCode, Object[] messageArguments) { |
|
| 59 | 0 | super(t); |
| 60 | 0 | this.errorCode = errorCode; |
| 61 | 0 | this.messageArguments = messageArguments; |
| 62 | 0 | } |
| 63 | ||
| 64 | public String getMessage() { |
|
| 65 | 0 | if (messageArguments != null && messageArguments.length > 0) { |
| 66 | 0 | errorCode.setMessageArguments(messageArguments); |
| 67 | } |
|
| 68 | 0 | return errorCode.getErrorMessage(); |
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Gets the exceptions' {@link nl.toolforge.karma.core.ErrorCode}. |
|
| 73 | * @return |
|
| 74 | */ |
|
| 75 | public final ErrorCode getErrorCode() { |
|
| 76 | 0 | return errorCode; |
| 77 | } |
|
| 78 | ||
| 79 | public final Object[] getMessageArguments() { |
|
| 80 | 0 | return messageArguments; |
| 81 | } |
|
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |