Coverage Report - org.apache.maven.wagon.WagonException
 
Classes in this File Line Coverage Branch Coverage Complexity
WagonException
100 %
8/8
N/A
1
 
 1  
 package org.apache.maven.wagon;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 /**
 23  
  * Root class for all exception in Wagon API
 24  
  *
 25  
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
 26  
  * @version $Id: WagonException.java 682051 2008-08-02 21:29:38Z hboutemy $
 27  
  */
 28  
 public abstract class WagonException
 29  
     extends Exception
 30  
 {
 31  
     /**
 32  
      * the throwable that caused this exception to get thrown
 33  
      */
 34  
     private Throwable cause;
 35  
 
 36  
 
 37  
     /**
 38  
      * Constructs a new WagonException with the specified detail message.
 39  
      * The cause is not initialized, and may subsequently be initialized by a call to initCause
 40  
      *
 41  
      * @param message - the detail message (which is saved for later retrieval by the getMessage() method).
 42  
      * @param cause   - the cause (which is saved for later retrieval by the getCause() method).
 43  
      *                (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
 44  
      */
 45  
     public WagonException( final String message, final Throwable cause )
 46  
     {
 47  8
         super( message );
 48  8
         initCause( cause );
 49  8
     }
 50  
 
 51  
     /**
 52  
      * Constructs a new WagonException with the specified detail message and cause.
 53  
      *
 54  
      * @param message - the detail message (which is saved for later retrieval by the getMessage() method).
 55  
      */
 56  
     public WagonException( final String message )
 57  
     {
 58  20
         super( message );
 59  20
     }
 60  
 
 61  
     /**
 62  
      * Returns the cause of this throwable or null if the cause is nonexistent or unknown.
 63  
      * (The cause is the throwable that caused this exception to get thrown.)
 64  
      *
 65  
      * @return the cause of this exception or null if the cause is nonexistent or unknown.
 66  
      */
 67  
     public Throwable getCause()
 68  
     {
 69  
 //        try
 70  
 //        {
 71  
 //           Class clazz = getClass().getSuperclass();
 72  
 //           
 73  
 //           Method method = clazz.getMethod( "gatCause" , null );
 74  
 //           
 75  
 //           Throwable retValue = (Throwable) method.invoke( this, null );
 76  
 //         return retValue;
 77  
 //        }   
 78  
 //        catch( Exception e)
 79  
 //        {
 80  
 //        
 81  
 //        }
 82  
         
 83  5
         return cause;
 84  
     }
 85  
 
 86  
 
 87  
     /**
 88  
      * Initializes the cause of this throwable to the specified value.
 89  
      * (The cause is the throwable that caused this throwable to get thrown.)
 90  
      * This method can be called at most once.
 91  
      * It is generally called from within the constructor, or immediately after creating the throwable.
 92  
      * If this throwable was created with WagonException(Throwable) or WagonException(String,Throwable),
 93  
      * this method cannot be called even once.
 94  
      *
 95  
      * @return a reference to this Throwable instance.
 96  
      */
 97  
     public Throwable initCause( final Throwable cause )
 98  
     {
 99  
 //        try
 100  
 //        {
 101  
 //           Class clazz = getClass().getSuperclass();
 102  
 //           Class[] parameterTypes = new Class[1];
 103  
 //           parameterTypes[0] = Throwable.class;
 104  
 //           Method method = clazz.getMethod( "initCause" , parameterTypes);
 105  
 //           Object[] params = { cause };
 106  
 //           method.invoke( this, params );
 107  
 //        }   
 108  
 //        catch( Exception e)
 109  
 //        {
 110  
 //        
 111  
 //        }        
 112  8
         this.cause = cause;
 113  8
         return this;
 114  
     }
 115  
 
 116  
 }