mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:03:39 +00:00
Fix implicit locale string formatting bugs
Depending on the phone language the default format may use Arabic numerals, etc. when not desired. Bug: fixes #7006 Closes #7040
This commit is contained in:
parent
9a876a3672
commit
eb456ef2b0
@ -25,6 +25,7 @@ import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
@ -63,7 +64,7 @@ public class AttachmentServer implements Runnable {
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
return Uri.parse(String.format("http://127.0.0.1:%d/%s", port, auth));
|
||||
return Uri.parse(String.format(Locale.ROOT, "http://127.0.0.1:%d/%s", port, auth));
|
||||
}
|
||||
|
||||
public void start() {
|
||||
|
@ -12,6 +12,7 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -182,7 +183,7 @@ public class XmlBackup {
|
||||
bufferedWriter.newLine();
|
||||
bufferedWriter.write(CREATED_BY);
|
||||
bufferedWriter.newLine();
|
||||
bufferedWriter.write(String.format(OPEN_TAG_SMSES, count));
|
||||
bufferedWriter.write(String.format(Locale.ROOT, OPEN_TAG_SMSES, count));
|
||||
}
|
||||
|
||||
public void writeItem(XmlBackupItem item) throws IOException {
|
||||
|
@ -6,6 +6,8 @@ import android.net.ConnectivityManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class TelephonyUtil {
|
||||
private static final String TAG = TelephonyUtil.class.getSimpleName();
|
||||
|
||||
@ -25,7 +27,7 @@ public class TelephonyUtil {
|
||||
return tm.getNetworkOperator();
|
||||
} else if (configMcc != 0 && configMnc != 0) {
|
||||
Log.w(TAG, "Choosing MCC+MNC info from current context's Configuration");
|
||||
return String.format("%03d%d",
|
||||
return String.format(Locale.ROOT, "%03d%d",
|
||||
configMcc,
|
||||
configMnc == Configuration.MNC_ZERO ? 0 : configMnc);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user