Repository: olingo-odata4 Updated Branches: refs/heads/master 9f8c8b7e0 -> 6e2ddfbc8
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1406411/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java index ea510bf..d920a98 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractRequest.java @@ -48,18 +48,20 @@ public abstract class AbstractRequest { protected void checkResponse( final CommonODataClient<?> odataClient, final HttpResponse response, final String accept) { - try { - final ODataRuntimeException exception = ODataErrorResponseChecker. - checkResponse(odataClient, - response.getStatusLine(), - response.getEntity() == null ? null : response.getEntity().getContent(), - accept); - if (exception != null) { - throw exception; + if (response.getStatusLine().getStatusCode() >= 400) { + try { + final ODataRuntimeException exception = ODataErrorResponseChecker.checkResponse( + odataClient, + response.getStatusLine(), + response.getEntity() == null ? null : response.getEntity().getContent(), + accept); + if (exception != null) { + throw exception; + } + } catch (IOException e) { + throw new ODataRuntimeException( + "Received '" + response.getStatusLine() + "' but could not extract error body", e); } - } catch (IOException e) { - throw new ODataRuntimeException( - "Received '" + response.getStatusLine() + "' but could not extract error body", e); } } } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1406411/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java index 261fc37..e84928f 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java @@ -38,6 +38,7 @@ import org.apache.olingo.commons.api.serialization.ODataSerializerException; import java.io.InputStream; import java.net.URI; +import org.apache.http.HttpStatus; /** * This class implements an OData update request. @@ -88,7 +89,13 @@ public class ODataEntityUpdateRequestImpl<E extends CommonODataEntity> ((HttpEntityEnclosingRequestBase) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input)); try { - return new ODataEntityUpdateResponseImpl(odataClient, httpClient, doExecute()); + final HttpResponse httpResponse = doExecute(); + final ODataEntityUpdateResponseImpl response = + new ODataEntityUpdateResponseImpl(odataClient, httpClient, httpResponse); + if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT) { + response.close(); + } + return response; } finally { IOUtils.closeQuietly(input); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1406411/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java ---------------------------------------------------------------------- diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java index 9558d5d..a748980 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java @@ -46,6 +46,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Map; import java.util.TreeMap; +import org.apache.olingo.commons.api.ODataRuntimeException; /** * Abstract representation of an OData response. @@ -182,7 +183,7 @@ public abstract class AbstractODataResponse implements ODataResponse { this.payload = res.getEntity() == null ? null : res.getEntity().getContent(); } catch (Exception e) { LOG.error("Error retrieving payload", e); - throw new IllegalStateException(e); + throw new ODataRuntimeException(e); } for (Header header : res.getAllHeaders()) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1406411/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index d9c083a..5f4dcf6 100644 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.olingo</groupId> @@ -176,7 +176,12 @@ <version>${android.platform.version}</version> <scope>provided</scope> </dependency> - + <dependency> + <groupId>javax.xml.stream</groupId> + <artifactId>stax-api</artifactId> + <version>${stax.api.version}</version> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> @@ -281,11 +286,6 @@ <version>2.3</version> </plugin> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <version>1.9</version> - </plugin> - <plugin> <groupId>org.antlr</groupId> <artifactId>antlr4-maven-plugin</artifactId> <version>${antlr.version}</version> @@ -326,11 +326,6 @@ <version>2.6</version> </plugin> <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>jarjar-maven-plugin</artifactId> - <version>1.9</version> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version>
