rineholt    02/05/17 17:20:48

  Modified:    java/src/org/apache/axis ConfigurationException.java
  Log:
  Save the real location of the error.
  
  Revision  Changes    Path
  1.5       +30 -1     xml-axis/java/src/org/apache/axis/ConfigurationException.java
  
  Index: ConfigurationException.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ConfigurationException.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigurationException.java       22 Feb 2002 23:39:42 -0000      1.4
  +++ ConfigurationException.java       18 May 2002 00:20:48 -0000      1.5
  @@ -70,6 +70,11 @@
    */
   public class ConfigurationException extends IOException {
   
  +    /**
  +     * Copy the orginal execption by default
  +     */
  +    protected static boolean copyStackByDefault= true;
  +
       protected static Log log =
           LogFactory.getLog(ConfigurationException.class.getName());
   
  @@ -87,11 +92,35 @@
        * @param exception original exception which was unexpected
        */
       public ConfigurationException(Exception e) {
  -        super(e.toString());
  +        super(e.toString()  + (copyStackByDefault? ("\n"
  +           + stackToString(e)) : "" ));
  +
  +        // Log the exception the first time it appears.
  +        if (!(e instanceof ConfigurationException)) {
  +            log.debug("Exception: ", e);
  +        }
  +    }
  +
  +    /**
  +     * Construct a ConfigurationException from an Exception.
  +     * @param exception original exception which was unexpected
  +     * @param copyStack set to true to copy the orginal exception's stack
  +     */
  +    public ConfigurationException(Exception e, final boolean copyStack) {
  +        super(e.toString()  + (copyStack ? "\n"
  +           + stackToString(e) : "" ));
   
           // Log the exception the first time it appears.
           if (!(e instanceof ConfigurationException)) {
               log.debug("Exception: ", e);
           }
  +    }
  +
  +    protected static String stackToString(Exception e){
  +      java.io.StringWriter sw= new java.io.StringWriter(1024); 
  +      java.io.PrintWriter pw= new java.io.PrintWriter(sw); 
  +      e.printStackTrace(pw);
  +      pw.close();
  +      return sw.toString();
       }
   }
  
  
  


Reply via email to