From 4dfc063056cd349498de5b50746e13fbdcaf9170 Mon Sep 17 00:00:00 2001 From: vkolesnikov Date: Tue, 19 Dec 2023 17:19:15 +0200 Subject: [PATCH] [core/connection] Change logic of getXmlLang method. --- .../jivesoftware/smack/ConnectionConfiguration.java | 10 +++------- version | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java index 2a0165009..0585d4e9b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java @@ -598,13 +598,9 @@ public Locale getLanguage() { * @return the stream language to use when connecting to the server. */ public String getXmlLang() { - // TODO: Change to Locale.toLanguageTag() once Smack's minimum Android API level is 21 or higher. - // This will need a workaround for new Locale("").getLanguageTag() returning "und". Expected - // behavior of this function: - // - returns null if language is null - // - returns "" if language.getLanguage() returns the empty string - // - returns language.toLanguageTag() otherwise - return language != null ? language.toString().replace("_", "-") : null; + if (language == null) return null; + if (language.getLanguage().isEmpty()) return ""; + return language.toLanguageTag(); } /** diff --git a/version b/version index ca5e5d658..0f898b140 100644 --- a/version +++ b/version @@ -1 +1 @@ -4.4.4-intermedia-1.3.0 +4.4.4-intermedia-1.3.1