File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/csv Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 */
7171public final class CSVPrinter implements Flushable , Closeable {
7272
73- /**
74- * Throws the given throwable.
75- *
76- * @param <T> The throwable cast type.
77- * @param throwable The throwable to rethrow.
78- * @return nothing because we throw.
79- * @throws T Always thrown.
80- */
81- @ SuppressWarnings ("unchecked" )
82- private static <T extends Throwable > RuntimeException rethrow (final Throwable throwable ) throws T {
83- throw (T ) throwable ;
84- }
85-
8673 /** The place that the values get written. */
8774 private final Appendable appendable ;
8875
@@ -313,7 +300,7 @@ public synchronized void printRecord(final Stream<?> values) throws IOException
313300 try {
314301 print (t );
315302 } catch (final IOException e ) {
316- throw rethrow (e );
303+ throw IOUtils . rethrow (e );
317304 }
318305 });
319306 println ();
@@ -502,7 +489,7 @@ public void printRecords(final Stream<?> values) throws IOException {
502489 try {
503490 printRecordObject (t );
504491 } catch (final IOException e ) {
505- throw rethrow (e );
492+ throw IOUtils . rethrow (e );
506493 }
507494 });
508495 }
Original file line number Diff line number Diff line change @@ -131,4 +131,17 @@ private IOUtils() {
131131 // Noop
132132 }
133133
134+ /**
135+ * Throws the given throwable.
136+ *
137+ * @param <T> The throwable cast type.
138+ * @param throwable The throwable to rethrow.
139+ * @return nothing because we throw.
140+ * @throws T Always thrown.
141+ */
142+ @ SuppressWarnings ("unchecked" )
143+ static <T extends Throwable > RuntimeException rethrow (final Throwable throwable ) throws T {
144+ throw (T ) throwable ;
145+ }
146+
134147}
You can’t perform that action at this time.
0 commit comments