Skip to content

Commit 9e04732

Browse files
committed
Simplify new interface ExceptionHandler
1 parent 7ee4392 commit 9e04732

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@
1717

1818
package org.apache.commons.jxpath;
1919

20+
import java.util.function.BiConsumer;
21+
2022
/**
2123
* Exception handler interface. Actually handles Throwables.
2224
*
2325
* @since 1.4.0
2426
*/
25-
public interface ExceptionHandler {
26-
27-
/**
28-
* Handle an encountered Throwable.
29-
*
30-
* @param t to handle
31-
* @param ptr specific context
32-
*/
33-
void handle(Throwable t, Pointer ptr);
27+
@FunctionalInterface
28+
public interface ExceptionHandler extends BiConsumer<Throwable, Pointer> {
29+
// empty
3430
}

src/main/java/org/apache/commons/jxpath/ri/model/NodePointer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ public void handle(final Throwable t) {
685685
*/
686686
public void handle(final Throwable t, final NodePointer originator) {
687687
if (exceptionHandler != null) {
688-
exceptionHandler.handle(t, originator);
688+
exceptionHandler.accept(t, originator);
689689
return;
690690
}
691691
if (parent != null) {

0 commit comments

Comments
 (0)