1
0

Deprecate LogConfigurationException.cause in favor of getCause()

This commit is contained in:
Gary Gregory
2023-11-19 11:34:18 -05:00
parent b01ad472ae
commit e2f9a3fce8
2 changed files with 11 additions and 15 deletions

View File

@@ -79,6 +79,9 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" issue="LOGGING-185" dev="ggregory" due-to="Piotr P. Karwasz"> <action type="fix" issue="LOGGING-185" dev="ggregory" due-to="Piotr P. Karwasz">
Fix failing tests #180. Fix failing tests #180.
</action> </action>
<action type="fix" dev="ggregory" due-to="Gary Gregory">
Deprecate LogConfigurationException.cause in favor of getCause().
</action>
<!-- UPDATE --> <!-- UPDATE -->
<action dev="ggregory" type="update" due-to="Gary Gregory"> <action dev="ggregory" type="update" due-to="Gary Gregory">
Bump Java from 6 to 8. Bump Java from 6 to 8.

View File

@@ -18,9 +18,7 @@
package org.apache.commons.logging; package org.apache.commons.logging;
/** /**
* An exception that is thrown only if a suitable {@code LogFactory} * An exception that is thrown only if a suitable {@code LogFactory} or {@code Log} instance cannot be created by the corresponding factory methods.
* or {@code Log} instance cannot be created by the corresponding
* factory methods.
*/ */
public class LogConfigurationException extends RuntimeException { public class LogConfigurationException extends RuntimeException {
@@ -29,7 +27,10 @@ public class LogConfigurationException extends RuntimeException {
/** /**
* The underlying cause of this exception. * The underlying cause of this exception.
*
* @deprecated Use {@link #getCause()}.
*/ */
@Deprecated
protected Throwable cause; protected Throwable cause;
/** /**
@@ -51,16 +52,15 @@ public class LogConfigurationException extends RuntimeException {
* Constructs a new exception with the specified detail message and cause. * Constructs a new exception with the specified detail message and cause.
* *
* @param message The detail message * @param message The detail message
* @param cause The underlying cause * @param cause The underlying cause
*/ */
public LogConfigurationException(final String message, final Throwable cause) { public LogConfigurationException(final String message, final Throwable cause) {
super(message + " (Caused by " + cause + ")"); super(message, cause);
this.cause = cause; // Two-argument version requires JDK 1.4 or later this.cause = cause;
} }
/** /**
* Constructs a new exception with the specified cause and a derived * Constructs a new exception with the specified cause and a derived detail message.
* detail message.
* *
* @param cause The underlying cause * @param cause The underlying cause
*/ */
@@ -68,11 +68,4 @@ public class LogConfigurationException extends RuntimeException {
this(cause == null ? null : cause.toString(), cause); this(cause == null ? null : cause.toString(), cause);
} }
/**
* Return the underlying cause of this exception (if any).
*/
@Override
public Throwable getCause() {
return this.cause;
}
} }