removed redundant null checks.
Fixed bug in Streams.copy where it was not honoring the closeInput and closeOutput parameters. Suppressed spurious unused warnings
This commit is contained in:
parent
2b1f3eec15
commit
1a4bea7334
@ -69,9 +69,7 @@ public final class RequestSender {
|
||||
String contentLength = String.valueOf(requestBodyContents.length());
|
||||
setHeader(conn, "Content-Length", contentLength, true);
|
||||
addRequestParams(conn, request.getHeaders());
|
||||
if (requestBodyContents != null) {
|
||||
Streams.copy(requestBodyContents, conn.getOutputStream(), false);
|
||||
}
|
||||
Streams.copy(requestBodyContents, conn.getOutputStream(), false);
|
||||
|
||||
// Initiate the sending of the request.
|
||||
conn.connect();
|
||||
|
@ -61,17 +61,15 @@ public final class RestRequestSender {
|
||||
R requestBody = request.getBody();
|
||||
String requestBodyContents = "";
|
||||
// Android Java VM ignore Content-Length if setDoOutput is not set
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoOutput(true);
|
||||
if (requestBody != null) {
|
||||
requestBodyContents = gson.toJson(requestBody);
|
||||
}
|
||||
String contentLength = String.valueOf(requestBodyContents.length());
|
||||
setHeader(conn, "Content-Length", contentLength, true);
|
||||
addRequestParams(conn, request.getHeaders());
|
||||
if (requestBodyContents != null) {
|
||||
Streams.copy(requestBodyContents, conn.getOutputStream(), false);
|
||||
}
|
||||
|
||||
Streams.copy(requestBodyContents, conn.getOutputStream(), false);
|
||||
|
||||
// Initiate the sending of the request.
|
||||
conn.connect();
|
||||
} catch (IOException e) {
|
||||
|
@ -37,8 +37,8 @@ final class Streams {
|
||||
dst.write(buf, 0, count);
|
||||
}
|
||||
} finally {
|
||||
src.close();
|
||||
dst.close();
|
||||
if (closeInput) src.close();
|
||||
if (closeOutput) dst.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,9 @@ import com.google.gson.webservice.definition.WebServiceResponse.Builder;
|
||||
|
||||
public class WebServiceCallServerBuilder {
|
||||
|
||||
public WebServiceCallServerBuilder(WebServiceCallSpec callSpec,
|
||||
WebServiceRequest wsRequest, Builder responseBuilder) {
|
||||
public WebServiceCallServerBuilder(
|
||||
@SuppressWarnings("unused") WebServiceCallSpec callSpec,
|
||||
@SuppressWarnings("unused") WebServiceRequest wsRequest,
|
||||
@SuppressWarnings("unused") Builder responseBuilder) {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user