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-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a0e79b45 Better exception messages in SeekableInMemoryByteChannel
3a0e79b45 is described below

commit 3a0e79b4588d091c790b7f889a857b00e52a67e6
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Aug 21 09:10:37 2024 -0400

    Better exception messages in SeekableInMemoryByteChannel
---
 src/changes/changes.xml                                               | 1 +
 .../apache/commons/compress/utils/SeekableInMemoryByteChannel.java    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 0452cb7c7..90302f5f4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
   <body>
     <release version="1.27.2" date="YYYY-MM-DD" description="This is a feature 
and maintenance release. Java 8 or later is required.">
       <!-- FIX -->
+      <action type="fix" issue="COMPRESS-686" dev="ggregory" due-to="Richard 
Blank, Gary Gregory">Better exception messages in 
SeekableInMemoryByteChannel.</action>
       <!-- ADD -->
       <!-- UPDATE -->
     </release>
diff --git 
a/src/main/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannel.java
 
b/src/main/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannel.java
index 1f7496e2e..7c171e6f7 100644
--- 
a/src/main/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannel.java
+++ 
b/src/main/java/org/apache/commons/compress/utils/SeekableInMemoryByteChannel.java
@@ -119,7 +119,7 @@ public class SeekableInMemoryByteChannel implements 
SeekableByteChannel {
     public SeekableByteChannel position(final long newPosition) throws 
IOException {
         ensureOpen();
         if (newPosition < 0L || newPosition > Integer.MAX_VALUE) {
-            throw new IOException("Position has to be in range 0.. " + 
Integer.MAX_VALUE);
+            throw new IOException("Position must be in range [0.." + 
Integer.MAX_VALUE + "]");
         }
         position = (int) newPosition;
         return this;
@@ -179,7 +179,7 @@ public class SeekableInMemoryByteChannel implements 
SeekableByteChannel {
     @Override
     public SeekableByteChannel truncate(final long newSize) {
         if (newSize < 0L || newSize > Integer.MAX_VALUE) {
-            throw new IllegalArgumentException("Size has to be in range 0.. " 
+ Integer.MAX_VALUE);
+            throw new IllegalArgumentException("Size must be range [0.." + 
Integer.MAX_VALUE + "]");
         }
         if (size > newSize) {
             size = (int) newSize;

Reply via email to