cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6664] Fixing NPE based on the input from with the help from Michael Krenn
Date Thu, 05 Nov 2015 17:16:55 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 346decc52 -> 39b20262d


[CXF-6664] Fixing NPE based on the input from with the help from Michael Krenn


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/39b20262
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/39b20262
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/39b20262

Branch: refs/heads/3.0.x-fixes
Commit: 39b20262d4234528096b814a443b721f9ed7d176
Parents: 346decc
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Thu Nov 5 17:14:05 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Thu Nov 5 17:16:39 2015 +0000

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/impl/LinkBuilderImpl.java   | 19 ++++++++++++++++---
 .../cxf/jaxrs/impl/LinkBuilderImplTest.java      |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/39b20262/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
index 2363a7a..b3e3d7c 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/LinkBuilderImpl.java
@@ -74,12 +74,25 @@ public class LinkBuilderImpl implements Builder {
 
     @Override
     public Builder link(String link) {
+        
+        link = link.trim();
+        if (link.length() > 1 && link.startsWith("<")) {
+            int index = link.indexOf(">", 1);
+            if (index != -1) {
+                String uri = link.substring(1, index);
+                ub = UriBuilder.fromUri(uri);
+                if (index + 1 == link.length()) {
+                    link = "";
+                } else {
+                    link = link.substring(index + 1);
+                }
+            }
+        }
+        
         String[] tokens = StringUtils.split(link, ";");
         for (String token : tokens) {
             String theToken = token.trim();
-            if (theToken.startsWith("<") && theToken.endsWith(">")) {
-                ub = UriBuilder.fromUri(theToken.substring(1, theToken.length() - 1));
-            } else {
+            if (!theToken.isEmpty()) {
                 int i = theToken.indexOf('=');
                 if (i != -1) {
                     String name = theToken.substring(0, i);

http://git-wip-us.apache.org/repos/asf/cxf/blob/39b20262/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/LinkBuilderImplTest.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/LinkBuilderImplTest.java
b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/LinkBuilderImplTest.java
index a3790dc..70920cc 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/LinkBuilderImplTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/LinkBuilderImplTest.java
@@ -41,7 +41,7 @@ public class LinkBuilderImplTest extends Assert {
     }
     
     @Test
-    public void testbBuildObjects() throws Exception {
+    public void testBuildObjects() throws Exception {
         StringBuilder path1 = new StringBuilder().append("p1");
         ByteArrayInputStream path2 = new ByteArrayInputStream("p2".getBytes()) {
             @Override


Mime
View raw message