You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/06/01 20:23:57 UTC

[commons-io] branch master updated: Better exception message

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new 99e44293 Better exception message
99e44293 is described below

commit 99e44293e6ed797733c2148de269342b8e5f3232
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jun 1 16:23:53 2023 -0400

    Better exception message
---
 src/main/java/org/apache/commons/io/build/AbstractOrigin.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
index c830c89f..d4add117 100644
--- a/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
+++ b/src/main/java/org/apache/commons/io/build/AbstractOrigin.java
@@ -156,7 +156,6 @@ public abstract class AbstractOrigin<T, B extends AbstractOrigin<T, B>> extends
             super(origin);
         }
 
-
         @Override
         public byte[] getByteArray(final long position, final int length) throws IOException {
             try (RandomAccessFile raf = RandomAccessFileMode.READ_ONLY.create(origin)) {
@@ -450,7 +449,7 @@ public abstract class AbstractOrigin<T, B extends AbstractOrigin<T, B>> extends
      * @throws UnsupportedOperationException if this method is not implemented in a concrete subclass.
      */
     public File getFile() {
-        throw new UnsupportedOperationException("getFile() from " + origin.toString());
+        throw new UnsupportedOperationException(String.format("%s#getFile() for origin %s", getClass().getSimpleName(), origin));
     }
 
     /**
@@ -484,7 +483,7 @@ public abstract class AbstractOrigin<T, B extends AbstractOrigin<T, B>> extends
      * @throws UnsupportedOperationException if this method is not implemented in a concrete subclass.
      */
     public Path getPath() {
-        throw new UnsupportedOperationException("getPath() from " + origin.toString());
+        throw new UnsupportedOperationException(String.format("%s#getPath() for origin %s", getClass().getSimpleName(), origin));
     }
 
     /**