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 7ad8772178feb4fac548543c891090d40c9f6002
Author: Gary David Gregory (Code signing key) <[email protected]>
AuthorDate: Sat Jun 22 08:56:53 2024 -0400

    Fix PMD EmptyCatchBlock by allowing commented blocks
    
    Fix PMD EmptyControlStatement by allowing commented blocks
---
 src/changes/changes.xml                               |  2 ++
 src/conf/pmd-ruleset.xml                              | 19 ++++++++++++-------
 .../org/apache/bcel/classfile/BootstrapMethod.java    |  2 +-
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 36f203c0..f6498fc3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -62,6 +62,8 @@ The <action> type attribute can be add,update,fix,remove.
     <release version="6.10.0" date="YYYY-MM-DD" description="Maintenance and 
bug fix release. Requires a minimum of Java 8.">
       <!-- FIX -->
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Fix PMD UnnecessaryFullyQualifiedName.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Fix PMD EmptyCatchBlock by allowing commented blocks.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Fix PMD EmptyControlStatement by allowing commented blocks.</action>
       <!-- ADD --> 
       <action                  type="update" dev="ggregory" due-to="nbauma109, 
Gary Gregory, Mark Roberts">Add accessors to model and unit tests, Javadoc 
#183.</action>
       <!-- UPDATE -->
diff --git a/src/conf/pmd-ruleset.xml b/src/conf/pmd-ruleset.xml
index 9cafbb48..89eb9b8d 100644
--- a/src/conf/pmd-ruleset.xml
+++ b/src/conf/pmd-ruleset.xml
@@ -19,11 +19,9 @@
     xmlns="http://pmd.sourceforge.net/ruleset/2.0.0";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 
http://pmd.sourceforge.net/ruleset_2_0_0.xsd";>
-
   <description>
     This ruleset checks the code for discouraged programming constructs.
   </description>
-
   <!-- Default ruleset -->
   <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
   <rule ref="category/java/bestpractices.xml/CheckResultSet"/>
@@ -32,7 +30,6 @@
   <rule ref="category/java/bestpractices.xml/UnusedLocalVariable"/>
   <rule ref="category/java/bestpractices.xml/UnusedPrivateField"/>
   <rule ref="category/java/bestpractices.xml/UnusedPrivateMethod"/>
-  <rule ref="category/java/codestyle.xml/EmptyControlStatement"/>
   <rule ref="category/java/codestyle.xml/ExtendsObject"/>
   <rule ref="category/java/codestyle.xml/ForLoopShouldBeWhileLoop"/>
   <rule ref="category/java/codestyle.xml/TooManyStaticImports"/>
@@ -54,7 +51,6 @@
   <rule ref="category/java/errorprone.xml/CheckSkipResult"/>
   <rule ref="category/java/errorprone.xml/ClassCastExceptionWithToArray"/>
   <rule ref="category/java/errorprone.xml/DontUseFloatTypeForLoopIndices"/>
-  <rule ref="category/java/errorprone.xml/EmptyCatchBlock"/>
   <rule ref="category/java/errorprone.xml/JumbledIncrementer"/>
   <rule ref="category/java/errorprone.xml/MisplacedNullCheck"/>
   <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/>
@@ -67,9 +63,7 @@
   <rule ref="category/java/multithreading.xml/DontCallThreadRun"/>
   <rule ref="category/java/multithreading.xml/DoubleCheckedLocking"/>
   <rule ref="category/java/performance.xml/BigIntegerInstantiation"/>
-
   <!-- Rule customisations. -->
-
   <rule ref="category/java/codestyle.xml/UnnecessaryFullyQualifiedName">
     <properties>
       <!-- java.lang annotations have the same name as BCEL classes so must be 
fully
@@ -82,5 +76,16 @@
           or @SimpleName='ClassLoader' or @SimpleName='ClassLoaderRepository' 
or @SimpleName='JavaWrapper']"/>
     </properties>
   </rule>
-
+    <!-- Apache Commons Compress custom -->
+    <rule ref="category/java/errorprone.xml/EmptyCatchBlock">
+      <properties>
+        <property name="allowCommentedBlocks" value="true" />
+        <property name="allowExceptionNameRegex" value="^(ignored|expected)$" 
/>
+      </properties>
+    </rule>
+    <rule ref="category/java/codestyle.xml/EmptyControlStatement">
+      <properties>
+        <property name="allowCommentedBlocks" value="true" />
+      </properties>
+    </rule>
 </ruleset>
diff --git a/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java 
b/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
index ff4b93b0..32d2acfc 100644
--- a/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
+++ b/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
@@ -86,7 +86,7 @@ public class BootstrapMethod implements Cloneable {
     public BootstrapMethod copy() {
         try {
             return (BootstrapMethod) clone();
-        } catch (final CloneNotSupportedException e) {
+        } catch (final CloneNotSupportedException ignore) {
             // TODO should this throw?
         }
         return null;

Reply via email to