Skip to content

Commit

Permalink
JSONObject BOM 处理 \uFEFF
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Wu committed Jul 18, 2017
1 parent d42d0b5 commit b184aa9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class FileCallback extends Callback<File> {
*/
private String destFileName;

public FileCallback(String destFilePath, String destFileName) {
protected FileCallback(String destFilePath, String destFileName) {
this.destFilePath = destFilePath;
this.destFileName = destFileName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
*/
public class HttpDispatcher {
private int maxRequests = 64;
private ExecutorService executorService;
private ThreadPoolExecutor executorService;

private final Deque<RealCall.AsyncCall> runningAsyncCalls = new ArrayDeque<>();
private final Deque<RealCall.AsyncCall> readyAsyncCalls = new ArrayDeque<>();

public HttpDispatcher(ExecutorService executorService) {
public HttpDispatcher(ThreadPoolExecutor executorService) {
this.executorService = executorService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public JSONObject parseNetworkResponse(Response response, AtomicBoolean isCancel
out.flush();
is.close();
out.close();
return new JSONObject(new String(out.toByteArray()));
String str = new String(out.toByteArray());
int i = str.indexOf("{");
String results = str.substring(i);
return new JSONObject(results);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public synchronized static HandlerExecutor getInstance() {
return instance;
}

private final Handler handler = new Handler(Looper.getMainLooper());
private final Handler handler = new Handler(Looper.getMainLooper());

@Override
public void execute(Runnable command) {
Expand Down

0 comments on commit b184aa9

Please sign in to comment.