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 fe39a8e4 LZMA2Decoder.decode() looses original exception fe39a8e4 is described below commit fe39a8e4a4418de77a950516b49cdb45eb59f407 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Dec 10 10:34:20 2022 -0500 LZMA2Decoder.decode() looses original exception --- src/changes/changes.xml | 1 + .../commons/compress/archivers/sevenz/LZMA2Decoder.java | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f88db27e..feb8cbe6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove. <action type="update" dev="ggregory" due-to="CodeQL, Gary Gregory">Implicit narrowing conversion in compound assignment.</action> <action type="update" dev="ggregory" due-to="CodeQL, Gary Gregory">Avoid NPE in FileNameUtils.getBaseName(Path) for paths with zero elements like root paths.</action> <action type="update" dev="ggregory" due-to="CodeQL, Gary Gregory">Avoid NPE in FileNameUtils.getExtension(Path) for paths with zero elements like root paths.</action> + <action type="update" dev="ggregory" due-to="Gary Gregory">LZMA2Decoder.decode() looses original exception.</action> <!-- ADD --> <action type="add" issue="COMPRESS-614" dev="ggregory" due-to="Andre Brait, Gary Gregory">Use FileTime for time fields in SevenZipArchiveEntry #256.</action> <action type="add" issue="COMPRESS-621" dev="ggregory" due-to="Glavo">Fix calculation the offset of the first zip central directory entry #334.</action> diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java index 6c0424e7..c40a89e6 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java @@ -28,13 +28,14 @@ import org.tukaani.xz.LZMA2InputStream; import org.tukaani.xz.LZMA2Options; class LZMA2Decoder extends AbstractCoder { + LZMA2Decoder() { super(LZMA2Options.class, Number.class); } @Override - InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength, - final Coder coder, final byte[] password, final int maxMemoryLimitInKb) throws IOException { + InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength, final Coder coder, final byte[] password, + final int maxMemoryLimitInKb) throws IOException { try { final int dictionarySize = getDictionarySize(coder); final int memoryUsageInKb = LZMA2InputStream.getMemoryUsage(dictionarySize); @@ -42,14 +43,13 @@ class LZMA2Decoder extends AbstractCoder { throw new MemoryLimitException(memoryUsageInKb, maxMemoryLimitInKb); } return new LZMA2InputStream(in, dictionarySize); - } catch (final IllegalArgumentException ex) { // NOSONAR - throw new IOException(ex.getMessage()); + } catch (final IllegalArgumentException ex) { // NOSONAR + throw new IOException(ex); } } @Override - OutputStream encode(final OutputStream out, final Object opts) - throws IOException { + OutputStream encode(final OutputStream out, final Object opts) throws IOException { final LZMA2Options options = getOptions(opts); final FinishableOutputStream wrapped = new FinishableWrapperOutputStream(out); return options.getOutputStream(wrapped);