Clover coverage report - Code Coverage for tapestry release 4.0-beta-2
Coverage timestamp: Sat Jul 9 2005 22:02:17 EDT
file stats: LOC: 82   Methods: 5
NCLOC: 29   Classes: 1
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover
 
 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 IRender _errorRenderer;
 29   
 30    private ValidationConstraint _constraint;
 31   
 32  2 public ValidatorException(String errorMessage)
 33    {
 34  2 this(errorMessage, null, null);
 35    }
 36   
 37  61 public ValidatorException(String errorMessage, ValidationConstraint constraint)
 38    {
 39  61 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  64 public ValidatorException(String errorMessage, IRender errorRenderer,
 59    ValidationConstraint constraint)
 60    {
 61  64 super(errorMessage);
 62   
 63  64 _errorRenderer = errorRenderer;
 64  64 _constraint = constraint;
 65    }
 66   
 67  52 public ValidationConstraint getConstraint()
 68    {
 69  52 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  8 public IRender getErrorRenderer()
 79    {
 80  8 return _errorRenderer;
 81    }
 82    }