Merge pull request #3 from Microsoft/host-split

Fix linter issues
This commit is contained in:
wangjun 2016-09-01 10:32:21 +08:00 коммит произвёл GitHub
Родитель 31b29e5cbc 18bf7991ba
Коммит 23bec2f013
2 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -60,6 +60,7 @@ import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
@ -67,7 +68,8 @@ public class FaceServiceRestClient implements FaceServiceClient {
private final WebServiceRequest mRestCall;
private Gson mGson = new GsonBuilder().setDateFormat("M/d/yyyy h:m:s a").create();
private String mServiceHost = "https://api.projectoxford.ai/face/v1.0";
private static final String DEFAULT_API_ROOT = "https://api.projectoxford.ai/face/v1.0";
private final String mServiceHost;
private static final String DETECT_QUERY = "detect";
private static final String VERIFY_QUERY = "verify";
@ -84,11 +86,11 @@ public class FaceServiceRestClient implements FaceServiceClient {
private static final String DATA = "data";
public FaceServiceRestClient(String subscriptionKey) {
mRestCall = new WebServiceRequest(subscriptionKey);
this(DEFAULT_API_ROOT, subscriptionKey);
}
public FaceServiceRestClient(String serviceHost, String subscriptionKey) {
mServiceHost = serviceHost;
mServiceHost = serviceHost.replaceAll("/$", "");
mRestCall = new WebServiceRequest(subscriptionKey);
}
@ -345,7 +347,7 @@ public class FaceServiceRestClient implements FaceServiceClient {
}
if (targetFace != null) {
String targetFaceString = String.format("%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
String targetFaceString = String.format(Locale.ENGLISH, "%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
params.put("targetFace", targetFaceString);
}
@ -368,7 +370,7 @@ public class FaceServiceRestClient implements FaceServiceClient {
}
if (targetFace != null) {
String targetFaceString = String.format("%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
String targetFaceString = String.format(Locale.ENGLISH, "%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
params.put("targetFace", targetFaceString);
}
@ -545,7 +547,7 @@ public class FaceServiceRestClient implements FaceServiceClient {
}
if (targetFace != null) {
String targetFaceString = String.format("%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
String targetFaceString = String.format(Locale.ENGLISH, "%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
params.put("targetFace", targetFaceString);
}
@ -565,7 +567,7 @@ public class FaceServiceRestClient implements FaceServiceClient {
}
if (targetFace != null) {
String targetFaceString = String.format("%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
String targetFaceString = String.format(Locale.ENGLISH, "%1d,%2d,%3d,%4d", targetFace.left, targetFace.top, targetFace.width, targetFace.height);
params.put("targetFace", targetFaceString);
}

Просмотреть файл

@ -53,6 +53,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Locale;
import java.util.Map;
public class WebServiceRequest {
@ -147,7 +148,7 @@ public class WebServiceRequest {
if (contentType != null && !(contentType.length() == 0)) {
request.setHeader(CONTENT_TYPE, contentType);
if (contentType.toLowerCase().contains(OCTET_STREAM)) {
if (contentType.toLowerCase(Locale.ENGLISH).contains(OCTET_STREAM)) {
isStream = true;
}
} else {