Skip to content

Commit afeec07

Browse files
committed
JXPathContextFactoryConfigurationError now reuses its superclass'
Throwable cause
1 parent 61e8dd0 commit afeec07

File tree

4 files changed

+15
-29
lines changed

4 files changed

+15
-29
lines changed

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
<!-- http://www.jdom.org/docs/apidocs/ is not a secure link -->
118118
<link>https://javadoc.io/doc/org.jdom/jdom/1.1</link>
119119
</links>
120+
<excludePackageNames>
121+
org.apache.commons.jxpath.ri.parser
122+
</excludePackageNames>
120123
</configuration>
121124
</plugin>
122125
<plugin>

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ The <action> type attribute can be add,update,fix,remove.
117117
<action dev="ggregory" type="fix" due-to="Gary Gregory">PageScopeContext.getAttributeNames() is now typed with generics.</action>
118118
<action dev="ggregory" type="fix" due-to="Gary Gregory">Functions.getUsedNamespaces() is now typed with generics.</action>
119119
<action dev="ggregory" type="fix" due-to="Gary Gregory">JXPathException now reuses its superclass' Throwable cause.</action>
120+
<action dev="ggregory" type="fix" due-to="Gary Gregory">Bump JXPathException serialVersionUID from 4306409701468017766L to 2L.</action>
121+
<action dev="ggregory" type="fix" due-to="Gary Gregory">JXPathContextFactoryConfigurationError now reuses its superclass' Throwable cause.</action>
122+
<action dev="ggregory" type="fix" due-to="Gary Gregory">Bump JXPathContextFactoryConfigurationError serialVersionUID from 1L to 2L.</action>
120123
<!-- ADD -->
121124
<action issue="JXPATH-123" dev="mbenson" type="add">
122125
XPath function "ends-with" is not implemented (although "starts-with" is).

src/main/java/org/apache/commons/jxpath/JXPathContextFactoryConfigurationError.java

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,31 @@
2323
*/
2424
public class JXPathContextFactoryConfigurationError extends Error {
2525

26-
private static final long serialVersionUID = 1L;
27-
/** @serial */
28-
private final Exception exception;
26+
private static final long serialVersionUID = 2L;
2927

3028
/**
3129
* Create a new {@code JXPathContextFactoryConfigurationError} with no detail mesage.
3230
*/
3331
public JXPathContextFactoryConfigurationError() {
34-
this.exception = null;
3532
}
3633

3734
/**
3835
* Create a new {@code JXPathContextFactoryConfigurationError} with a given {@code Exception} base cause of the error.
3936
*
40-
* @param e The exception to be encapsulated in a JXPathContextFactoryConfigurationError.
37+
* @param cause The exception to be encapsulated in a JXPathContextFactoryConfigurationError.
4138
*/
42-
public JXPathContextFactoryConfigurationError(final Exception e) {
43-
super(e.toString());
44-
this.exception = e;
39+
public JXPathContextFactoryConfigurationError(final Exception cause) {
40+
super(cause);
4541
}
4642

4743
/**
4844
* Create a new {@code JXPathContextFactoryConfigurationError} with the given {@code Exception} base cause and detail message.
4945
*
50-
* @param e The exception to be encapsulated in a JXPathContextFactoryConfigurationError
46+
* @param cause The exception to be encapsulated in a JXPathContextFactoryConfigurationError
5147
* @param msg The detail message.
5248
*/
53-
public JXPathContextFactoryConfigurationError(final Exception e, final String msg) {
54-
super(msg);
55-
this.exception = e;
49+
public JXPathContextFactoryConfigurationError(final Exception cause, final String msg) {
50+
super(msg, cause);
5651
}
5752

5853
/**
@@ -62,7 +57,6 @@ public JXPathContextFactoryConfigurationError(final Exception e, final String ms
6257
*/
6358
public JXPathContextFactoryConfigurationError(final String msg) {
6459
super(msg);
65-
this.exception = null;
6660
}
6761

6862
/**
@@ -71,21 +65,7 @@ public JXPathContextFactoryConfigurationError(final String msg) {
7165
* @return The encapsulated exception, or null if there is none.
7266
*/
7367
public Exception getException() {
74-
return exception;
68+
return (Exception) super.getCause();
7569
}
7670

77-
/**
78-
* Gets the message (if any) for this error . If there is no message for the exception and there is an encapsulated exception then the message of that
79-
* exception will be returned.
80-
*
81-
* @return The error message.
82-
*/
83-
@Override
84-
public String getMessage() {
85-
final String message = super.getMessage();
86-
if (message == null && exception != null) {
87-
return exception.getMessage();
88-
}
89-
return message;
90-
}
9171
}

src/main/java/org/apache/commons/jxpath/JXPathException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
public class JXPathException extends RuntimeException {
2424

25-
private static final long serialVersionUID = 4306409701468017766L;
25+
private static final long serialVersionUID = 2L;
2626

2727
/**
2828
* Create a new {@code JXPathException} with no detail mesage.

0 commit comments

Comments
 (0)