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 2025/08/14 12:52:27 UTC
(commons-compress) 03/09: Internal refactoring
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
commit 98171d5ea6fdd056cd718e0a6cc1fb088889cbc8
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Thu Aug 14 08:04:35 2025 -0400
Internal refactoring
---
.../compress/compressors/xz/XZCompressorInputStream.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
index de7dc24c3..a036421f7 100644
--- a/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/xz/XZCompressorInputStream.java
@@ -222,6 +222,10 @@ public long getCompressedCount() {
return countingStream.getCount();
}
+ MemoryLimitException newMemoryLimitException(final org.tukaani.xz.MemoryLimitException e) {
+ return new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), (Throwable) e);
+ }
+
@Override
public int read() throws IOException {
try {
@@ -229,7 +233,8 @@ public int read() throws IOException {
count(ret == -1 ? -1 : 1);
return ret;
} catch (final org.tukaani.xz.MemoryLimitException e) {
- throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), (Throwable) e);
+ // Convert to Commons Compress MemoryLimtException
+ throw newMemoryLimitException(e);
}
}
@@ -243,8 +248,8 @@ public int read(final byte[] buf, final int off, final int len) throws IOExcepti
count(ret);
return ret;
} catch (final org.tukaani.xz.MemoryLimitException e) {
- // convert to commons-compress MemoryLimtException
- throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), (Throwable) e);
+ // Convert to Commons Compress MemoryLimtException
+ throw newMemoryLimitException(e);
}
}
@@ -253,8 +258,8 @@ public long skip(final long n) throws IOException {
try {
return org.apache.commons.io.IOUtils.skip(in, n);
} catch (final org.tukaani.xz.MemoryLimitException e) {
- // convert to commons-compress MemoryLimtException
- throw new MemoryLimitException(e.getMemoryNeeded(), e.getMemoryLimit(), (Throwable) e);
+ // Convert to Commons Compress MemoryLimtException
+ throw newMemoryLimitException(e);
}
}
}