1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.maven.enforcer.rule.api;
20
21 /**
22 * An exception occurring during the execution of a rule.
23 * <p>
24 * Enforcer plugin takes decision based on configuration and {@code Enforcer Rule} level
25 * whether build should pass or fail.
26 *
27 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
28 */
29 public class EnforcerRuleException extends Exception {
30
31 /** serialVersionUID. */
32 private static final long serialVersionUID = 1L;
33
34 /** The source. */
35 protected Object source;
36
37 /** The long message. */
38 protected String longMessage;
39
40 /**
41 * Gets the long message.
42 *
43 * @return the long message
44 * @deprecated not used
45 */
46 @Deprecated
47 public String getLongMessage() {
48 return longMessage;
49 }
50
51 /**
52 * Gets the source.
53 *
54 * @return the source
55 * @deprecated not used
56 */
57 @Deprecated
58 public Object getSource() {
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 * @deprecated {@code source} and {@code longMessage} are not used
70 */
71 @Deprecated
72 public EnforcerRuleException(Object source, String shortMessage, String longMessage) {
73 super(shortMessage);
74 this.source = source;
75 this.longMessage = longMessage;
76 }
77
78 /**
79 * Construct a new <code>EnforcerRuleException</code> exception wrapping
80 * an underlying <code>Exception</code> and providing a
81 * <code>message</code>.
82 *
83 * @param message the message
84 * @param cause the cause
85 */
86 public EnforcerRuleException(String message, Exception cause) {
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 super(message, cause);
100 }
101
102 /**
103 * Construct a new <code>EnforcerRuleException</code> exception providing
104 * a <code>message</code>.
105 *
106 * @param message the message
107 */
108 public EnforcerRuleException(String message) {
109 super(message);
110 }
111
112 /**
113 * Construct a new <code>EnforcerRuleException</code> exception wrapping
114 * an underlying <code>Throwable</code>.
115 *
116 * @param cause the cause
117 */
118 public EnforcerRuleException(Throwable cause) {
119 super(cause);
120 }
121 }