always use Locale.ENGLISH for formatting Strings for the machine

For Strings that are meant to be displayed to humans, using the default
Locale makes sense.  But this String is meant to be parsed by code, so it
should force the Locale to make sure the digits are always rendered in the
same format.
This commit is contained in:
Hans-Christoph Steiner 2015-09-11 11:38:58 +02:00
parent 003f5331fa
commit 03d074a0e8

View File

@ -207,7 +207,8 @@ public class WifiStateChangeService extends Service {
// the following methods were not added until android-9/Gingerbread
for (InterfaceAddress address : netIf.getInterfaceAddresses()) {
if (inetAddress.equals(address.getAddress()) && !TextUtils.isEmpty(FDroidApp.ipAddressString)) {
String cidr = String.format("%s/%d", FDroidApp.ipAddressString, address.getNetworkPrefixLength());
String cidr = String.format(Locale.ENGLISH, "%s/%d",
FDroidApp.ipAddressString, address.getNetworkPrefixLength());
FDroidApp.subnetInfo = (new SubnetUtils(cidr)).getInfo();
break;
}