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 2022/11/15 12:20:06 UTC

[commons-bcel] 02/02: Add org.apache.bcel.classfile.ClassFormatException.ClassFormatException(Throwable)

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

commit eb80c2fb9504e01751cd7a40a52cb840a7f1fb69
Author: Gary David Gregory (Code signing key) <gg...@apache.org>
AuthorDate: Tue Nov 15 07:19:59 2022 -0500

    Add org.apache.bcel.classfile.ClassFormatException.ClassFormatException(Throwable)
---
 src/changes/changes.xml                            |  2 ++
 .../bcel/classfile/ClassFormatException.java       | 36 +++++++++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1780b2bf..17d6a984 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -63,6 +63,8 @@ The <action> type attribute can be add,update,fix,remove.
 
   <body>
     <release version="6.6.2" date="20YY-MM-DD" description="Maintenance and bug fix release.">
+      <!-- ADD -->
+      <action                  type="add" dev="ggregory" due-to="Gary Gregory">Add org.apache.bcel.classfile.ClassFormatException.ClassFormatException(Throwable).</action>
       <!-- FIX -->
       <action                  type="fix" dev="ggregory" due-to="nbauma109, Gary Gregory">Typo in SimpleElementValue error message #161.</action>
       <action                  type="fix" dev="ggregory" due-to="Mark Roberts, Gary Gregory">Fix code duplication in org.apache.bcel.verifier.structurals.ExceptionHandlers.ExceptionHandlers(MethodGen).</action>
diff --git a/src/main/java/org/apache/bcel/classfile/ClassFormatException.java b/src/main/java/org/apache/bcel/classfile/ClassFormatException.java
index adcef10c..ad8cb185 100644
--- a/src/main/java/org/apache/bcel/classfile/ClassFormatException.java
+++ b/src/main/java/org/apache/bcel/classfile/ClassFormatException.java
@@ -17,24 +17,52 @@
 package org.apache.bcel.classfile;
 
 /**
- * Thrown when the BCEL attempts to read a class file and determines that a class is malformed or otherwise cannot be
- * interpreted as a class file.
+ * Thrown when the BCEL attempts to read a class file and determines that a class is malformed or otherwise cannot be interpreted as a class file.
  */
 public class ClassFormatException extends RuntimeException {
 
     private static final long serialVersionUID = -3569097343160139969L;
 
+    /**
+     * Constructs a new instance with {@code null} as its detail message. The cause is not initialized, and may subsequently be initialized by a call to
+     * {@link #initCause}.
+     */
     public ClassFormatException() {
     }
 
-    public ClassFormatException(final String s) {
-        super(s);
+    /**
+     * Constructs a new instance with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to
+     * {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
+     */
+    public ClassFormatException(final String message) {
+        super(message);
     }
 
     /**
+     * Constructs a new instance with the specified detail message and cause.
+     * <p>
+     * Note that the detail message associated with {@code cause} is <i>not</i> automatically incorporated in this runtime exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that
+     *                the cause is nonexistent or unknown.)
      * @since 6.0
      */
     public ClassFormatException(final String message, final Throwable cause) {
         super(message, cause);
     }
+
+    /**
+     * Constructs a new instance with the specified cause and a detail message of {@code (cause==null ? null : cause.toString())} (which typically contains the
+     * class and detail message of {@code cause}). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.
+     *
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A {@code null} value is permitted, and indicates that the
+     *              cause is nonexistent or unknown.)
+     * @since 6.6.2
+     */
+    public ClassFormatException(final Throwable cause) {
+        super(cause);
+    }
 }