Skip to content

Commit 99e4429

Browse files
committed
Better exception message
1 parent 39b501a commit 99e4429

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ public FileOrigin(final File origin) {
156156
super(origin);
157157
}
158158

159-
160159
@Override
161160
public byte[] getByteArray(final long position, final int length) throws IOException {
162161
try (RandomAccessFile raf = RandomAccessFileMode.READ_ONLY.create(origin)) {
@@ -450,7 +449,7 @@ public CharSequence getCharSequence(final Charset charset) throws IOException {
450449
* @throws UnsupportedOperationException if this method is not implemented in a concrete subclass.
451450
*/
452451
public File getFile() {
453-
throw new UnsupportedOperationException("getFile() from " + origin.toString());
452+
throw new UnsupportedOperationException(String.format("%s#getFile() for origin %s", getClass().getSimpleName(), origin));
454453
}
455454

456455
/**
@@ -484,7 +483,7 @@ public OutputStream getOutputStream(final OpenOption... options) throws IOExcept
484483
* @throws UnsupportedOperationException if this method is not implemented in a concrete subclass.
485484
*/
486485
public Path getPath() {
487-
throw new UnsupportedOperationException("getPath() from " + origin.toString());
486+
throw new UnsupportedOperationException(String.format("%s#getPath() for origin %s", getClass().getSimpleName(), origin));
488487
}
489488

490489
/**

0 commit comments

Comments
 (0)