Coverage report

  %line %branch
nl.toolforge.karma.core.vc.VersionControlException
59% 
88% 

 1  
 /*
 2  
 Karma core - Core of the Karma application
 3  
 Copyright (C) 2004  Toolforge <www.toolforge.nl>
 4  
 
 5  
 This library is free software; you can redistribute it and/or
 6  
 modify it under the terms of the GNU Lesser General Public
 7  
 License as published by the Free Software Foundation; either
 8  
 version 2.1 of the License, or (at your option) any later version.
 9  
 
 10  
 This library is distributed in the hope that it will be useful,
 11  
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
 Lesser General Public License for more details.
 14  
 
 15  
 You should have received a copy of the GNU Lesser General Public
 16  
 License along with this library; if not, write to the Free Software
 17  
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  
 */
 19  
 package nl.toolforge.karma.core.vc;
 20  
 
 21  
 import nl.toolforge.karma.core.ErrorCode;
 22  
 
 23  
 /**
 24  
  * Root exception for stuff relating to version control system functionality.
 25  
  *
 26  
  * @author D.A. Smedes
 27  
  * @version $Id: VersionControlException.java,v 1.19 2004/11/02 22:26:44 asmedes Exp $
 28  
  */
 29  
 public abstract class VersionControlException extends Exception {
 30  
 
 31  112
   private ErrorCode errorCode = null;
 32  112
   private Object[] messageArguments = null;
 33  120
 
 34  168
   public static String EXCEPTION_PREFIX = "VER-";
 35  
   /** Version already exists for this module. */
 36  88
   public static final ErrorCode DUPLICATE_VERSION = new ErrorCode(EXCEPTION_PREFIX + "00001");
 37  
   /** The requested module does not exist in the repository */
 38  48
   public static final ErrorCode MODULE_NOT_IN_REPOSITORY = new ErrorCode(EXCEPTION_PREFIX + "00002");
 39  
   /** A <code>Location</code> instance was required, but missing. */
 40  88
   public static final ErrorCode MISSING_LOCATION = new ErrorCode(EXCEPTION_PREFIX + "00003");;
 41  
 
 42  
 
 43  
   public VersionControlException(ErrorCode errorCode) {
 44  56
     this(errorCode, null);
 45  16
   }
 46  
 
 47  
   public VersionControlException(Throwable t, ErrorCode errorCode) {
 48  10
     this(t, errorCode, null);
 49  10
   }
 50  
 
 51  
   public VersionControlException(ErrorCode errorCode, Object[] messageArguments) {
 52  112
     super();
 53  112
     this.errorCode = errorCode;
 54  112
     this.messageArguments = messageArguments;
 55  112
   }
 56  120
   
 57  120
   public VersionControlException(Throwable t, ErrorCode errorCode, Object[] messageArguments) {
 58  120
     super(t);
 59  120
     this.errorCode = errorCode;
 60  0
     this.messageArguments = messageArguments;
 61  0
   }
 62  
 
 63  
   public String getMessage() {
 64  0
     if (messageArguments != null && messageArguments.length > 0) {
 65  0
       errorCode.setMessageArguments(messageArguments);
 66  
     }
 67  0
     return getErrorCode().getErrorMessage();
 68  
   }
 69  
 
 70  
   /**
 71  
    * Gets the exceptions' {@link nl.toolforge.karma.core.ErrorCode}.
 72  
    * @return
 73  
    */
 74  
   public final ErrorCode getErrorCode() {
 75  0
     return errorCode;
 76  
   }
 77  
 
 78  
   public final Object[] getMessageArguments() {
 79  0
     return messageArguments;
 80  
   }
 81  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.