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/05/15 23:12:19 UTC

[commons-text] 10/11: Bump Spotbugs from 4.6.0 to 4.7.0 and fix errors

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

commit 19d1cd831bac215a3ecc7e759abeaaa327e058b7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 15 19:11:14 2022 -0400

    Bump Spotbugs from 4.6.0 to 4.7.0 and fix errors
    
    - [ERROR] Medium: Method intentionally throws RuntimeException.
    [org.apache.commons.text.diff.StringsComparator] At
    StringsComparator.java:[lines 238-305]
    THROWS_METHOD_THROWS_RUNTIMEEXCEPTION
    [- ERROR] Medium: Method lists Exception in its throws clause.
    [org.apache.commons.text.lookup.ConstantStringLookup] At
    ConstantStringLookup.java:[lines 146-150]
    THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
    - [ERROR] Medium: Method lists Exception in its throws clause.
    [org.apache.commons.text.lookup.ConstantStringLookup] At
    ConstantStringLookup.java:[lines 146-150]
    THROWS_METHOD_THROWS_CLAUSE_BASIC_EXCEPTION
---
 pom.xml                                             |  2 +-
 src/changes/changes.xml                             |  2 +-
 .../apache/commons/text/diff/StringsComparator.java |  2 +-
 .../commons/text/lookup/ConstantStringLookup.java   |  4 ++--
 .../jmh/LongestCommonSubsequencePerformance.java    | 21 +++++++++++----------
 5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 126c4819..f3fa104c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,7 @@
     <checkstyle.version>9.3</checkstyle.version>
 
     <spotbugs.plugin.version>4.6.0.0</spotbugs.plugin.version>
-    <spotbugs.impl.version>4.6.0</spotbugs.impl.version>
+    <spotbugs.impl.version>4.7.0</spotbugs.impl.version>
     <commons.pmd.version>3.16.0</commons.pmd.version>
     <commons.pmd-impl.version>6.45.0</commons.pmd-impl.version>
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 108375a0..2091dfd2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -90,7 +90,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action                  type="update" dev="ggregory" due-to="Dependabot">Bump graalvm.version from 20.2.0 to 22.0.0.2 #185, #198, #206, #227, #252, #276, #295, #300.</action>
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump commons.japicmp.version 0.14.3 -> 0.15.3.</action>
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump commons.jacoco.version 0.8.5 to 0.8.8; fixes Java 15 build.</action>
-    <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump spotbugs from 4.1.3 to 4.6.0 #175, 189, #209, #218, #247, #256, #264, #275, #284, #289, #296, #306.</action>
+    <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump spotbugs from 4.1.3 to 4.7.0 #175, 189, #209, #218, #247, #256, #264, #275, #284, #289, #296, #306.</action>
     <action                  type="update" dev="kinow" due-to="Dependabot">Bump maven-checkstyle-plugin from 3.1.1 to 3.1.2 #202.</action>
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump commons-lang3 3.11 -> 3.12.0.</action>
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Bump commons.javadoc.version from 3.2.0 to 3.4.0.</action>
diff --git a/src/main/java/org/apache/commons/text/diff/StringsComparator.java b/src/main/java/org/apache/commons/text/diff/StringsComparator.java
index 477a8b4a..bafeb405 100644
--- a/src/main/java/org/apache/commons/text/diff/StringsComparator.java
+++ b/src/main/java/org/apache/commons/text/diff/StringsComparator.java
@@ -302,7 +302,7 @@ public class StringsComparator {
         }
 
         // this should not happen
-        throw new RuntimeException("Internal Error");
+        throw new IllegalStateException("Internal Error");
     }
 
     /**
diff --git a/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java b/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
index a7a5d613..97bd4239 100644
--- a/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/ConstantStringLookup.java
@@ -140,9 +140,9 @@ class ConstantStringLookup extends AbstractStringLookup {
      * @param className the name of the class
      * @param fieldName the name of the member field of that class to read
      * @return The field's value
-     * @throws Exception if an error occurs
+     * @throws ReflectiveOperationException if an error occurs
      */
-    protected Object resolveField(final String className, final String fieldName) throws Exception {
+    protected Object resolveField(final String className, final String fieldName) throws ReflectiveOperationException {
         final Class<?> clazz = fetchClass(className);
         if (clazz == null) {
             return null;
diff --git a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
index f548e202..16d98121 100644
--- a/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
+++ b/src/test/java/org/apache/commons/text/jmh/LongestCommonSubsequencePerformance.java
@@ -16,6 +16,16 @@
  */
 package org.apache.commons.text.jmh;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UncheckedIOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.commons.text.similarity.LongestCommonSubsequence;
@@ -32,15 +42,6 @@ import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
 import org.openjdk.jmh.annotations.Warmup;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
 /**
  * Performance analysis for LongestCommonSubsequence
  */
@@ -69,7 +70,7 @@ public class LongestCommonSubsequencePerformance {
                     this.inputs.add(ImmutablePair.of(inputA, inputB));
                 }
             } catch (final IOException exception) {
-                throw new RuntimeException(exception.getMessage(), exception.getCause());
+                throw new UncheckedIOException(exception.getMessage(), exception);
             }
         }
     }