From b5b3cca98b2776fdcdac69bb0e4b701c06cc11f5 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Mon, 12 Sep 2022 12:50:16 -0700 Subject: [PATCH] Move package-private method. --- .../java/org/apache/commons/csv/CSVPrinter.java | 17 ++--------------- .../java/org/apache/commons/csv/IOUtils.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java index 9db13c3d..dba6de9e 100644 --- a/src/main/java/org/apache/commons/csv/CSVPrinter.java +++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java @@ -70,19 +70,6 @@ import java.util.stream.Stream; */ public final class CSVPrinter implements Flushable, Closeable { - /** - * Throws the given throwable. - * - * @param The throwable cast type. - * @param throwable The throwable to rethrow. - * @return nothing because we throw. - * @throws T Always thrown. - */ - @SuppressWarnings("unchecked") - private static RuntimeException rethrow(final Throwable throwable) throws T { - throw (T) throwable; - } - /** The place that the values get written. */ private final Appendable appendable; @@ -313,7 +300,7 @@ public final class CSVPrinter implements Flushable, Closeable { try { print(t); } catch (final IOException e) { - throw rethrow(e); + throw IOUtils.rethrow(e); } }); println(); @@ -502,7 +489,7 @@ public final class CSVPrinter implements Flushable, Closeable { try { printRecordObject(t); } catch (final IOException e) { - throw rethrow(e); + throw IOUtils.rethrow(e); } }); } diff --git a/src/main/java/org/apache/commons/csv/IOUtils.java b/src/main/java/org/apache/commons/csv/IOUtils.java index e5c51da0..c4baeb47 100644 --- a/src/main/java/org/apache/commons/csv/IOUtils.java +++ b/src/main/java/org/apache/commons/csv/IOUtils.java @@ -131,4 +131,17 @@ final class IOUtils { // Noop } + /** + * Throws the given throwable. + * + * @param The throwable cast type. + * @param throwable The throwable to rethrow. + * @return nothing because we throw. + * @throws T Always thrown. + */ + @SuppressWarnings("unchecked") + static RuntimeException rethrow(final Throwable throwable) throws T { + throw (T) throwable; + } + }