Repository: olingo-odata4 Updated Branches: refs/heads/master 717d69b97 -> f189dd07a
Revert "[]" This reverts commit 717d69b979b418b32a8fe2ae286f399def04efca. Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/f189dd07 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/f189dd07 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/f189dd07 Branch: refs/heads/master Commit: f189dd07a6662db3aaa2b5cfbf7cd7578b88bc94 Parents: 717d69b Author: ramya vasanth <[email protected]> Authored: Thu Sep 14 16:37:51 2017 +0530 Committer: ramya vasanth <[email protected]> Committed: Thu Sep 14 16:37:51 2017 +0530 ---------------------------------------------------------------------- .../olingo/server/core/uri/UriHelperImpl.java | 9 ++---- .../olingo/server/core/uri/UriHelperTest.java | 31 -------------------- 2 files changed, 2 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f189dd07/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java ---------------------------------------------------------------------- diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java index 2c19ade..ee4636b 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java @@ -94,14 +94,13 @@ public class UriHelperImpl implements UriHelper { result.append(Encoder.encode(value)); } catch (final EdmPrimitiveTypeException e) { throw new SerializerException("Wrong key value!", e, - SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, edmProperty.getName(), - propertyValue != null ? propertyValue.toString(): null); + SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, edmProperty.getName(), propertyValue.toString()); } } return result.toString(); } - private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) throws SerializerException { + private Object findPropertyRefValue(Entity entity, EdmKeyPropertyRef refType) { final int INDEX_ERROR_CODE = -1; final String propertyPath = refType.getName(); String tmpPropertyName; @@ -123,10 +122,6 @@ public class UriHelperImpl implements UriHelper { tmpPropertyName = propertyPath.substring(lastIndex, index); prop = findProperty(tmpPropertyName, prop.asComplex().getValue()); } - if (prop == null) { - throw new SerializerException("Key Value Cannot be null for property: " + propertyPath, - SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, propertyPath); - } return prop.getValue(); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/f189dd07/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java ---------------------------------------------------------------------- diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java index 8e19835..e5ed731 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java @@ -18,13 +18,9 @@ */ package org.apache.olingo.server.core.uri; -import static org.junit.Assert.assertEquals; - import java.util.Collections; -import java.util.List; import org.apache.olingo.commons.api.data.Entity; -import org.apache.olingo.commons.api.data.Property; import org.apache.olingo.commons.api.data.ValueType; import org.apache.olingo.commons.api.edm.Edm; import org.apache.olingo.commons.api.edm.EdmEntityContainer; @@ -36,9 +32,7 @@ import org.apache.olingo.server.api.uri.UriHelper; import org.apache.olingo.server.tecsvc.data.DataProvider; import org.apache.olingo.server.tecsvc.provider.EdmTechProvider; import org.junit.Assert; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; public class UriHelperTest { @@ -84,29 +78,4 @@ public class UriHelperTest { entity.getProperty("PropertyInt16").setValue(ValueType.PRIMITIVE, "wrong"); helper.buildCanonicalURL(entitySet, entity); } - - @Rule - public ExpectedException expectedEx = ExpectedException.none(); - - @Test(expected = SerializerException.class) - public void canonicalURLWithoutKeys() throws Exception { - final EdmEntitySet entitySet = container.getEntitySet("ESAllPrim"); - Entity entity = data.readAll(entitySet).getEntities().get(0); - List<Property> properties = entity.getProperties(); - properties.remove(0); - helper.buildCanonicalURL(entitySet, entity); - expectedEx.expect(SerializerException.class); - expectedEx.expectMessage("Key Value Cannot be null for property: PropertyInt16"); - } - - @Test(expected = SerializerException.class) - public void canonicalURLWithKeyHavingNullValue() throws Exception { - final EdmEntitySet entitySet = container.getEntitySet("ESAllPrim"); - Entity entity = data.readAll(entitySet).getEntities().get(0); - Property property = entity.getProperties().get(0); - property.setValue(property.getValueType(), null); - helper.buildCanonicalURL(entitySet, entity); - expectedEx.expect(SerializerException.class); - expectedEx.expectMessage("Wrong key value!"); - } }
