Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 82   Methods: 5
NCLOC: 29   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ValidatorException.java - 85.7% 80% 83.3%
coverage coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.valid;
 16   
 
 17   
 import org.apache.tapestry.IRender;
 18   
 
 19   
 /**
 20   
  * Thrown by a {@link IValidator}when submitted input is not valid.
 21   
  * 
 22   
  * @author Howard Lewis Ship
 23   
  * @since 1.0.8
 24   
  */
 25   
 
 26   
 public class ValidatorException extends Exception
 27   
 {
 28   
     private IRender _errorRenderer;
 29   
 
 30   
     private ValidationConstraint _constraint;
 31   
 
 32  0
     public ValidatorException(String errorMessage)
 33   
     {
 34  0
         this(errorMessage, null, null);
 35   
     }
 36   
 
 37  40
     public ValidatorException(String errorMessage, ValidationConstraint constraint)
 38   
     {
 39  40
         this(errorMessage, null, constraint);
 40   
     }
 41   
 
 42   
     /**
 43   
      * Creates a new instance.
 44   
      * 
 45   
      * @param errorMessage
 46   
      *            the default error message to be used (this may be overriden by the
 47   
      *            {@link IValidationDelegate})
 48   
      * @param errorRenderer
 49   
      *            to use to render the error message (may be null). This is used with custom
 50   
      *            validators that create renderers that produce rich markup (such as icons or links
 51   
      *            to help pages). Such renderes are expected to implement a <code>toString()</code>
 52   
      *            that returns a simple error message (without any markup).
 53   
      * @param constraint
 54   
      *            a validation constraint that has been compromised, or null if no constraint is
 55   
      *            applicable
 56   
      */
 57   
 
 58  41
     public ValidatorException(String errorMessage, IRender errorRenderer,
 59   
             ValidationConstraint constraint)
 60   
     {
 61  41
         super(errorMessage);
 62   
 
 63  41
         _errorRenderer = errorRenderer;
 64  41
         _constraint = constraint;
 65   
     }
 66   
 
 67  32
     public ValidationConstraint getConstraint()
 68   
     {
 69  32
         return _constraint;
 70   
     }
 71   
 
 72   
     /**
 73   
      * Returns the error renderer for this exception, which may be null.
 74   
      * 
 75   
      * @since 3.0 *
 76   
      */
 77   
 
 78  9
     public IRender getErrorRenderer()
 79   
     {
 80  9
         return _errorRenderer;
 81   
     }
 82   
 }