Coverage Report - org.kuali.rice.core.web.format.FormatException
 
Classes in this File Line Coverage Branch Coverage Complexity
FormatException
0%
0/19
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 // begin Kuali Foundation modification
 17  
 package org.kuali.rice.core.web.format;
 18  
 // end Kuali Foundation modification
 19  
 
 20  
 import org.kuali.rice.core.api.util.RiceKeyConstants;
 21  
 
 22  
 /**
 23  
  * begin Kuali Foundation modification
 24  
  * javadoc changed
 25  
  * This class is used to format Exception messages.
 26  
  * end Kuali Foundation modification
 27  
  */
 28  
 public class FormatException extends RuntimeException {
 29  
     private static final long serialVersionUID = 6679793710457672426L;
 30  
     
 31  
     // begin Kuali Foundation modification
 32  
     // removed member variables: cause, formatter
 33  
     // added the following
 34  
     private String formatProperty;
 35  
     private Object formatValue;
 36  
     private final String errorKey;
 37  
     private final String[] errorArgs;
 38  
     // end Kuali Foundation modification
 39  
 
 40  
         // begin Kuali Foundation modification
 41  
         // removed public FormatException(Formatter formatter)
 42  
         // end Kuali Foundation modification
 43  
         
 44  
     public FormatException(String message) {
 45  
         // begin Kuali Foundation modification
 46  
         // orig code: this(message, null);
 47  0
         this(message, RiceKeyConstants.ERROR_CUSTOM, message);
 48  
         // end Kuali Foundation modification
 49  0
     }
 50  
 
 51  
     public FormatException(String message, Throwable cause) {
 52  
         // begin Kuali Foundation modification
 53  
         /* orig code: 
 54  
                 super(message);
 55  
         this.cause = cause;
 56  
                 */
 57  0
         this(message, RiceKeyConstants.ERROR_CUSTOM, message, cause);
 58  
         // end Kuali Foundation modification
 59  0
     }
 60  
 
 61  
     // begin Kuali Foundation modification
 62  
     // removed getCause(), getFormatter, printStackTrace, setCause(Throwable), setFormatter
 63  
     // added thse methods
 64  
     public FormatException(String message, String errorKey, String errorArg) {
 65  0
         super(message + ", " + errorKey + "[" + errorArg + "]");
 66  0
         this.errorKey = errorKey;
 67  0
         this.errorArgs = new String[] { errorArg };
 68  0
     }
 69  
 
 70  
     public FormatException(String message, String errorKey, String errorArg, Throwable cause) {
 71  0
         this(message, errorKey, errorArg);
 72  0
         initCause(cause);
 73  0
     }
 74  
 
 75  
     /**
 76  
      * @return Returns the formatProperty.
 77  
      */
 78  
     public String getFormatProperty() {
 79  0
         return formatProperty;
 80  
     }
 81  
 
 82  
     /**
 83  
      * @param formatProperty The formatProperty to set.
 84  
      */
 85  
     public void setFormatProperty(String formatProperty) {
 86  0
         this.formatProperty = formatProperty;
 87  0
     }
 88  
 
 89  
     /**
 90  
      * @return Returns the formatValue.
 91  
      */
 92  
     public Object getFormatValue() {
 93  0
         return formatValue;
 94  
     }
 95  
 
 96  
     /**
 97  
      * @param formatValue The formatValue to set.
 98  
      */
 99  
     public void setFormatValue(Object formatValue) {
 100  0
         this.formatValue = formatValue;
 101  0
     }
 102  
 
 103  
     /**
 104  
      * @return the error key for use in the global error map.
 105  
      */
 106  
     public String getErrorKey() {
 107  0
         return errorKey;
 108  
     }
 109  
 
 110  
     /**
 111  
      * @return the array of arguments for the keyed error message.
 112  
      */
 113  
     public String[] getErrorArgs() {
 114  0
         return errorArgs;
 115  
     }
 116  
     // end Kuali Foundation modification
 117  
 }