Move package-private method.
diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java
index 9db13c3..dba6de9 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 @@
*/
public final class CSVPrinter implements Flushable, Closeable {
- /**
- * Throws the given throwable.
- *
- * @param <T> The throwable cast type.
- * @param throwable The throwable to rethrow.
- * @return nothing because we throw.
- * @throws T Always thrown.
- */
- @SuppressWarnings("unchecked")
- private static <T extends Throwable> 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 @@
try {
print(t);
} catch (final IOException e) {
- throw rethrow(e);
+ throw IOUtils.rethrow(e);
}
});
println();
@@ -502,7 +489,7 @@
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 e5c51da..c4baeb4 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 @@
// Noop
}
+ /**
+ * Throws the given throwable.
+ *
+ * @param <T> The throwable cast type.
+ * @param throwable The throwable to rethrow.
+ * @return nothing because we throw.
+ * @throws T Always thrown.
+ */
+ @SuppressWarnings("unchecked")
+ static <T extends Throwable> RuntimeException rethrow(final Throwable throwable) throws T {
+ throw (T) throwable;
+ }
+
}