Skip to content

Commit

Permalink
Avoid possible confusion caused by removing ioexception from consumer…
Browse files Browse the repository at this point in the history
….apply
  • Loading branch information
shs96c committed Nov 5, 2018
1 parent d95b033 commit 2bab50b
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions java/client/src/org/openqa/selenium/json/JsonOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
Expand Down Expand Up @@ -262,7 +261,7 @@ public JsonOutput write(Object input, int depthRemaining) {
.findFirst()
.map(Map.Entry::getValue)
.orElseThrow(() -> new JsonException("Unable to write " + input))
.accept(input, depthRemaining);
.consume(input, depthRemaining);

return this;
}
Expand Down Expand Up @@ -416,16 +415,7 @@ public void write(String text) {
}

@FunctionalInterface
private interface SafeBiConsumer<T, U> extends BiConsumer<T, U> {
void consume(T t, U u) throws IOException;

@Override
default void accept(T t, U u) {
try {
consume(t, u);
} catch (IOException e) {
throw new JsonException(e);
}
}
private interface SafeBiConsumer<T, U> {
void consume(T t, U u);
}
}

0 comments on commit 2bab50b

Please sign in to comment.