Skip to content

Commit

Permalink
Fix PMD UnnecessaryFullyQualifiedName
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Sep 27, 2024
1 parent 15acc84 commit f66ed0a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public static byte[] remainingBytes(final String name, final byte[] bytes, final
* @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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static RationalNumber valueOf(double value) {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public TiffDirectory(final int type, final List<TiffField> entries, final long o
}

public String description() {
return TiffDirectory.description(type);
return description(type);
}

public void dump() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static TiffDirectoryType getExifDirectoryType(final int type) {
return tiffDirectoryType;
}
}
return TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN;
return EXIF_DIRECTORY_UNKNOWN;
}

private final boolean isImageDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private interface ChunkConstructor {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public static <T extends ImagingParameters<T>> AbstractImageParser<T> getImagePa
// 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.");
Expand Down

0 comments on commit f66ed0a

Please sign in to comment.