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-jxpath.git
The following commit(s) were added to refs/heads/master by this push: new 8a55986 Enable PMD 8a55986 is described below commit 8a559864b760a14140095de1d46b4796337d911c Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Oct 18 18:26:33 2022 -0400 Enable PMD --- pom.xml | 12 +++++++++++- .../java/org/apache/commons/jxpath/JXPathContextFactory.java | 10 +++++----- .../org/apache/commons/jxpath/util/BasicTypeConverter.java | 3 ++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 4b6378c..3fb247d 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ </properties> <build> - <defaultGoal>clean apache-rat:check package japicmp:cmp checkstyle:check javadoc:javadoc</defaultGoal> + <defaultGoal>clean apache-rat:check package japicmp:cmp checkstyle:check pmd:check javadoc:javadoc</defaultGoal> <plugins> <plugin> <groupId>org.apache.rat</groupId> @@ -165,6 +165,16 @@ <excludes>org/apache/commons/jxpath/ri/parser/*</excludes> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <targetJdk>1.8</targetJdk> + <excludes> + <exclude>org/apache/commons/jxpath/ri/parser/*</exclude> + </excludes> + </configuration> + </plugin> </plugins> </build> <dependencyManagement> diff --git a/src/main/java/org/apache/commons/jxpath/JXPathContextFactory.java b/src/main/java/org/apache/commons/jxpath/JXPathContextFactory.java index 42ba157..560a58b 100644 --- a/src/main/java/org/apache/commons/jxpath/JXPathContextFactory.java +++ b/src/main/java/org/apache/commons/jxpath/JXPathContextFactory.java @@ -136,7 +136,7 @@ public abstract class JXPathContextFactory { try { debug = System.getProperty("jxpath.debug") != null; } - catch (final SecurityException ignore) { + catch (final SecurityException ignore) { // NOPMD // This is ok } } @@ -162,7 +162,7 @@ public abstract class JXPathContextFactory { } } - catch (final SecurityException ignore) { + catch (final SecurityException ignore) { // NOPMD // Ignore } @@ -187,7 +187,7 @@ public abstract class JXPathContextFactory { try { fis.close(); } - catch (final IOException ignore) { + catch (final IOException ignore) { // NOPMD //swallow } } @@ -234,8 +234,8 @@ public abstract class JXPathContextFactory { try { rd.close(); } - catch (final IOException ignore) { - //swallow + catch (final IOException ignore) { // NOPMD + // Ignore } } diff --git a/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java b/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java index a5fffe7..e5eb059 100644 --- a/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java +++ b/src/main/java/org/apache/commons/jxpath/util/BasicTypeConverter.java @@ -375,7 +375,8 @@ public class BasicTypeConverter implements TypeConverter { return BigInteger.valueOf((long) value); } if (type == BigDecimal.class) { - return new BigDecimal(value); + // TODO ? https://pmd.sourceforge.io/pmd-6.50.0/pmd_rules_java_errorprone.html#avoiddecimalliteralsinbigdecimalconstructor + return new BigDecimal(value); // NOPMD } final String classname = type.getName(); Class initialValueType = null;