You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by to...@apache.org on 2005/12/22 22:15:14 UTC

cvs commit: db-ojb/src/java/org/apache/ojb/broker PersistenceBrokerException.java

tomdz       2005/12/22 13:15:14

  Modified:    src/java/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        PersistenceBrokerException.java
  Log:
  Removed old, unnecessary base exception handling
  Updated Javadoc
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.9.2.2   +26 -93    db-ojb/src/java/org/apache/ojb/broker/PersistenceBrokerException.java
  
  Index: PersistenceBrokerException.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/PersistenceBrokerException.java,v
  retrieving revision 1.9.2.1
  retrieving revision 1.9.2.2
  diff -u -r1.9.2.1 -r1.9.2.2
  --- PersistenceBrokerException.java	21 Dec 2005 22:22:08 -0000	1.9.2.1
  +++ PersistenceBrokerException.java	22 Dec 2005 21:15:14 -0000	1.9.2.2
  @@ -15,25 +15,16 @@
    * limitations under the License.
    */
   
  -import java.lang.reflect.Method;
  -
   /**
  - * The Base Exception for all Exceptions that can happend within ObjectRelationalBridge.
  + * Base class for exceptions happening during persistence broker operations.
    *
  - * @author <a href="mailto:thomas.mahler@itellium.com">Thomas Mahler<a>
  + * @author Thomas Mahler
    * @version $Id$
    */
   public class PersistenceBrokerException extends OJBRuntimeException
   {
       /**
  -     * The cause of this Exception.
  -     */
  -    private Throwable sourceException = null;
  -
  -    /**
  -     *
  -     * PersistenceBrokerException constructor comment.
  -     *
  +     * Creates a new exception instance.
        */
       public PersistenceBrokerException()
       {
  @@ -41,102 +32,44 @@
       }
   
       /**
  -     * Constructs a new PersistenceBrokerException with the specified detail message.
  -     *
  -     * @param   message   the detail message. The detail message is saved for
  -     *          later retrieval by the {@link #getMessage()} method.
  +     * Creates a new exception instance.
  +     * 
  +     * @param msg The exception message
        */
  -    public PersistenceBrokerException(String message)
  -    {
  -        super(message);
  -    }
  -
  -    public PersistenceBrokerException(String message, Throwable cause)
  +    public PersistenceBrokerException(String msg)
       {
  -        super(message, cause);
  -        setSourceException(cause);
  +        super(msg);
       }
   
       /**
  -     *
  -     * PersistenceBrokerException constructor comment.
  -     *
  -     * @param cause The cause of this Exception
  -     *
  +     * Creates a new exception instance.
  +     * 
  +     * @param cause The base exception
        */
       public PersistenceBrokerException(Throwable cause)
       {
           super(cause);
  -        setSourceException(cause);
       }
   
       /**
  -     * Gets the sourceException.
  -     * @return Returns a Throwable
  +     * Creates a new exception instance.
  +     * 
  +     * @param msg   The exception message
  +     * @param cause The base exception
        */
  -    public Throwable getSourceException()
  +    public PersistenceBrokerException(String msg, Throwable cause)
       {
  -        Method getCause = null;
  -        try
  -        {
  -            getCause = getClass().getMethod("getCause", new Class[]{});
  -        }
  -        catch (NoSuchMethodException e)
  -        {
  -            //ignore it
  -        }
  -        catch (SecurityException e)
  -        {
  -            //ignore it
  -        }
  -
  -        if (getCause != null)
  -        {
  -            try
  -            {
  -                return (Throwable) getCause.invoke(this, new Object[]{});
  -            }
  -            catch (Throwable e)
  -            {
  -                return sourceException;
  -            }
  -        }
  -        else
  -        {
  -            return sourceException;
  -        }
  +        super(msg, cause);
       }
   
  -    private void setSourceException(Throwable cause)
  +    /**
  +     * Gets the original exception if any.
  +     * 
  +     * @return The source exception
  +     * @deprecated Use {@link #getCause()} instead
  +     */
  +    public Throwable getSourceException()
       {
  -        Method initCause = null;
  -        try
  -        {
  -            initCause = getClass().getMethod("initCause", new Class[]{Throwable.class});
  -        }
  -        catch (NoSuchMethodException e)
  -        {
  -            //ignore it
  -        }
  -        catch (SecurityException e)
  -        {
  -            //ignore it
  -        }
  -
  -        if (initCause != null)
  -        {
  -            try
  -            {
  -                initCause.invoke(this, new Object[]{cause});
  -            }
  -            catch (Throwable e)
  -            {
  -                sourceException = cause;
  -            }
  -        }
  -        else
  -        {
  -            sourceException = cause;
  -        }
  +        return getCause();
       }
   }
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org