From e970cecd329f932ba7c64ea0d83ba084520f45ca Mon Sep 17 00:00:00 2001 From: Ajmal Kunnummal Date: Tue, 9 May 2023 20:43:07 +0000 Subject: [PATCH] Fix minor lint errors related implicit Locale. --- src/main/java/com/vdurmont/emoji/Emoji.java | 5 +++-- src/main/java/com/vdurmont/emoji/EmojiParser.java | 3 ++- src/main/java/com/vdurmont/emoji/Fitzpatrick.java | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/vdurmont/emoji/Emoji.java b/src/main/java/com/vdurmont/emoji/Emoji.java index dfb6924f..83dba4a6 100644 --- a/src/main/java/com/vdurmont/emoji/Emoji.java +++ b/src/main/java/com/vdurmont/emoji/Emoji.java @@ -3,6 +3,7 @@ import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.List; +import java.util.Locale; /** * This class represents an emoji.
@@ -51,8 +52,8 @@ protected Emoji( for (int offset = 0; offset < stringLength; ) { final int codePoint = getUnicode().codePointAt(offset); - pointCodes[count] = String.format("&#%d;", codePoint); - pointCodesHex[count++] = String.format("&#x%x;", codePoint); + pointCodes[count] = String.format(Locale.getDefault(), "&#%d;", codePoint); + pointCodesHex[count++] = String.format(Locale.getDefault(), "&#x%x;", codePoint); offset += Character.charCount(codePoint); } diff --git a/src/main/java/com/vdurmont/emoji/EmojiParser.java b/src/main/java/com/vdurmont/emoji/EmojiParser.java index b6294a47..e5b1ecef 100644 --- a/src/main/java/com/vdurmont/emoji/EmojiParser.java +++ b/src/main/java/com/vdurmont/emoji/EmojiParser.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Locale; /** * Provides methods to parse strings with emojis. @@ -514,7 +515,7 @@ public Fitzpatrick getFitzpatrick() { } public String getFitzpatrickType() { - return hasFitzpatrick() ? fitzpatrick.name().toLowerCase() : ""; + return hasFitzpatrick() ? fitzpatrick.name().toLowerCase(Locale.getDefault()) : ""; } public String getFitzpatrickUnicode() { diff --git a/src/main/java/com/vdurmont/emoji/Fitzpatrick.java b/src/main/java/com/vdurmont/emoji/Fitzpatrick.java index bdbcbc65..34a0a551 100644 --- a/src/main/java/com/vdurmont/emoji/Fitzpatrick.java +++ b/src/main/java/com/vdurmont/emoji/Fitzpatrick.java @@ -1,5 +1,7 @@ package com.vdurmont.emoji; +import java.util.Locale; + /** * Enum that represents the Fitzpatrick modifiers supported by the emojis. */ @@ -50,7 +52,7 @@ public static Fitzpatrick fitzpatrickFromUnicode(String unicode) { public static Fitzpatrick fitzpatrickFromType(String type) { try { - return Fitzpatrick.valueOf(type.toUpperCase()); + return Fitzpatrick.valueOf(type.toUpperCase(Locale.getDefault())); } catch (IllegalArgumentException e) { return null; }