1 55 56 package org.jboss.axis; 57 58 import org.jboss.axis.utils.JavaUtils; 59 import org.jboss.logging.Logger; 60 61 import java.io.IOException ; 62 63 69 public class ConfigurationException extends IOException 70 { 71 72 75 private Exception containedException = null; 76 77 private String stackTrace = ""; 78 79 82 protected static boolean copyStackByDefault = true; 83 84 private static Logger log = Logger.getLogger(ConfigurationException.class.getName()); 85 86 92 public ConfigurationException(String message) 93 { 94 super(message); 95 if (copyStackByDefault) 96 { 97 stackTrace = JavaUtils.stackToString(this); 98 } 99 logException(this); 100 } 101 102 107 public ConfigurationException(Exception exception) 108 { 109 this(exception, copyStackByDefault); 110 } 111 112 117 public String toString() 118 { 119 String stack; 120 if (stackTrace.length() == 0) 121 { 122 stack = ""; 123 } 124 else 125 { 126 stack = "\n" + stackTrace; 127 } 128 return super.toString() + stack; 129 } 130 131 137 public ConfigurationException(Exception exception, final boolean copyStack) 138 { 139 super(exception.toString() + (copyStack ? "\n" 140 + JavaUtils.stackToString(exception) : "")); 141 containedException = exception; 142 if (copyStack) 143 { 144 stackTrace = JavaUtils.stackToString(this); 145 } 146 if (!(exception instanceof ConfigurationException)) 148 { 149 logException(exception); 150 } 151 } 152 153 158 private void logException(Exception exception) 159 { 160 log.debug("Exception: ", exception); 161 } 162 163 169 public Exception getContainedException() 170 { 171 return containedException; 172 } 173 } 174 | Popular Tags |