Skip to content

Commit 7ea97b3

Browse files
committed
Internal refactoring
1 parent 3c53c39 commit 7ea97b3

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/main/java/org/apache/commons/io/build/AbstractOrigin.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public CharSequence getCharSequence(final Charset charset) throws IOException {
525525
*/
526526
public File getFile() {
527527
throw new UnsupportedOperationException(
528-
String.format("%s#getFile() for %s origin %s", getClass().getSimpleName(), origin.getClass().getSimpleName(), origin));
528+
String.format("%s#getFile() for %s origin %s", getSimpleName(), origin.getClass().getSimpleName(), origin));
529529
}
530530

531531
/**
@@ -560,7 +560,7 @@ public OutputStream getOutputStream(final OpenOption... options) throws IOExcept
560560
*/
561561
public Path getPath() {
562562
throw new UnsupportedOperationException(
563-
String.format("%s#getPath() for %s origin %s", getClass().getSimpleName(), origin.getClass().getSimpleName(), origin));
563+
String.format("%s#getPath() for %s origin %s", getSimpleName(), origin.getClass().getSimpleName(), origin));
564564
}
565565

566566
/**
@@ -574,6 +574,10 @@ public Reader getReader(final Charset charset) throws IOException {
574574
return Files.newBufferedReader(getPath(), charset);
575575
}
576576

577+
private String getSimpleName() {
578+
return getClass().getSimpleName();
579+
}
580+
577581
/**
578582
* Gets a new Writer on the origin, buffered by default.
579583
*
@@ -600,6 +604,6 @@ public long size() throws IOException {
600604

601605
@Override
602606
public String toString() {
603-
return getClass().getSimpleName() + "[" + origin.toString() + "]";
607+
return getSimpleName() + "[" + origin.toString() + "]";
604608
}
605609
}

0 commit comments

Comments
 (0)