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 2023/07/08 12:23:28 UTC

[commons-imaging] branch master updated: Use modern Map API

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 04db7e4f Use modern Map API
     new 062a1c01 Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-imaging.git
04db7e4f is described below

commit 04db7e4f857a328170283f076a601ebd5ea7f15b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Jul 8 08:13:29 2023 -0400

    Use modern Map API
---
 .../java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
index 05c9ec2c..00ffb197 100644
--- a/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
@@ -283,11 +283,7 @@ public class XpmImageParser extends ImageParser<XpmImagingParameters> {
         }
         loadColorNames();
         final String colorLowercase = color.toLowerCase(Locale.ENGLISH);
-        final Integer integer = colorNames.get(colorLowercase);
-        if (integer != null) {
-            return integer;
-        }
-        return 0x00000000;
+        return colorNames.getOrDefault(colorLowercase, 0x00000000);
     }
 
     private boolean parseNextString(final BasicCParser cParser, final StringBuilder stringBuilder) throws IOException, ImagingException {