View Javadoc
1 /*** 2 * ReportException.java 3 * 4 * Project: Dependency Tool 5 * 6 * WHEN WHO WHAT 7 * 06.06.2003 pko initial public release 8 * 31.10.2002 pko creation 9 * 10 * Copyright 2003 ELCA Informatique SA 11 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland 12 * www.elca.ch 13 * 14 * This library is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU Lesser General Public License 16 * as published by the Free Software Foundation; either version 2.1 of 17 * the License, or (at your option) any later version. 18 * 19 * This library is distributed in the hope that it will be useful, but 20 * WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 * Lesser General Public License for more details. 23 * 24 * You should have received a copy of the GNU Lesser General Public 25 * License along with this library; if not, write to the Free Software 26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 27 * USA 28 */ 29 30 package ch.elca.dependency.report; 31 32 import ch.elca.dependency.util.StringManager; 33 34 /*** 35 * <code>ReportException</code> will be thrown in case of Exceptios in 36 * the ch.elca.dependency.report package. 37 * 38 * @author Pawel Kowalski 39 * @version 1.0-beta 40 */ 41 public class ReportException extends Exception { 42 43 /*** 44 * Exception message: <code>INVALID_ARGUMENTS</code>. 45 */ 46 public static final String INVALID_ARGUMENTS = "invalid arguments specified"; 47 48 /*** 49 * Exception message: <code>INVALID_ROOT</code>. 50 */ 51 public static final String INVALID_ROOT = "invalid root"; 52 53 /*** 54 * Exception message: <code>ANALYZE_ERROR</code>. 55 */ 56 public static final String ANALYZE_ERROR = "analyzer error"; 57 58 /*** 59 * Exception message: <code>RULES_NOT_AVAILABLE</code>. 60 */ 61 public static final String RULES_NOT_AVAILABLE = "rules file not available"; 62 63 /*** 64 * Exception message: <code>CONFIG_NOT_AVAILABLE</code>. 65 */ 66 public static final String CONFIG_NOT_AVAILABLE = "config file not available"; 67 68 /*** 69 * Exception message: <code>UNKNOWN_FAILURE</code>. 70 */ 71 public static final String UNKNOWN_FAILURE = "unknown failure"; 72 73 /*** 74 * Exception message: <code>COULD_NOT_WRITE_REPORT</code>. 75 */ 76 public static final String COULD_NOT_WRITE_REPORT = "writing report failed"; 77 78 /*** 79 * Exception message: <code>COULD_NOT_SET_HANDLER</code>. 80 */ 81 public static final String COULD_NOT_SET_HANDLER = "could not set handler"; 82 83 /*** 84 * Exception message: <code>COULD_NOT_SET_FORMATTER</code>. 85 */ 86 public static final String COULD_NOT_SET_FORMATTER = "could not set formatter"; 87 88 /*** 89 * Exception message: <code>COULD_NOT_ADD_REPORT_INFO</code>. 90 */ 91 public static final String COULD_NOT_ADD_REPORT_INFO 92 = "could not add report info"; 93 94 /*** 95 * Exception message: <code>CREATING_DEFAULT_REPORT_FAILED</code>. 96 */ 97 public static final String CREATING_DEFAULT_REPORT_FAILED 98 = "creating a default report failed"; 99 100 /*** 101 * A StringManager to access Strings 102 */ 103 private StringManager stringManager = null; 104 105 /*** 106 * A problem message associated with this ReportException. 107 */ 108 private String m_problemMessage = ""; 109 110 /*** 111 * A cause message associated with this ReportException. 112 */ 113 private String m_causeMessage = ""; 114 115 /*** 116 * The wrapped Exception 117 */ 118 private Throwable m_wrappedException = null; 119 120 //****************************************************************************************/ 121 // constructors 122 //****************************************************************************************/ 123 124 /*** 125 * Creates a new <code>ReportException</code> instance. 126 * 127 * @param problemMessage a <code>String</code> value 128 */ 129 public ReportException(String problemMessage) { 130 this(problemMessage, "", null); 131 } 132 133 /*** 134 * Creates a new <code>ReportException</code> instance. 135 * 136 * @param problemMessage a <code>String</code> value 137 * @param wrappedException a <code>Throwable</code> value 138 */ 139 public ReportException(String problemMessage, Throwable wrappedException) { 140 this(problemMessage, "", wrappedException); 141 } 142 143 /*** 144 * Creates a new <code>ReportException</code> instance. 145 * 146 * @param problemMessage a <code>String</code> value 147 * @param causeMessage a <code>String</code> value 148 */ 149 public ReportException(String problemMessage, String causeMessage) { 150 this(problemMessage, causeMessage, null); 151 } 152 153 /*** 154 * Creates a new <code>ReportException</code> instance. 155 * 156 * @param problemMessage a <code>String</code> value 157 * @param causeMessage a <code>String</code> value 158 * @param wrappedException a <code>Throwable</code> value 159 */ 160 public ReportException(String problemMessage, String causeMessage, 161 Throwable wrappedException) { 162 stringManager = StringManager.getManager(ReportException.class); 163 m_problemMessage = problemMessage; 164 m_causeMessage = causeMessage; 165 m_wrappedException = wrappedException; 166 } 167 168 //****************************************************************************************/ 169 // getters 170 //****************************************************************************************/ 171 172 /*** 173 * Get the problem message associated with this ReportException 174 * 175 * @return a <code>String</code> value 176 */ 177 public String getProblemMessage() { 178 return m_problemMessage; 179 } 180 181 /*** 182 * Get the cause message associated with this ReportException 183 * 184 * @return a <code>String</code> value 185 */ 186 public String getCauseMessage() { 187 return m_causeMessage; 188 } 189 190 /*** 191 * Get the message associated with this ReportException 192 * 193 * @return a <code>String</code> value 194 */ 195 public String getMessage() { 196 return stringManager.getString("report.exception.problem") + ": " + m_problemMessage + 197 " / " + stringManager.getString("report.exception.cause") + ": " + m_causeMessage; 198 } 199 200 /*** 201 * Get the Exception wrapped within this ReportException. 202 * 203 * @return a <code>Throwable</code> value 204 */ 205 public Throwable getWrappedException() { 206 return m_wrappedException; 207 } 208 }

This page was automatically generated by Maven