You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/11 11:14:24 UTC
git commit: [OLINGO-356] Fix for tiny bug in ContextURL
Repository: olingo-odata4
Updated Branches:
refs/heads/master 210cf9b37 -> 200cc7556
[OLINGO-356] Fix for tiny bug in ContextURL
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/200cc755
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/200cc755
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/200cc755
Branch: refs/heads/master
Commit: 200cc75568a7e098ea2077efff5e3fd9bc31fd54
Parents: 210cf9b
Author: Michael Bolz <mi...@sap.com>
Authored: Fri Jul 11 11:14:13 2014 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Fri Jul 11 11:14:13 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/commons/api/data/ContextURL.java | 6 +++---
.../apache/olingo/commons/api/data/ContextURLTest.java | 12 ++++++++++++
2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/200cc755/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
index 5bb9ab7..8926ceb 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/ContextURL.java
@@ -72,8 +72,8 @@ public class ContextURL {
instance.deltaLink = contextURLasString.endsWith("/$link");
contextURLasString = contextURLasString.replace("/$link", StringUtils.EMPTY);
- instance.deltaDeletedLink = contextURLasString.endsWith("$deletedLink");
- contextURLasString = contextURLasString.replace("$deletedLink", StringUtils.EMPTY);
+ instance.deltaDeletedLink = contextURLasString.endsWith("/$deletedLink");
+ contextURLasString = contextURLasString.replace("/$deletedLink", StringUtils.EMPTY);
instance.serviceRoot = URI.create(StringUtils.substringBefore(contextURLasString, Constants.METADATA));
@@ -109,7 +109,7 @@ public class ContextURL {
if (!firstToken.equals(rest)) {
final String[] pathElems = StringUtils.substringAfter(rest, "/").split("/");
- if (pathElems.length > 0) {
+ if (pathElems.length > 0 && pathElems[0].length() > 0) {
if (pathElems[0].indexOf('.') == -1) {
instance.navOrPropertyPath = pathElems[0];
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/200cc755/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
index c2362be..84046b2 100644
--- a/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
+++ b/lib/commons-api/src/test/java/org/apache/olingo/commons/api/data/ContextURLTest.java
@@ -205,14 +205,26 @@ public class ContextURLTest {
public void delta() {
ContextURL contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$delta"));
assertTrue(contextURL.isDelta());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$deletedLink"));
assertTrue(contextURL.isDeltaDeletedLink());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$link"));
assertTrue(contextURL.isDeltaLink());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
contextURL = ContextURL.getInstance(URI.create("http://host/service/$metadata#Customers/$deletedEntity"));
assertTrue(contextURL.isDeltaDeletedEntity());
+ assertNull(contextURL.getSelectList());
+ assertNull(contextURL.getNavOrPropertyPath());
+ assertFalse(contextURL.isEntity());
}
}