Clover coverage report - Code Coverage for tapestry release 4.0.2
Coverage timestamp: Thu Apr 13 2006 10:52:06 EDT
file stats: LOC: 84   Methods: 5
NCLOC: 30   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ValidatorException.java - 100% 100% 100%
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 static final long serialVersionUID = 2451683137746501377L;
 29   
 30    private IRender _errorRenderer;
 31   
 32    private ValidationConstraint _constraint;
 33   
 34  7 public ValidatorException(String errorMessage)
 35    {
 36  7 this(errorMessage, null, null);
 37    }
 38   
 39  62 public ValidatorException(String errorMessage, ValidationConstraint constraint)
 40    {
 41  62 this(errorMessage, null, constraint);
 42    }
 43   
 44    /**
 45    * Creates a new instance.
 46    *
 47    * @param errorMessage
 48    * the default error message to be used (this may be overriden by the
 49    * {@link IValidationDelegate})
 50    * @param errorRenderer
 51    * to use to render the error message (may be null). This is used with custom
 52    * validators that create renderers that produce rich markup (such as icons or links
 53    * to help pages). Such renderes are expected to implement a <code>toString()</code>
 54    * that returns a simple error message (without any markup).
 55    * @param constraint
 56    * a validation constraint that has been compromised, or null if no constraint is
 57    * applicable
 58    */
 59   
 60  70 public ValidatorException(String errorMessage, IRender errorRenderer,
 61    ValidationConstraint constraint)
 62    {
 63  70 super(errorMessage);
 64   
 65  70 _errorRenderer = errorRenderer;
 66  70 _constraint = constraint;
 67    }
 68   
 69  54 public ValidationConstraint getConstraint()
 70    {
 71  54 return _constraint;
 72    }
 73   
 74    /**
 75    * Returns the error renderer for this exception, which may be null.
 76    *
 77    * @since 3.0 *
 78    */
 79   
 80  8 public IRender getErrorRenderer()
 81    {
 82  8 return _errorRenderer;
 83    }
 84    }