Skip to content

Commit

Permalink
Merge pull request #100 from bugsnag/kattrali/fix-locale-formatting
Browse files Browse the repository at this point in the history
Format numbers in message strings with US locale
  • Loading branch information
kattrali committed Feb 23, 2016
2 parents 7680a00 + ea1070e commit 3075c61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/bugsnag/android/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import java.util.Locale;

/**
* A Bugsnag Client instance allows you to use Bugsnag in your Android app.
Expand Down Expand Up @@ -617,7 +618,7 @@ public void run() {
void deliver(Notification notification, Error error) {
try {
int errorCount = notification.deliver();
Logger.info(String.format("Sent %d new error(s) to Bugsnag", errorCount));
Logger.info(String.format(Locale.US, "Sent %d new error(s) to Bugsnag", errorCount));
} catch (HttpClient.NetworkException e) {
Logger.info("Could not send error(s) to Bugsnag, saving to disk to send later");

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bugsnag/android/DeviceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static String getScreenResolution(Context appContext) {
if (resources == null)
return null;
DisplayMetrics metrics = resources.getDisplayMetrics();
return String.format("%dx%d", Math.max(metrics.widthPixels, metrics.heightPixels), Math.min(metrics.widthPixels, metrics.heightPixels));
return String.format(Locale.US, "%dx%d", Math.max(metrics.widthPixels, metrics.heightPixels), Math.min(metrics.widthPixels, metrics.heightPixels));
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/bugsnag/android/ErrorStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.Writer;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

import android.content.Context;

Expand Down Expand Up @@ -52,7 +53,7 @@ public void run() {

File[] errorFiles = exceptionDir.listFiles();
if(errorFiles != null && errorFiles.length > 0) {
Logger.info(String.format("Sending %d saved error(s) to Bugsnag", errorFiles.length));
Logger.info(String.format(Locale.US, "Sending %d saved error(s) to Bugsnag", errorFiles.length));

for(File errorFile : errorFiles) {
try {
Expand Down Expand Up @@ -94,7 +95,7 @@ void write(Error error) {
}
}

String filename = String.format("%s%d.json", path, System.currentTimeMillis());
String filename = String.format(Locale.US, "%s%d.json", path, System.currentTimeMillis());
Writer out = null;
try {
out = new FileWriter(filename);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/bugsnag/android/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import java.net.HttpURLConnection;
import java.net.URL;

import java.util.Locale;

class HttpClient {
static class BadResponseException extends Exception {
public BadResponseException(String url, int responseCode) {
super(String.format("Got non-200 response code (%d) from %s", responseCode, url));
super(String.format(Locale.US, "Got non-200 response code (%d) from %s", responseCode, url));
}
}

Expand Down

0 comments on commit 3075c61

Please sign in to comment.