Skip to content

Commit

Permalink
Merge pull request #317 from johnjaylward/fixLocale
Browse files Browse the repository at this point in the history
make sure locale independent data is not upper/lowercased incorrectly…
  • Loading branch information
stleary committed Feb 20, 2017
2 parents 5ff8b4c + eb806f4 commit 724fb88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion HTTP.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ of this software and associated documentation files (the "Software"), to deal
*/

import java.util.Iterator;
import java.util.Locale;

/**
* Convert an HTTP header to a JSONObject and back.
Expand Down Expand Up @@ -74,7 +75,7 @@ public static JSONObject toJSONObject(String string) throws JSONException {
String token;

token = x.nextToken();
if (token.toUpperCase().startsWith("HTTP")) {
if (token.toUpperCase(Locale.ROOT).startsWith("HTTP")) {

// Response

Expand Down
4 changes: 2 additions & 2 deletions JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1157,9 +1157,9 @@ private void populateMap(Object bean) {
&& Character.isUpperCase(key.charAt(0))
&& method.getParameterTypes().length == 0) {
if (key.length() == 1) {
key = key.toLowerCase();
key = key.toLowerCase(Locale.ROOT);
} else if (!Character.isUpperCase(key.charAt(1))) {
key = key.substring(0, 1).toLowerCase()
key = key.substring(0, 1).toLowerCase(Locale.ROOT)
+ key.substring(1);
}

Expand Down

0 comments on commit 724fb88

Please sign in to comment.