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 88859cb3f156434598b5f4465aa419d329d6d01e
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Apr 10 09:36:31 2025 -0400

    
org.apache.commons.compress.harmony.unpack200.SegmentConstantPool.getInitMethodPoolEntry(int,
    long, String) now throws Pack200Exception instead of Error on bad
    constant pool type input
---
 src/changes/changes.xml                                              | 1 +
 .../commons/compress/harmony/unpack200/SegmentConstantPool.java      | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 014860871..c0138b811 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Steve Roughley, Gary Gregory" 
issue="COMPRESS-696">ZipArchiveInputStream.getCompressedCount() throws 
NullPointerException if called before getNextEntry().</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.compress.harmony.unpack200.SegmentConstantPool.getConstantPoolEntry(int,
 long) now throws Pack200Exception instead of Error and does better range 
checking of the index argument.</action>
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.compress.harmony.unpack200.SegmentConstantPool.getInitMethodPoolEntry(int,
 long, String) now throws Pack200Exception instead of Error and does better 
range checking of the index argument.</action>
+      <action type="fix" dev="ggregory" due-to="Gary 
Gregory">org.apache.commons.compress.harmony.unpack200.SegmentConstantPool.getInitMethodPoolEntry(int,
 long, String) now throws Pack200Exception instead of Error on bad constant 
pool type input.</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
GzipParameters.getModificationInstant().</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
GzipParameters.setModificationInstant(Instant).</action>
diff --git 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentConstantPool.java
 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentConstantPool.java
index bb0db9ebb..d3000ebfc 100644
--- 
a/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentConstantPool.java
+++ 
b/src/main/java/org/apache/commons/compress/harmony/unpack200/SegmentConstantPool.java
@@ -259,7 +259,7 @@ public ConstantPoolEntry getConstantPoolEntry(final int 
type, final long index)
     /**
      * Gets the {@code init} method for the specified class.
      *
-     * @param cp               constant pool to search (must be CP_METHOD).
+     * @param cp               constant pool to search, must be {@link 
#CP_METHOD}.
      * @param value            index of {@code init} method.
      * @param desiredClassName String class name of the {@code init} method.
      * @return CPMethod {@code init} method.
@@ -267,8 +267,7 @@ public ConstantPoolEntry getConstantPoolEntry(final int 
type, final long index)
      */
     public ConstantPoolEntry getInitMethodPoolEntry(final int cp, final long 
value, final String desiredClassName) throws Pack200Exception {
         if (cp != CP_METHOD) {
-            // TODO really an error?
-            throw new Error("Nothing but CP_METHOD can be an <init>");
+            throw new Pack200Exception("Nothing but CP_METHOD can be an 
<init>");
         }
         final int realIndex = 
matchSpecificPoolEntryIndex(bands.getCpMethodClass(), 
bands.getCpMethodDescriptor(), desiredClassName, REGEX_MATCH_INIT,
                 toIndex(value));

Reply via email to