Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format numbers in message strings with US locale #100

Merged
merged 1 commit into from
Feb 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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