1 package org.apache.maven.enforcer.rule.api; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 /** 23 * An exception occurring during the execution of a rule. Based off of 24 * EnforcerRuleException, but separated to keep the rule dependencies to a 25 * minimum. 26 * 27 * @author <a href="mailto:brianf@apache.org">Brian Fox</a> 28 */ 29 public class EnforcerRuleException 30 extends Exception 31 { 32 33 /** serialVersionUID. */ 34 private static final long serialVersionUID = 1L; 35 36 /** The source. */ 37 protected Object source; 38 39 /** The long message. */ 40 protected String longMessage; 41 42 /** 43 * Gets the long message. 44 * 45 * @return the long message 46 */ 47 public String getLongMessage() 48 { 49 return longMessage; 50 } 51 52 /** 53 * Gets the source. 54 * 55 * @return the source 56 */ 57 public Object getSource() 58 { 59 return source; 60 } 61 62 /** 63 * Construct a new <code>EnforcerRuleException</code> exception providing 64 * the source and a short and long message. 65 * 66 * @param source the source 67 * @param shortMessage the short message 68 * @param longMessage the long message 69 */ 70 public EnforcerRuleException( Object source, String shortMessage, String longMessage ) 71 { 72 super( shortMessage ); 73 this.source = source; 74 this.longMessage = longMessage; 75 } 76 77 /** 78 * Construct a new <code>EnforcerRuleException</code> exception wrapping 79 * an underlying <code>Exception</code> and providing a 80 * <code>message</code>. 81 * 82 * @param message the message 83 * @param cause the cause 84 */ 85 public EnforcerRuleException( String message, Exception cause ) 86 { 87 super( message, cause ); 88 } 89 90 /** 91 * Construct a new <code>EnforcerRuleException</code> exception wrapping 92 * an underlying <code>Throwable</code> and providing a 93 * <code>message</code>. 94 * 95 * @param message the message 96 * @param cause the cause 97 */ 98 public EnforcerRuleException( String message, Throwable cause ) 99 { 100 super( message, cause ); 101 } 102 103 /** 104 * Construct a new <code>EnforcerRuleException</code> exception providing 105 * a <code>message</code>. 106 * 107 * @param message the message 108 */ 109 public EnforcerRuleException( String message ) 110 { 111 super( message ); 112 } 113 }