1 45 package org.openejb.util; 46 47 import java.io.ByteArrayOutputStream ; 48 import java.io.PrintWriter ; 49 50 import org.openejb.OpenEJBException; 51 52 53 public class OpenEJBErrorHandler { 54 55 private static Logger _logger = Logger.getInstance( "OpenEJB", "org.openejb.util.resources" ); 56 private static Messages _messages = new Messages( "org.openejb.util.resources" ); 57 58 87 public static void handleUnknownError(Throwable error, String systemLocation){ 88 89 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 91 PrintWriter pw = new PrintWriter (baos); 92 error.printStackTrace(pw); 93 pw.flush(); 94 pw.close(); 95 97 _logger.i18n.error("ge0001", systemLocation, new String (baos.toByteArray())); 98 99 103 } 104 105 113 public static void propertiesObjectIsNull(String systemLocation) throws OpenEJBException{ 114 115 throw new OpenEJBException( _messages.format( "ge0002", systemLocation ) ); 116 } 117 118 128 public static void propertyFileNotFound(String propertyfileName, String systemLocation) throws OpenEJBException{ 129 130 throw new OpenEJBException( _messages.format( "ge0003", propertyfileName, systemLocation ) ); 131 } 132 133 143 public static void propertyNotFound(String propertyName, String propertyfileName) throws OpenEJBException{ 144 145 throw new OpenEJBException( _messages.format( "ge0004", propertyName, propertyfileName ) ); 146 } 147 148 158 public static void propertyValueIsIllegal(String propertyName, String value) throws OpenEJBException{ 159 160 throw new OpenEJBException( _messages.format( "ge0005", propertyName, value ) ); 161 } 162 163 175 public static void propertyValueIsIllegal(String propertyName, String value, String message) throws OpenEJBException{ 176 177 throw new OpenEJBException( _messages.format( "ge0006", propertyName, value, message ) ); 178 } 179 180 190 public static void classNotFound(String systemLocation, String className) throws OpenEJBException{ 191 192 throw new OpenEJBException( _messages.format( "ge0007", systemLocation, className ) ); 193 } 194 195 205 public static void classNotAccessible(String systemLocation, String className) throws OpenEJBException{ 206 207 throw new OpenEJBException( _messages.format( "ge0008", systemLocation, className ) ); 208 } 209 210 220 public static void classNotIntantiateable(String systemLocation, String className) throws OpenEJBException{ 221 222 throw new OpenEJBException( _messages.format( "ge0009", systemLocation, className ) ); 223 } 224 225 239 public static void classNotIntantiateableForUnknownReason(String systemLocation, String className, String exceptionClassName, String message) throws OpenEJBException{ 240 241 throw new OpenEJBException( _messages.format( "ge0011", systemLocation, className, exceptionClassName, message ) ); 242 } 243 244 260 public static void classNotIntantiateableFromCodebaseForUnknownReason(String systemLocation, String className, String codebase, String exceptionClassName, String message) 261 throws OpenEJBException 262 { 263 throw new OpenEJBException( _messages.format( "ge0012", systemLocation, className, codebase, exceptionClassName, message ) ); 264 } 265 266 279 public static void classCodebaseNotFound(String systemLocation, String className, String codebase, Exception e) throws OpenEJBException{ 280 281 throw new OpenEJBException( _messages.format( "ge0010", systemLocation, className, codebase, e.getMessage() ) ); 282 } 283 284 299 public static void configurationParsingError(String messageType, String message, String line, String column){ 300 301 _logger.i18n.error( "as0001", messageType, message, line, column ); 302 306 } 307 308 } 309 | Popular Tags |