From 422d4a6ea48f07536810cacbc3ed809992b90eb2 Mon Sep 17 00:00:00 2001 From: Christian Amend Date: Mon, 9 Mar 2015 15:36:13 +0100 Subject: [PATCH] [OLINGO-575] Remove java warnings part 3 --- .../commons/AbstractPersistenceManager.java | 44 +++++++++---------- .../olingo/fit/tecsvc/http/PingITCase.java | 4 -- .../cud/ODataEntityCreateRequestImpl.java | 8 ++-- .../cud/ODataPropertyUpdateRequestImpl.java | 8 ++-- .../cud/ODataValueUpdateRequestImpl.java | 8 ++-- .../core/domain/ODataObjectFactoryImpl.java | 2 +- 6 files changed, 35 insertions(+), 39 deletions(-) diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java index 90818758d..238686af2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/AbstractPersistenceManager.java @@ -143,7 +143,7 @@ abstract class AbstractPersistenceManager implements PersistenceManager { final TransactionItems items, final List delayedUpdates, final PersistenceChanges changeset) { - + int posNumber = pos; items.put(handler, null); final ODataEntity entity = handler.getEntity(); @@ -195,8 +195,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager { URIUtils.getURI(service.getClient().getServiceRoot(), editLink.toASCIIString()), type)); } else { if (!items.contains(target)) { - pos = processEntityContext(target, pos, items, delayedUpdates, changeset); - pos++; + posNumber = processEntityContext(target, posNumber, items, delayedUpdates, changeset); + posNumber++; } final Integer targetPos = items.get(target); @@ -243,14 +243,14 @@ abstract class AbstractPersistenceManager implements PersistenceManager { final AttachedEntityStatus processedStatus = queue(handler, entity, changeset); if (processedStatus != null) { // insert into the process queue - LOG.debug("{}: Insert '{}' into the process queue", pos, handler); - items.put(handler, pos); + LOG.debug("{}: Insert '{}' into the process queue", posNumber, handler); + items.put(handler, posNumber); } else { - pos--; + posNumber--; } if (processedStatus != AttachedEntityStatus.DELETED) { - int startingPos = pos; + int startingPos = posNumber; if (handler.getEntity().isMediaEntity() && handler.isChanged()) { // update media properties @@ -260,9 +260,9 @@ abstract class AbstractPersistenceManager implements PersistenceManager { : URIUtils.getURI( service.getClient().getServiceRoot(), handler.getEntity().getEditLink().toASCIIString()); queueUpdate(handler, targetURI, entity, changeset); - pos++; - items.put(handler, pos); - LOG.debug("{}: Update media properties for '{}' into the process queue", pos, handler); + posNumber++; + items.put(handler, posNumber); + LOG.debug("{}: Update media properties for '{}' into the process queue", posNumber, handler); } // update media content @@ -276,9 +276,9 @@ abstract class AbstractPersistenceManager implements PersistenceManager { queueUpdateMediaEntity(handler, targetURI, handler.getStreamChanges(), changeset); // update media info (use null key) - pos++; - items.put(null, pos); - LOG.debug("{}: Update media info for '{}' into the process queue", pos, handler); + posNumber++; + items.put(null, posNumber); + LOG.debug("{}: Update media info for '{}' into the process queue", posNumber, handler); } } @@ -291,13 +291,13 @@ abstract class AbstractPersistenceManager implements PersistenceManager { queueUpdateMediaResource(handler, targetURI, streamedChanges.getValue(), changeset); // update media info (use null key) - pos++; - items.put(handler, pos); - LOG.debug("{}: Update media info (null key) for '{}' into the process queue", pos, handler); + posNumber++; + items.put(handler, posNumber); + LOG.debug("{}: Update media info (null key) for '{}' into the process queue", posNumber, handler); } } - return pos; + return posNumber; } protected void processDelayedUpdates( @@ -305,12 +305,12 @@ abstract class AbstractPersistenceManager implements PersistenceManager { int pos, final TransactionItems items, final PersistenceChanges changeset) { - + int posNumber = pos; for (EntityLinkDesc delayedUpdate : delayedUpdates) { if (StringUtils.isBlank(delayedUpdate.getReference())) { - pos++; - items.put(delayedUpdate.getSource(), pos); + posNumber++; + items.put(delayedUpdate.getSource(), posNumber); final ODataEntity changes = service.getClient().getObjectFactory().newEntity(delayedUpdate.getSource().getEntity().getTypeName()); @@ -357,8 +357,8 @@ abstract class AbstractPersistenceManager implements PersistenceManager { if (queueUpdateLinkViaRef( delayedUpdate.getSource(), sourceURI, URI.create(delayedUpdate.getReference()), changeset)) { - pos++; - items.put(delayedUpdate.getSource(), pos); + posNumber++; + items.put(delayedUpdate.getSource(), posNumber); } } } diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java index 5146db9ff..d772fbec7 100644 --- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java +++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/http/PingITCase.java @@ -28,13 +28,9 @@ import org.apache.olingo.commons.api.http.HttpHeader; import org.apache.olingo.fit.AbstractBaseTestITCase; import org.apache.olingo.fit.tecsvc.TecSvcConst; import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class PingITCase extends AbstractBaseTestITCase{ - private static final Logger LOG = LoggerFactory.getLogger(PingITCase.class); - private static final String SERVICE_URI = TecSvcConst.BASE_URI + "/"; private static final String REDIRECT_URI = TecSvcConst.BASE_URI; diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java index cb8c29549..3dc08a4ed 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java @@ -96,7 +96,7 @@ public class ODataEntityCreateRequestImpl */ private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse { - private E entity = null; + private E resEntity = null; private ODataEntityCreateResponseImpl(final ODataClient odataClient, final HttpClient httpClient, final HttpResponse res) { @@ -110,19 +110,19 @@ public class ODataEntityCreateRequestImpl @Override @SuppressWarnings("unchecked") public E getBody() { - if (entity == null) { + if (resEntity == null) { try { final ResWrap resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())). toEntity(getRawResponse()); - entity = (E) odataClient.getBinder().getODataEntity(resource); + resEntity = (E) odataClient.getBinder().getODataEntity(resource); } catch (final ODataDeserializerException e) { throw new IllegalArgumentException(e); } finally { this.close(); } } - return entity; + return resEntity; } } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java index 2fb84846d..50b423c8d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java @@ -97,7 +97,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest resource = odataClient.getDeserializer(ODataFormat.fromString(getAccept())). toProperty(getRawResponse()); - property = odataClient.getBinder().getODataProperty(resource); + resProperty = odataClient.getBinder().getODataProperty(resource); } catch (final ODataDeserializerException e) { throw new IllegalArgumentException(e); } finally { this.close(); } } - return property; + return resProperty; } } } diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java index 2ad54cb53..ddff3b91c 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java @@ -94,7 +94,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest newCollectionValue(final String typeName) { - return new ODataCollectionValueImpl(typeName); + return new ODataCollectionValueImpl(typeName); } @Override