Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * @(#)AzollaException.java		Created at 2013-2-23
   * 
   * Copyright (c) 2011-2013 azolla.org All rights reserved.
   * Azolla PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 
   */
  package org.azolla.l.ling.exception;
  
 import java.util.Map;
 
 
 
The exception for Azolla

Author(s):
sk@azolla.org
Since:
ADK1.0
 
 public class AzollaException extends RuntimeException
 {
     private static final long         serialVersionUID = 6975777768178330101L;
 
     private ErrorCoder                errorCode;
     private final Map<StringObjectproperties       = Maps.newTreeMap();   //sort
 
     public AzollaException(ErrorCoder errorCode)
     {
         setErrorCode(errorCode);
     }
 
     public AzollaException(ErrorCoder errorCodeString message)
     {
         super(message);
         setErrorCode(errorCode);
     }
 
     public AzollaException(ErrorCoder errorCodeThrowable cause)
     {
         super(cause);
         setErrorCode(errorCode);
     }
 
     public AzollaException(ErrorCoder errorCodeString messageThrowable cause)
     {
         super(messagecause);
         setErrorCode(errorCode);
     }
 
     public static AzollaException wrap(Throwable cause)
     {
         return wrap(cause.);
     }
 
     public static AzollaException wrap(Throwable causeErrorCoder errorCode)
     {
         if(cause instanceof AzollaException)
         {
             AzollaException se = (AzollaExceptioncause;
             ErrorCoder currentErrorCoder = se.getErrorCode();
 
             return errorCode != currentErrorCoder ? new AzollaException(errorCodecause) : se;
         }
         return new AzollaException(errorCodecause);
     }
 
     @Override
     public void printStackTrace(PrintStream s)
     {
         synchronized(s)
         {
             s.println(this);
 
             s.println();
             s.println("\t--------Azolla Exception Properties--------");
             if( != null)
             {
                 s.println("\t" +  + ":" + .getClass().getName());
             }
             for(Map.Entry<StringObjectentry : .entrySet())
             {
                 s.println("\t" + entry.getKey() + "=[" + entry.getValue() + "]");
             }
             s.println("\t-------------------------------------------");
             s.println();
 
             StackTraceElement[] trace = getStackTrace();
             for(int i = 0; i < trace.lengthi++)
             {
                 s.println("\tat " + trace[i]);
             }
 
             Throwable ourCause = getCause();
            if(ourCause != null)
            {
                ourCause.printStackTrace(s);
            }
            s.flush();
        }
    }
    @Override
    public void printStackTrace(PrintWriter s)
    {
        synchronized(s)
        {
            s.println(this);
            s.println();
            s.println("\t--------Azolla Exception Properties--------");
            if( != null)
            {
                s.println("\t" +  + ":" + .getClass().getName());
            }
            for(Map.Entry<StringObjectentry : .entrySet())
            {
                s.println("\t" + entry.getKey() + "=[" + entry.getValue() + "]");
            }
            s.println("\t-------------------------------------------");
            s.println();
            StackTraceElement[] trace = getStackTrace();
            for(int i = 0; i < trace.lengthi++)
            {
                s.println("\tat " + trace[i]);
            }
            Throwable ourCause = getCause();
            if(ourCause != null)
            {
                ourCause.printStackTrace(s);
            }
            s.flush();
        }
    }
    public Object get(String key)
    {
        return .get(key);
    }
    public AzollaException set(String keyObject value)
    {
        .put(keyvalue);
        return this;
    }
    public ErrorCoder getErrorCode()
    {
        return  = null ==  ? . : ;
    }
    public void setErrorCode(@Nullable ErrorCoder errorCode)
    {
        this. = null == errorCode ? . : errorCode;
    }
    public Map<StringObjectgetProperties()
    {
        return ;
    }
New to GrepCode? Check out our FAQ X