Coverage Report - org.kuali.student.r2.common.exceptions.DataValidationErrorException
 
Classes in this File Line Coverage Branch Coverage Complexity
DataValidationErrorException
0%
0/31
0%
0/4
1.182
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation 
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the
 5  
  * "License"); you may not use this file except in compliance with the
 6  
  * License. You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.osedu.org/licenses/ECL-2.0
 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
 13  
  * implied. See the License for the specific language governing
 14  
  * permissions and limitations under the License.
 15  
  */
 16  
 
 17  
 package org.kuali.student.r2.common.exceptions;
 18  
 
 19  
 import java.io.PrintStream;
 20  
 import java.io.PrintWriter;
 21  
 import java.util.List;
 22  
 
 23  
 import javax.xml.ws.WebFault;
 24  
 
 25  
 import org.apache.log4j.Logger;
 26  
 import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
 27  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 28  
 
 29  
 @WebFault(faultBean="org.kuali.student.r2.common.exceptions.jaxws.DataValidationErrorExceptionBean")
 30  
 public class DataValidationErrorException 
 31  
     extends Exception {
 32  
 
 33  0
     private static final Logger LOG = Logger.getLogger(DataValidationErrorException.class);
 34  
     
 35  
     private static final long serialVersionUID = 1L;
 36  
     
 37  
     private List<ValidationResultInfo> validationResults;
 38  
     
 39  
 
 40  0
     public DataValidationErrorException() {
 41  0
     }
 42  
     
 43  
     public DataValidationErrorException(String message, List<ValidationResultInfo> validationResults) {
 44  0
         this(message, validationResults, null);
 45  0
     }
 46  
 
 47  
     public DataValidationErrorException(String message, List<ValidationResultInfo> validationResults, Throwable cause) {
 48  0
         super(message, cause);
 49  0
         this.validationResults = validationResults;
 50  0
     }
 51  
 
 52  
     public DataValidationErrorException(String message, Throwable cause) {
 53  0
         super(message, cause);
 54  0
     }
 55  
 
 56  
     public DataValidationErrorException(String message) {
 57  0
         super(message);
 58  0
     }
 59  
 
 60  
     public DataValidationErrorException(Throwable cause) {
 61  0
         super(cause);
 62  0
     }
 63  
 
 64  
     public List<ValidationResultInfo> getValidationResults() {
 65  0
         return validationResults;
 66  
     }
 67  
 
 68  
     @Override
 69  
     public void printStackTrace(PrintStream s) {
 70  0
         super.printStackTrace(s);
 71  0
         logValidationResults();
 72  0
     }
 73  
     
 74  
     @Override
 75  
     public void printStackTrace(PrintWriter s) {
 76  0
         super.printStackTrace(s);
 77  0
         logValidationResults();
 78  0
     }
 79  
     
 80  
     @Override
 81  
     public String toString() {
 82  0
         StringBuilder sb = new StringBuilder();
 83  0
         sb.append(super.getMessage()).append("\n");
 84  
 
 85  0
         if (validationResults != null) {
 86  0
             sb.append("Validation Results: \n");
 87  0
             for (ValidationResultInfo info:validationResults) {
 88  0
                 sb.append(info).append("\n");
 89  
             }
 90  
         } else {
 91  0
             sb.append("Validation Results: None set.");
 92  
         }
 93  0
         return sb.toString();
 94  
     }
 95  
     
 96  
     private void logValidationResults() {
 97  0
         LOG.debug(toString());        
 98  0
     }
 99  
 }