[OLINGO-399] Changing flush exception management done in OLINGO-369
This commit is contained in:
parent
0a0344d69b
commit
7be1e99213
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.ext.proxy.api;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
public class ODataFlushException extends ODataRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 6077239115913182327L;
|
||||
|
||||
private final int statusCode;
|
||||
|
||||
private final List<ODataResponseError> errors;
|
||||
|
||||
public ODataFlushException(final int statusCode, final List<ODataResponseError> errors) {
|
||||
super("Errors found during flush()");
|
||||
this.statusCode = statusCode;
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public List<ODataResponseError> getErrors() {
|
||||
return errors;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.ext.proxy.api;
|
||||
|
||||
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
public class ODataResponseError {
|
||||
|
||||
private final ODataRuntimeException exception;
|
||||
|
||||
private final int index;
|
||||
|
||||
private final ODataRequest request;
|
||||
|
||||
public ODataResponseError(final ODataRuntimeException exception, final int index, final ODataRequest request) {
|
||||
this.exception = exception;
|
||||
this.index = index;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public ODataRuntimeException getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public ODataRequest getRequest() {
|
||||
return request;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,9 +19,7 @@
|
|||
package org.apache.olingo.ext.proxy.api;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
|
||||
/**
|
||||
* Interface for container operations.
|
||||
|
@ -31,16 +29,15 @@ public interface PersistenceManager extends Serializable {
|
|||
/**
|
||||
* Flushes all pending changes to the OData service.
|
||||
*
|
||||
* @return a list where n-th item is either null (if corresponding request went out successfully) or the exception
|
||||
* bearing the error returned from the service.
|
||||
* @throws ODataFlushException in case of errors
|
||||
*/
|
||||
List<ODataResponseError> flush();
|
||||
void flush();
|
||||
|
||||
/**
|
||||
* Asynchronously flushes all pending changes to the OData service.
|
||||
*
|
||||
* @return a future handle for a list where n-th item is either null (if corresponding request went out successfully)
|
||||
* or the exception bearing the error returned from the service.
|
||||
* @return a future handle
|
||||
* @throws ODataFlushException in case of errors
|
||||
*/
|
||||
Future<List<ODataResponseError>> flushAsync();
|
||||
Future<Void> flushAsync();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.olingo.client.api.communication.request.cud.v4.ODataReferenceA
|
|||
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
|
||||
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.domain.CommonODataEntity;
|
||||
import org.apache.olingo.commons.api.domain.ODataLink;
|
||||
import org.apache.olingo.commons.api.domain.ODataLinkType;
|
||||
|
@ -51,6 +50,7 @@ import org.apache.olingo.ext.proxy.api.EdmStreamValue;
|
|||
import org.apache.olingo.ext.proxy.context.AttachedEntity;
|
||||
import org.apache.olingo.ext.proxy.context.AttachedEntityStatus;
|
||||
import org.apache.olingo.ext.proxy.context.EntityLinkDesc;
|
||||
import org.apache.olingo.ext.proxy.utils.ClassUtils;
|
||||
import org.apache.olingo.ext.proxy.utils.CoreUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -71,19 +71,20 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Future<List<ODataResponseError>> flushAsync() {
|
||||
return service.getClient().getConfiguration().getExecutor().submit(new Callable<List<ODataResponseError>>() {
|
||||
public Future<Void> flushAsync() {
|
||||
return service.getClient().getConfiguration().getExecutor().submit(new Callable<Void>() {
|
||||
@Override
|
||||
public List<ODataResponseError> call() throws Exception {
|
||||
return flush();
|
||||
public Void call() throws Exception {
|
||||
flush();
|
||||
return ClassUtils.returnVoid();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract List<ODataResponseError> doFlush(PersistenceChanges changes, TransactionItems items);
|
||||
protected abstract void doFlush(PersistenceChanges changes, TransactionItems items);
|
||||
|
||||
@Override
|
||||
public List<ODataResponseError> flush() {
|
||||
public void flush() {
|
||||
final PersistenceChanges changes = new PersistenceChanges();
|
||||
final TransactionItems items = new TransactionItems();
|
||||
|
||||
|
@ -110,13 +111,11 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
items.put(null, pos);
|
||||
}
|
||||
|
||||
final List<ODataResponseError> result = new ArrayList<ODataResponseError>();
|
||||
if (!items.isEmpty()) {
|
||||
result.addAll(doFlush(changes, items));
|
||||
doFlush(changes, items);
|
||||
}
|
||||
|
||||
service.getContext().detachAll();
|
||||
return result;
|
||||
}
|
||||
|
||||
private ODataLink buildNavigationLink(final String name, final URI uri, final ODataLinkType type) {
|
||||
|
@ -263,7 +262,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
|
||||
? URI.create("$" + startingPos)
|
||||
: URIUtils.getURI(
|
||||
service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
|
||||
service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString());
|
||||
queueUpdate(handler, targetURI, entity, changeset);
|
||||
pos++;
|
||||
items.put(handler, pos);
|
||||
|
@ -275,8 +274,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
|
||||
? URI.create("$" + startingPos + "/$value")
|
||||
: URIUtils.getURI(
|
||||
service.getClient().getServiceRoot(),
|
||||
handler.getEntity().getEditLink().toASCIIString() + "/$value");
|
||||
service.getClient().getServiceRoot(),
|
||||
handler.getEntity().getEditLink().toASCIIString() + "/$value");
|
||||
|
||||
queueUpdateMediaEntity(handler, targetURI, handler.getStreamChanges(), changeset);
|
||||
|
||||
|
@ -290,8 +289,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
for (Map.Entry<String, EdmStreamValue> streamedChanges : handler.getStreamedPropertyChanges().entrySet()) {
|
||||
final URI targetURI = currentStatus == AttachedEntityStatus.NEW
|
||||
? URI.create("$" + startingPos) : URIUtils.getURI(
|
||||
service.getClient().getServiceRoot(),
|
||||
CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
|
||||
service.getClient().getServiceRoot(),
|
||||
CoreUtils.getMediaEditLink(streamedChanges.getKey(), entity).toASCIIString());
|
||||
|
||||
queueUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset);
|
||||
|
||||
|
@ -459,10 +458,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
|
||||
? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(handler.getEntityURI(),
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
: ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(handler.getEntityURI(),
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
|
||||
req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
|
||||
|
||||
|
@ -509,10 +508,10 @@ abstract class AbstractPersistenceManager implements PersistenceManager {
|
|||
service.getClient().getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0
|
||||
? ((org.apache.olingo.client.api.v3.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(uri,
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
org.apache.olingo.client.api.communication.request.cud.v3.UpdateType.PATCH, changes)
|
||||
: ((org.apache.olingo.client.api.v4.EdmEnabledODataClient) service.getClient()).getCUDRequestFactory().
|
||||
getEntityUpdateRequest(uri,
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
org.apache.olingo.client.api.communication.request.cud.v4.UpdateType.PATCH, changes);
|
||||
|
||||
req.setPrefer(new ODataPreferences(service.getClient().getServiceVersion()).returnContent());
|
||||
|
||||
|
|
|
@ -92,7 +92,8 @@ public final class EntityContainerInvocationHandler extends AbstractInvocationHa
|
|||
if (isSelfMethod(method, args)) {
|
||||
return invokeSelfMethod(method, args);
|
||||
} else if ("flush".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
|
||||
return service.getPersistenceManager().flush();
|
||||
service.getPersistenceManager().flush();
|
||||
return ClassUtils.returnVoid();
|
||||
} else if ("flushAsync".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
|
||||
return service.getPersistenceManager().flushAsync();
|
||||
} else if ("operations".equals(method.getName()) && ArrayUtils.isEmpty(args)) {
|
||||
|
|
|
@ -19,9 +19,8 @@
|
|||
package org.apache.olingo.ext.proxy.commons;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
|
||||
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||
|
@ -30,8 +29,10 @@ import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
|||
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
|
||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.ext.proxy.AbstractService;
|
||||
import org.apache.olingo.ext.proxy.api.ODataFlushException;
|
||||
import org.apache.olingo.ext.proxy.api.ODataResponseError;
|
||||
|
||||
/**
|
||||
* {@link org.apache.olingo.ext.proxy.api.PersistenceManager} implementation not using OData batch requests: any
|
||||
|
@ -46,60 +47,50 @@ public class NonTransactionalPersistenceManagerImpl extends AbstractPersistenceM
|
|||
}
|
||||
|
||||
@Override
|
||||
protected List<ODataResponseError> doFlush(final PersistenceChanges changes, final TransactionItems items) {
|
||||
final List<ODataResponseError> result = new ArrayList<ODataResponseError>();
|
||||
|
||||
protected void doFlush(final PersistenceChanges changes, final TransactionItems items) {
|
||||
final Map<Integer, URI> responses = new HashMap<Integer, URI>();
|
||||
int virtualContentID = 0;
|
||||
|
||||
int index = 0;
|
||||
for (Map.Entry<ODataBatchableRequest, EntityInvocationHandler> entry : changes.getChanges().entrySet()) {
|
||||
virtualContentID++;
|
||||
index++;
|
||||
|
||||
final ODataRequest request = ODataRequest.class.cast(entry.getKey());
|
||||
final ODataResponse response;
|
||||
try {
|
||||
final ODataRequest req = ODataRequest.class.cast(entry.getKey());
|
||||
String uri = req.getURI().toASCIIString();
|
||||
String uri = request.getURI().toASCIIString();
|
||||
if (uri.startsWith("$")) {
|
||||
int slashIndex = uri.indexOf('/');
|
||||
final Integer toBeReplaced = Integer.valueOf(uri.substring(1, slashIndex < 0 ? uri.length() : slashIndex));
|
||||
if (responses.containsKey(toBeReplaced)) {
|
||||
uri = uri.replace("$" + toBeReplaced, responses.get(Integer.valueOf(toBeReplaced)).toASCIIString());
|
||||
req.setURI(URI.create(uri));
|
||||
uri = uri.replace("$" + toBeReplaced, responses.get(toBeReplaced).toASCIIString());
|
||||
request.setURI(URI.create(uri));
|
||||
}
|
||||
}
|
||||
|
||||
final ODataResponse response;
|
||||
if (ODataStreamedRequest.class.isAssignableFrom(req.getClass())) {
|
||||
response = ((ODataStreamedRequest<?, ?>) req).payloadManager().getResponse();
|
||||
if (ODataStreamedRequest.class.isAssignableFrom(request.getClass())) {
|
||||
response = ((ODataStreamedRequest<?, ?>) request).payloadManager().getResponse();
|
||||
} else {
|
||||
response = ((ODataBasicRequest<?>) req).execute();
|
||||
response = ((ODataBasicRequest<?>) request).execute();
|
||||
}
|
||||
|
||||
if (entry.getValue() != null
|
||||
&& response instanceof ODataEntityCreateResponse && response.getStatusCode() == 201) {
|
||||
entry.getValue().setEntity(((ODataEntityCreateResponse<?>) response).getBody());
|
||||
responses.put(virtualContentID, entry.getValue().getEntityURI());
|
||||
responses.put(index, entry.getValue().getEntityURI());
|
||||
LOG.debug("Upgrade created object '{}'", entry.getValue());
|
||||
} else if (entry.getValue() != null
|
||||
&& response instanceof ODataEntityUpdateResponse && response.getStatusCode() == 200) {
|
||||
entry.getValue().setEntity(((ODataEntityUpdateResponse<?>) response).getBody());
|
||||
responses.put(virtualContentID, entry.getValue().getEntityURI());
|
||||
responses.put(index, entry.getValue().getEntityURI());
|
||||
LOG.debug("Upgrade updated object '{}'", entry.getValue());
|
||||
} else {
|
||||
responses.put(virtualContentID, null);
|
||||
responses.put(index, null);
|
||||
}
|
||||
|
||||
result.add(null);
|
||||
} catch (ODataResponseError e) {
|
||||
} catch (ODataRuntimeException e) {
|
||||
LOG.error("While performing {}", entry.getKey().getURI(), e);
|
||||
|
||||
if (service.getClient().getConfiguration().isContinueOnError()) {
|
||||
result.add(e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
throw new ODataFlushException(0, Collections.singletonList(new ODataResponseError(e, index, request)));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.olingo.ext.proxy.commons;
|
||||
|
||||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||
|
||||
class ResponseStatusLine implements StatusLine {
|
||||
|
||||
private final ODataResponse response;
|
||||
|
||||
public ResponseStatusLine(final ODataResponse response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolVersion getProtocolVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode() {
|
||||
return response.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReasonPhrase() {
|
||||
return response.getStatusMessage();
|
||||
}
|
||||
|
||||
}
|
|
@ -22,8 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.olingo.client.api.communication.ODataServerErrorException;
|
||||
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
|
||||
import org.apache.olingo.client.api.communication.request.ODataRequest;
|
||||
import org.apache.olingo.client.api.communication.request.ODataStreamedRequest;
|
||||
|
@ -37,8 +36,9 @@ import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResp
|
|||
import org.apache.olingo.client.api.communication.response.ODataResponse;
|
||||
import org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker;
|
||||
import org.apache.olingo.client.core.communication.request.batch.ODataChangesetResponseItem;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.ext.proxy.AbstractService;
|
||||
import org.apache.olingo.ext.proxy.api.ODataFlushException;
|
||||
import org.apache.olingo.ext.proxy.api.ODataResponseError;
|
||||
|
||||
/**
|
||||
* {@link org.apache.olingo.ext.proxy.api.PersistenceManager} implementation using OData batch requests to implement
|
||||
|
@ -57,7 +57,7 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
* Transactional changes commit.
|
||||
*/
|
||||
@Override
|
||||
protected List<ODataResponseError> doFlush(final PersistenceChanges changes, final TransactionItems items) {
|
||||
protected void doFlush(final PersistenceChanges changes, final TransactionItems items) {
|
||||
final CommonODataBatchRequest request =
|
||||
service.getClient().getBatchRequestFactory().getBatchRequest(service.getClient().getServiceRoot());
|
||||
((ODataRequest) request).setAccept(
|
||||
|
@ -65,9 +65,11 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
|
||||
final BatchManager batchManager = (BatchManager) ((ODataStreamedRequest) request).payloadManager();
|
||||
|
||||
final List<ODataRequest> requests = new ArrayList<ODataRequest>(changes.getChanges().size());
|
||||
final ODataChangeset changeset = batchManager.addChangeset();
|
||||
for (Map.Entry<ODataBatchableRequest, EntityInvocationHandler> entry : changes.getChanges().entrySet()) {
|
||||
changeset.addRequest(entry.getKey());
|
||||
requests.add(entry.getKey());
|
||||
}
|
||||
|
||||
final ODataBatchResponse response = batchManager.getResponse();
|
||||
|
@ -75,12 +77,12 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
// This should be 202 for service version <= 3.0 and 200 for service version >= 4.0 but it seems that
|
||||
// many service implementations are not fully compliant in this respect.
|
||||
if (response.getStatusCode() != 202 && response.getStatusCode() != 200) {
|
||||
throw new IllegalStateException("Operation failed");
|
||||
throw new ODataServerErrorException(new ResponseStatusLine(response));
|
||||
}
|
||||
|
||||
final List<ODataResponseError> result = new ArrayList<ODataResponseError>();
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
final List<ODataResponseError> errors = new ArrayList<ODataResponseError>();
|
||||
|
||||
final Iterator<ODataBatchResponseItem> batchResItor = response.getBody();
|
||||
if (!batchResItor.hasNext()) {
|
||||
throw new IllegalStateException("Unexpected operation result");
|
||||
|
@ -93,38 +95,21 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
|
||||
final ODataChangesetResponseItem chgres = (ODataChangesetResponseItem) item;
|
||||
|
||||
for (final Iterator<Integer> itor = items.sortedValues().iterator(); itor.hasNext();) {
|
||||
int index = 0;
|
||||
for (final Iterator<Integer> itor = items.sortedValues().iterator(); itor.hasNext(); index++) {
|
||||
final Integer changesetItemId = itor.next();
|
||||
LOG.debug("Expected changeset item {}", changesetItemId);
|
||||
|
||||
final ODataResponse res = chgres.next();
|
||||
if (res.getStatusCode() >= 400) {
|
||||
if (service.getClient().getConfiguration().isContinueOnError()) {
|
||||
result.add(ODataErrorResponseChecker.checkResponse(
|
||||
service.getClient(),
|
||||
new StatusLine() {
|
||||
@Override
|
||||
public ProtocolVersion getProtocolVersion() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode() {
|
||||
return res.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReasonPhrase() {
|
||||
return res.getStatusMessage();
|
||||
}
|
||||
},
|
||||
res.getRawResponse(),
|
||||
((ODataRequest) request).getAccept()));
|
||||
} else {
|
||||
throw new IllegalStateException("Transaction failed: " + res.getStatusMessage());
|
||||
errors.add(new ODataResponseError(ODataErrorResponseChecker.checkResponse(
|
||||
service.getClient(),
|
||||
new ResponseStatusLine(res),
|
||||
res.getRawResponse(),
|
||||
((ODataRequest) request).getAccept()), index, requests.get(index)));
|
||||
if (!service.getClient().getConfiguration().isContinueOnError()) {
|
||||
throw new ODataFlushException(response.getStatusCode(), errors);
|
||||
}
|
||||
} else {
|
||||
result.add(null);
|
||||
}
|
||||
|
||||
final EntityInvocationHandler handler = items.get(changesetItemId);
|
||||
|
@ -139,9 +124,11 @@ public class TransactionalPersistenceManagerImpl extends AbstractPersistenceMana
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!errors.isEmpty()) {
|
||||
throw new ODataFlushException(response.getStatusCode(), errors);
|
||||
}
|
||||
}
|
||||
response.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,9 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.junit.Test;
|
||||
|
||||
//CHECKSTYLE:OFF (Maven checkstyle)
|
||||
|
@ -63,7 +61,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
|
|||
final Product product = container.getProduct().getByKey(-10);
|
||||
product.setDescription("AsyncTest#updateEntity " + random);
|
||||
|
||||
final Future<List<ODataResponseError>> futureFlush = container.flushAsync();
|
||||
final Future<Void> futureFlush = container.flushAsync();
|
||||
assertNotNull(futureFlush);
|
||||
|
||||
while (!futureFlush.isDone()) {
|
||||
|
|
|
@ -18,13 +18,15 @@
|
|||
*/
|
||||
package org.apache.olingo.fit.proxy.v3;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.apache.olingo.ext.proxy.api.ODataFlushException;
|
||||
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Driver;
|
||||
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Order;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* This is the unit test class to check actions overloading.
|
||||
*/
|
||||
|
@ -47,9 +49,9 @@ public class PropertyTestITCase extends AbstractTestITCase {
|
|||
try {
|
||||
container.flush();
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
// ignore and detach all
|
||||
service.getContext().detachAll();
|
||||
} catch (ODataFlushException e) {
|
||||
assertNotNull(e);
|
||||
}
|
||||
service.getContext().detachAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,10 @@ import java.lang.reflect.Proxy;
|
|||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.ext.proxy.AbstractService;
|
||||
import org.apache.olingo.ext.proxy.api.EdmStreamValue;
|
||||
|
@ -414,7 +412,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
|
|||
// ---------------------------------------
|
||||
org.apache.olingo.fit.proxy.v3.staticservice.Service<org.apache.olingo.client.api.v3.EdmEnabledODataClient> v3serv =
|
||||
org.apache.olingo.fit.proxy.v3.staticservice.Service.getV3(
|
||||
"http://localhost:9080/stub/StaticService/V30/Static.svc");
|
||||
"http://localhost:9080/stub/StaticService/V30/Static.svc");
|
||||
v3serv.getClient().getConfiguration().setDefaultBatchAcceptFormat(ContentType.APPLICATION_OCTET_STREAM);
|
||||
final DefaultContainer v3cont = v3serv.getEntityContainer(DefaultContainer.class);
|
||||
assertNotNull(v3cont);
|
||||
|
@ -603,8 +601,7 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
|
|||
getContainer().getOrders().add(order);
|
||||
getContainer().getOrders().delete(order);
|
||||
|
||||
List<ODataResponseError> res = getContainer().flush();
|
||||
assertTrue(res.isEmpty() || res.iterator().next() == null);
|
||||
getContainer().flush();
|
||||
|
||||
service.getContext().detachAll();
|
||||
try {
|
||||
|
@ -633,10 +630,10 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
|
|||
public void issueOLINGO398() {
|
||||
AbstractCollectionInvocationHandler<?, ?> handler = AbstractCollectionInvocationHandler.class.cast(
|
||||
Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
|
||||
select("OrderID", "CustomerForOrder").
|
||||
expand("CustomerForOrder").
|
||||
top(1).
|
||||
skip(2)));
|
||||
select("OrderID", "CustomerForOrder").
|
||||
expand("CustomerForOrder").
|
||||
top(1).
|
||||
skip(2)));
|
||||
|
||||
assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?"
|
||||
+ "%24select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
|
||||
|
@ -644,10 +641,10 @@ public class APIBasicDesignTestITCase extends AbstractTestITCase {
|
|||
|
||||
handler = AbstractCollectionInvocationHandler.class.cast(
|
||||
Proxy.getInvocationHandler(container.getCustomers().getByKey(1).getOrders().
|
||||
select("OrderID", "CustomerForOrder").
|
||||
expand("CustomerForOrder").
|
||||
top(1).
|
||||
skip(2)));
|
||||
select("OrderID", "CustomerForOrder").
|
||||
expand("CustomerForOrder").
|
||||
top(1).
|
||||
skip(2)));
|
||||
|
||||
assertEquals("http://localhost:9080/stub/StaticService/V40/Static.svc/Customers(1)/Orders?%24"
|
||||
+ "select=OrderID%2CCustomerForOrder&%24expand=CustomerForOrder&%24top=1&%24skip=2",
|
||||
|
|
|
@ -22,12 +22,10 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.junit.Test;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
|
||||
//CHECKSTYLE:OFF (Maven checkstyle)
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
|
||||
|
@ -64,7 +62,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
|
|||
final Person person = container.getPeople().getByKey(1);
|
||||
person.setFirstName(randomFirstName);
|
||||
|
||||
final Future<List<ODataResponseError>> futureFlush = container.flushAsync();
|
||||
final Future<Void> futureFlush = container.flushAsync();
|
||||
assertNotNull(futureFlush);
|
||||
|
||||
while (!futureFlush.isDone()) {
|
||||
|
|
|
@ -19,17 +19,15 @@
|
|||
package org.apache.olingo.fit.proxy.v4;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.format.ContentType;
|
||||
import org.apache.olingo.ext.proxy.api.ODataFlushException;
|
||||
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.Service;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
|
||||
|
@ -70,11 +68,16 @@ public class ContextTestITCase extends AbstractTestITCase {
|
|||
|
||||
container.getPeople().add(employee);
|
||||
|
||||
final List<ODataResponseError> result = container.flush();
|
||||
|
||||
assertEquals(2, result.size());
|
||||
assertTrue(result.get(0) instanceof ODataClientErrorException);
|
||||
assertNull(result.get(1));
|
||||
try {
|
||||
container.flush();
|
||||
fail();
|
||||
} catch (ODataFlushException e) {
|
||||
assertEquals(1, e.getErrors().size());
|
||||
assertEquals(0, e.getErrors().get(0).getIndex());
|
||||
assertNotNull(e.getErrors().get(0).getRequest());
|
||||
}
|
||||
|
||||
service.getContext().detachAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
*/
|
||||
package org.apache.olingo.fit.proxy.v4;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.apache.olingo.ext.proxy.api.ODataFlushException;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
|
||||
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.StoredPI;
|
||||
import org.junit.Test;
|
||||
|
@ -47,9 +49,9 @@ public class PropertyTestITCase extends AbstractTestITCase {
|
|||
try {
|
||||
container.flush();
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
// ignore and detach all
|
||||
service.getContext().detachAll();
|
||||
} catch (ODataFlushException e) {
|
||||
assertNotNull(e);
|
||||
}
|
||||
service.getContext().detachAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.olingo.client.api.communication;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.domain.ODataError;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ import org.apache.olingo.commons.api.domain.ODataError;
|
|||
*
|
||||
* @see ODataError
|
||||
*/
|
||||
public class ODataClientErrorException extends ODataResponseError {
|
||||
public class ODataClientErrorException extends ODataRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -2551523202755268162L;
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
package org.apache.olingo.client.api.communication;
|
||||
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
/**
|
||||
* Represents a server error in OData.
|
||||
*/
|
||||
public class ODataServerErrorException extends ODataResponseError {
|
||||
public class ODataServerErrorException extends ODataRuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -6423014532618680135L;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.communication.header;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -214,7 +214,7 @@ public enum HeaderName {
|
|||
|
||||
final void isSupportedBy(final ODataServiceVersion serviceVersion) {
|
||||
if (!supportedVersions.contains(serviceVersion)) {
|
||||
throw new ODataResponseError("Unsupported header " + this.toString());
|
||||
throw new ODataRuntimeException("Unsupported header " + this.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.client.api.communication.header;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -411,7 +411,7 @@ public class ODataPreferences {
|
|||
|
||||
final PreferenceNames isSupportedBy(final ODataServiceVersion serviceVersion) {
|
||||
if (!supportedVersions.contains(serviceVersion)) {
|
||||
throw new ODataResponseError("Unsupported header " + this.toString());
|
||||
throw new ODataRuntimeException("Unsupported header " + this.toString());
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.http.StatusLine;
|
|||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.ODataClientErrorException;
|
||||
import org.apache.olingo.client.api.communication.ODataServerErrorException;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.domain.ODataError;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.commons.api.serialization.ODataDeserializerException;
|
||||
|
@ -41,11 +41,11 @@ public final class ODataErrorResponseChecker {
|
|||
return error;
|
||||
}
|
||||
|
||||
public static ODataResponseError checkResponse(
|
||||
public static ODataRuntimeException checkResponse(
|
||||
final CommonODataClient<?> odataClient, final StatusLine statusLine, final InputStream entity,
|
||||
final String accept) {
|
||||
|
||||
ODataResponseError result = null;
|
||||
ODataRuntimeException result = null;
|
||||
|
||||
if (entity == null) {
|
||||
result = new ODataClientErrorException(statusLine);
|
||||
|
|
|
@ -42,7 +42,7 @@ import java.io.InputStream;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
/**
|
||||
* Abstract representation of an OData request. Get instance by using factories.
|
||||
|
@ -322,7 +322,7 @@ public abstract class AbstractODataRequest extends AbstractRequest implements OD
|
|||
|
||||
try {
|
||||
checkResponse(odataClient, response, getAccept());
|
||||
} catch (ODataResponseError e) {
|
||||
} catch (ODataRuntimeException e) {
|
||||
odataClient.getConfiguration().getHttpClientFactory().close(httpClient);
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.http.client.methods.HttpUriRequest;
|
|||
import org.apache.olingo.client.api.CommonEdmEnabledODataClient;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
|
@ -50,7 +50,7 @@ public abstract class AbstractRequest {
|
|||
|
||||
if (response.getStatusLine().getStatusCode() >= 400) {
|
||||
try {
|
||||
final ODataResponseError exception = ODataErrorResponseChecker.checkResponse(
|
||||
final ODataRuntimeException exception = ODataErrorResponseChecker.checkResponse(
|
||||
odataClient,
|
||||
response.getStatusLine(),
|
||||
response.getEntity() == null ? null : response.getEntity().getContent(),
|
||||
|
@ -59,7 +59,7 @@ public abstract class AbstractRequest {
|
|||
throw exception;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new ODataResponseError(
|
||||
throw new ODataRuntimeException(
|
||||
"Received '" + response.getStatusLine() + "' but could not extract error body", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
/**
|
||||
* Abstract representation of an OData response.
|
||||
|
@ -183,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 ODataResponseError(e);
|
||||
throw new ODataRuntimeException(e);
|
||||
}
|
||||
|
||||
for (Header header : res.getAllHeaders()) {
|
||||
|
|
|
@ -18,19 +18,19 @@
|
|||
*/
|
||||
package org.apache.olingo.commons.api;
|
||||
|
||||
public class ODataResponseError extends RuntimeException {
|
||||
public class ODataRuntimeException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 5492375572049190883L;
|
||||
|
||||
public ODataResponseError(final String msg) {
|
||||
public ODataRuntimeException(final String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public ODataResponseError(final String msg, final Exception cause) {
|
||||
public ODataRuntimeException(final String msg, final Exception cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
public ODataResponseError(final Exception cause) {
|
||||
public ODataRuntimeException(final Exception cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.server.api;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
import org.apache.olingo.commons.api.format.ODataFormat;
|
||||
import org.apache.olingo.server.api.edm.provider.EdmProvider;
|
||||
|
@ -47,7 +47,7 @@ public abstract class OData {
|
|||
return (OData) object;
|
||||
|
||||
} catch (final Exception e) {
|
||||
throw new ODataResponseError(e);
|
||||
throw new ODataRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.server.core;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.edm.Edm;
|
||||
import org.apache.olingo.commons.api.http.HttpHeader;
|
||||
import org.apache.olingo.commons.api.http.HttpMethod;
|
||||
|
@ -109,13 +109,13 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
throw new ODataResponseError(e);
|
||||
throw new ODataRuntimeException(e);
|
||||
} finally {
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
throw new ODataResponseError(e);
|
||||
throw new ODataRuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.apache.olingo.server.core.uri;
|
||||
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
import org.apache.olingo.commons.api.edm.EdmEntityType;
|
||||
import org.apache.olingo.server.api.uri.UriInfo;
|
||||
import org.apache.olingo.server.api.uri.UriInfoAll;
|
||||
|
@ -266,7 +266,7 @@ public class UriInfoImpl implements UriInfo {
|
|||
} else if (systemOption.getKind() == SystemQueryOptionKind.LEVELS) {
|
||||
systemQueryOptions.put(SystemQueryOptionKind.LEVELS, systemOption);
|
||||
} else {
|
||||
throw new ODataResponseError("Unsupported System Query Option: " + systemOption.getName());
|
||||
throw new ODataRuntimeException("Unsupported System Query Option: " + systemOption.getName());
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.http.impl.conn.BasicClientConnectionManager;
|
|||
import org.apache.http.params.CoreProtocolPNames;
|
||||
import org.apache.olingo.client.api.http.HttpMethod;
|
||||
import org.apache.olingo.client.core.http.AbstractHttpClientFactory;
|
||||
import org.apache.olingo.commons.api.ODataResponseError;
|
||||
import org.apache.olingo.commons.api.ODataRuntimeException;
|
||||
|
||||
/**
|
||||
* Shows how to customize the way how the underlying network socket are managed by the HTTP component; the specific
|
||||
|
@ -61,7 +61,7 @@ public class SocketFactoryHttpClientFactory extends AbstractHttpClientFactory {
|
|||
new SSLSocketFactory(acceptTrustStrategy, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
registry.register(new Scheme(uri.getScheme(), uri.getPort(), ssf));
|
||||
} catch (Exception e) {
|
||||
throw new ODataResponseError(e);
|
||||
throw new ODataRuntimeException(e);
|
||||
}
|
||||
|
||||
final DefaultHttpClient httpClient = new DefaultHttpClient(new BasicClientConnectionManager(registry));
|
||||
|
|
Loading…
Reference in New Issue