You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/08/23 04:44:43 UTC

cvs commit: jakarta-avalon/src/java/org/apache/avalon/framework/component ComponentException.java

leif        2002/08/22 19:44:43

  Modified:    src/java/org/apache/avalon/framework/component
                        ComponentException.java
  Log:
  Override the getMessage method so that the rolw will be displayed if available.
  
  Revision  Changes    Path
  1.10      +22 -0     jakarta-avalon/src/java/org/apache/avalon/framework/component/ComponentException.java
  
  Index: ComponentException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/component/ComponentException.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ComponentException.java	5 Aug 2002 13:23:56 -0000	1.9
  +++ ComponentException.java	23 Aug 2002 02:44:43 -0000	1.10
  @@ -69,8 +69,30 @@
           this( role, message, null );
       }
   
  +    /**
  +     * Get the role which let to the exception.  May be null.
  +     *
  +     * @return The role which let to the exception.
  +     */
       public final String getRole()
       {
           return m_role;
  +    }
  +    
  +    /**
  +     * Return a message describing the exception.
  +     *
  +     * @return exception message.
  +     */
  +    public String getMessage()
  +    {
  +        if ( m_role == null )
  +        {
  +            return super.getMessage();
  +        }
  +        else
  +        {
  +            return super.getMessage() + " (role [" + m_role + "])";
  +        }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>