From 00aec57ca0e05704996ff963dbd5d3d8eb88c485 Mon Sep 17 00:00:00 2001 From: Tobias Gall Date: Fri, 5 Jun 2020 14:17:11 +0200 Subject: [PATCH] Fix missing leading zeros in conference number Rewrite is to use only string manipulation as converting to Int removes leading zeros. fixes #9769 --- .../bigbluebutton/api/ParamsProcessorUtil.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index fa5b0fbb73..89930a94b7 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -119,15 +119,15 @@ public class ParamsProcessorUtil { private String formatConfNum(String s) { if (s.length() > 5) { - Long confNumL = Long.parseLong(s); - - Locale numFormatLocale = new Locale("en", "US"); - String formatPattern = "#,###"; - DecimalFormatSymbols unusualSymbols = new DecimalFormatSymbols(numFormatLocale); - unusualSymbols.setGroupingSeparator(' '); - DecimalFormat numFormatter = new DecimalFormat(formatPattern, unusualSymbols); - numFormatter.setGroupingSize(3); - return numFormatter.format(confNumL); + /* Reverse conference number. + * Put a whitespace every third char. + * Reverse it again to display it correctly. + * Trim leading whitespaces. + * */ + String confNumReversed = new StringBuilder(s).reverse().toString(); + String confNumSplit = confNumReversed.replaceAll("(.{3})", "$1 "); + String confNumL = new StringBuilder(confNumSplit).reverse().toString().trim(); + return confNumL; } return s;