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 2024/09/27 11:44:05 UTC

(commons-imaging) branch master updated: Fix PMD UnnecessaryFullyQualifiedName

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


The following commit(s) were added to refs/heads/master by this push:
     new f66ed0a6 Fix PMD UnnecessaryFullyQualifiedName
f66ed0a6 is described below

commit f66ed0a689b276a9380cff07913cb389c7c6c1f9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 27 07:43:56 2024 -0400

    Fix PMD UnnecessaryFullyQualifiedName
---
 src/changes/changes.xml                                           | 1 +
 .../java/org/apache/commons/imaging/common/BinaryFunctions.java   | 2 +-
 .../java/org/apache/commons/imaging/common/RationalNumber.java    | 2 +-
 .../java/org/apache/commons/imaging/formats/png/PngColorType.java | 8 ++++----
 .../org/apache/commons/imaging/formats/tiff/TiffDirectory.java    | 2 +-
 .../java/org/apache/commons/imaging/formats/tiff/TiffTags.java    | 4 ++--
 .../commons/imaging/formats/tiff/constants/TiffDirectoryType.java | 2 +-
 .../org/apache/commons/imaging/formats/webp/WebPChunkType.java    | 2 +-
 .../org/apache/commons/imaging/internal/ImageParserFactory.java   | 4 ++--
 9 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 83e4f3eb..a7209a98 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -49,6 +49,7 @@ The <action> type attribute can be add,update,fix,remove.
     <release version="1.0.0-alpha6" date="YYYY-MM-DD" description="The 1.0.0-alpha6 release requires Java 8.">
       <!-- FIX -->
       <action dev="ggregory" type="fix" due-to="Gary Gregory">Replace Locale.ENGLISH with Locale.ROOT processing file names.</action>
+      <action dev="ggregory" type="fix" due-to="Gary Gregory">Fix PMD UnnecessaryFullyQualifiedName.</action>
       <!-- ADD -->
       <action dev="ggregory" type="fix" due-to="Arnout Engelen">Add an Imaging-specific security page #439.</action>
       <!-- UPDATE -->
diff --git a/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java b/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
index 44b9af8b..432df236 100644
--- a/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
+++ b/src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java
@@ -273,7 +273,7 @@ public final class BinaryFunctions {
      * @throws IOException if it fails to read from the given input stream
      */
     public static boolean searchQuad(final int quad, final InputStream bis) throws IOException {
-        final byte[] needle = BinaryFunctions.quadsToByteArray(quad);
+        final byte[] needle = quadsToByteArray(quad);
         int b = -1;
         int position = 0;
         while ((b = bis.read()) != -1) {
diff --git a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
index cfdfba03..1f4a8a5b 100644
--- a/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
+++ b/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
@@ -140,7 +140,7 @@ public class RationalNumber extends Number {
         final int maxIterations = 100; // value is quite high, actually.
                                        // shouldn't matter.
         for (int count = 0; bestOption.error > TOLERANCE && count < maxIterations; count++) {
-            final RationalNumber mediant = RationalNumber.factoryMethod(low.rationalNumber.numerator + high.rationalNumber.numerator,
+            final RationalNumber mediant = factoryMethod(low.rationalNumber.numerator + high.rationalNumber.numerator,
                     low.rationalNumber.divisor + high.rationalNumber.divisor);
             final Option mediantOption = Option.factory(mediant, value);
 
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
index daadd4be..e0310b69 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
@@ -30,14 +30,14 @@ public enum PngColorType {
     static PngColorType getColorType(final boolean alpha, final boolean grayscale) {
         if (grayscale) {
             if (alpha) {
-                return PngColorType.GREYSCALE_WITH_ALPHA;
+                return GREYSCALE_WITH_ALPHA;
             }
-            return PngColorType.GREYSCALE;
+            return GREYSCALE;
         }
         if (alpha) {
-            return PngColorType.TRUE_COLOR_WITH_ALPHA;
+            return TRUE_COLOR_WITH_ALPHA;
         }
-        return PngColorType.TRUE_COLOR;
+        return TRUE_COLOR;
     }
 
     public static PngColorType getColorType(final int value) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index 7e30f129..7e471596 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -123,7 +123,7 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
     }
 
     public String description() {
-        return TiffDirectory.description(type);
+        return description(type);
     }
 
     public void dump() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
index 3eef2154..55ed9595 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffTags.java
@@ -48,8 +48,8 @@ final class TiffTags {
 
     private static final List<TagInfo> ALL_TAGS = makeMergedTagList();
 
-    private static final Map<Integer, List<TagInfo>> ALL_TAG_MAP = makeTagMap(TiffTags.ALL_TAGS);
-    private static final Map<Integer, Integer> TAG_COUNTS = countTags(TiffTags.ALL_TAGS);
+    private static final Map<Integer, List<TagInfo>> ALL_TAG_MAP = makeTagMap(ALL_TAGS);
+    private static final Map<Integer, Integer> TAG_COUNTS = countTags(ALL_TAGS);
 
     private static Map<Integer, Integer> countTags(final List<TagInfo> tags) {
         final Map<Integer, Integer> map = new HashMap<>();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
index 24c97311..bee21fed 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/constants/TiffDirectoryType.java
@@ -51,7 +51,7 @@ public enum TiffDirectoryType {
                 return tiffDirectoryType;
             }
         }
-        return TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN;
+        return EXIF_DIRECTORY_UNKNOWN;
     }
 
     private final boolean isImageDirectory;
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
index e9186172..9458cb01 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
@@ -88,7 +88,7 @@ public enum WebPChunkType {
         WebPChunk make(int type, int size, byte[] bytes) throws IOException, ImagingException;
     }
 
-    private static final WebPChunkType[] types = WebPChunkType.values();
+    private static final WebPChunkType[] types = values();
 
     static WebPChunkType findType(final int chunkType) {
         for (final WebPChunkType type : types) {
diff --git a/src/main/java/org/apache/commons/imaging/internal/ImageParserFactory.java b/src/main/java/org/apache/commons/imaging/internal/ImageParserFactory.java
index 51caa78a..4d399f91 100644
--- a/src/main/java/org/apache/commons/imaging/internal/ImageParserFactory.java
+++ b/src/main/java/org/apache/commons/imaging/internal/ImageParserFactory.java
@@ -38,12 +38,12 @@ public final class ImageParserFactory {
         // TODO: circular dependency between Imaging and internal Util class below.
         final ImageFormat format = Imaging.guessFormat(byteSource);
         if (!format.equals(ImageFormats.UNKNOWN)) {
-            return ImageParserFactory.getImageParser(format);
+            return getImageParser(format);
         }
 
         final String fileName = byteSource.getFileName();
         if (fileName != null) {
-            return ImageParserFactory.getImageParser(fileName);
+            return getImageParser(fileName);
         }
 
         throw new IllegalArgumentException("Can't parse this format.");