1 16 17 package org.apache.axis; 18 19 import org.apache.axis.components.logger.LogFactory; 20 import org.apache.axis.utils.JavaUtils; 21 import org.apache.commons.logging.Log; 22 23 import java.io.IOException ; 24 25 31 public class ConfigurationException extends IOException { 32 33 36 private Exception containedException=null; 37 38 private String stackTrace=""; 39 40 43 protected static boolean copyStackByDefault= true; 44 45 48 protected static Log log = 49 LogFactory.getLog(ConfigurationException.class.getName()); 50 51 56 public ConfigurationException(String message) { 57 super(message); 58 if(copyStackByDefault) { 59 stackTrace= JavaUtils.stackToString(this); 60 } 61 logException( this); 62 } 63 64 68 public ConfigurationException(Exception exception) { 69 this(exception,copyStackByDefault); 70 } 71 72 77 public String toString() { 78 String stack; 79 if(stackTrace.length()== 0) { 80 stack = ""; 81 } else { 82 stack="\n"+stackTrace; 83 } 84 return super.toString()+stack; 85 } 86 87 92 public ConfigurationException(Exception exception, final boolean copyStack) { 93 super(exception.toString() + (copyStack ? "\n" 94 + JavaUtils.stackToString(exception) : "" )); 95 containedException = exception; 96 if(copyStack) { 97 stackTrace = JavaUtils.stackToString(this); 98 } 99 if (!(exception instanceof ConfigurationException)) { 101 logException(exception); 102 } 103 } 104 105 109 private void logException(Exception exception) { 110 log.debug("Exception: ", exception); 111 } 112 113 119 public Exception getContainedException() { 120 return containedException; 121 } 122 } 123 | Popular Tags |