Skip to content

Commit b5b3cca

Browse files
committed
Move package-private method.
1 parent d48bc1e commit b5b3cca

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/main/java/org/apache/commons/csv/CSVPrinter.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,6 @@
7070
*/
7171
public 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
}

src/main/java/org/apache/commons/csv/IOUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)