White noise: formatting

This commit is contained in:
Francesco Chicchiriccò 2014-05-05 12:29:56 +02:00
parent 7c079a1a78
commit 585ddaead8
3 changed files with 17 additions and 18 deletions

View File

@ -17,7 +17,6 @@ package org.apache.olingo.client.core.communication.request;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
@ -87,7 +86,7 @@ public abstract class AbstractRequest {
response.getStatusLine().getReasonPhrase(),
isXML);
}
if (response.getStatusLine().getStatusCode() >= 500) {
throw new ODataServerErrorException(response.getStatusLine());
} else {

View File

@ -62,8 +62,8 @@ public class ProxyWrapperHttpClientFactory implements HttpClientFactory {
this.proxyPassword = proxyPassword;
this.wrapped = wrapped;
}
public DefaultHttpClientFactory getWrappedHttpClientFactory(){
public DefaultHttpClientFactory getWrappedHttpClientFactory() {
return this.wrapped;
}

View File

@ -38,6 +38,7 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.entity.AbstractHttpEntity;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.InputStreamEntity;
@ -389,25 +390,24 @@ public final class URIUtils {
return value;
}
private static boolean shouldUseRepeatableHttpBodyEntry(final CommonODataClient<?> client)
{
private static boolean shouldUseRepeatableHttpBodyEntry(final CommonODataClient<?> client) {
// returns true for authentication request in case of http401 which needs retry so requires being repeatable.
HttpClientFactory httpclientFactory = client.getConfiguration().getHttpClientFactory();
if(httpclientFactory instanceof BasicAuthHttpClientFactory){
HttpClientFactory httpclientFactory = client.getConfiguration().getHttpClientFactory();
if (httpclientFactory instanceof BasicAuthHttpClientFactory) {
return true;
} else if (httpclientFactory instanceof ProxyWrapperHttpClientFactory){
ProxyWrapperHttpClientFactory tmp = (ProxyWrapperHttpClientFactory)httpclientFactory;
if(tmp.getWrappedHttpClientFactory() instanceof BasicAuthHttpClientFactory){
} else if (httpclientFactory instanceof ProxyWrapperHttpClientFactory) {
ProxyWrapperHttpClientFactory tmp = (ProxyWrapperHttpClientFactory) httpclientFactory;
if (tmp.getWrappedHttpClientFactory() instanceof BasicAuthHttpClientFactory) {
return true;
}
}
return false;
}
public static AbstractHttpEntity buildInputStreamEntity(final CommonODataClient<?> client, final InputStream input) {
AbstractHttpEntity entity = null;
boolean repeatableRequired= shouldUseRepeatableHttpBodyEntry(client);
public static HttpEntity buildInputStreamEntity(final CommonODataClient<?> client, final InputStream input) {
HttpEntity entity;
boolean repeatableRequired = shouldUseRepeatableHttpBodyEntry(client);
if (!repeatableRequired) {
entity = new InputStreamEntity(input, -1);
} else {
@ -420,9 +420,9 @@ public final class URIUtils {
entity = new ByteArrayEntity(bytes);
}
// both entities can be sent in chunked way or not
entity.setChunked(client.getConfiguration().isUseChuncked());
((AbstractHttpEntity) entity).setChunked(client.getConfiguration().isUseChuncked());
return entity;
}
}