felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1718344 - in /felix/trunk/http/base/src: main/java/org/apache/felix/http/base/internal/util/UriUtils.java test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
Date Mon, 07 Dec 2015 13:06:04 GMT
Author: cziegeler
Date: Mon Dec  7 13:06:04 2015
New Revision: 1718344

URL: http://svn.apache.org/viewvc?rev=1718344&view=rev
Log:
Remove unused code

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java?rev=1718344&r1=1718343&r2=1718344&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
Mon Dec  7 13:06:04 2015
@@ -26,9 +26,6 @@ import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
 /**
  * Some convenience methods for handling URI(-parts).
  */
@@ -38,66 +35,6 @@ public abstract class UriUtils
     private static final char DOT = '.';
     private static final char SLASH = '/';
 
-    public static String compactPath(String path)
-    {
-        if (path == null)
-        {
-            return null;
-        }
-
-        StringBuilder sb = new StringBuilder();
-
-        int len = path.length();
-        boolean inQuery = false;
-        for (int i = 0; i < len; i++)
-        {
-            char ch = path.charAt(i);
-            if (!inQuery && ch == SLASH && la(path, i + 1) == SLASH)
-            {
-                continue;
-            }
-            if (ch == '?')
-            {
-                inQuery = true;
-            }
-            sb.append(ch);
-        }
-
-        return sb.toString();
-    }
-
-    public static @Nonnull String relativePath(@CheckForNull String base, @CheckForNull String
path)
-    {
-        if (path == null)
-        {
-            return "";
-        }
-        if (base == null)
-        {
-            return path;
-        }
-
-        int len = base.length();
-        if (base.endsWith("/"))
-        {
-            len--;
-        }
-        else if (!base.equals(path))
-        {
-            base = base.concat("/");
-        }
-
-        if (path.startsWith(base))
-        {
-            path = path.substring(len);
-        }
-        if ("".equals(path) || "/".equals(path))
-        {
-            return "";
-        }
-        return path;
-    }
-
     /**
      * Concatenates two paths keeping their respective path-parts into consideration.
      *
@@ -199,7 +136,7 @@ public abstract class UriUtils
      * @param encoding the character encoding to use, cannot be <code>null</code>.
      * @return the decoded path, can be <code>null</code> only if the given path
was <code>null</code>.
      */
-    public static String decodePath(String path, String encoding)
+    private static String decodePath(String path, String encoding)
     {
         // Special cases...
         if (path == null)

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java?rev=1718344&r1=1718343&r2=1718344&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
Mon Dec  7 13:06:04 2015
@@ -18,10 +18,8 @@
  */
 package org.apache.felix.http.base.internal.util;
 
-import static org.apache.felix.http.base.internal.util.UriUtils.compactPath;
 import static org.apache.felix.http.base.internal.util.UriUtils.concat;
 import static org.apache.felix.http.base.internal.util.UriUtils.decodePath;
-import static org.apache.felix.http.base.internal.util.UriUtils.relativePath;
 import static org.apache.felix.http.base.internal.util.UriUtils.removeDotSegments;
 import static org.junit.Assert.assertEquals;
 
@@ -33,37 +31,6 @@ import org.junit.Test;
 public class UriUtilsTest
 {
     @Test
-    public void testCompactPath()
-    {
-        assertEquals(null, compactPath(null));
-        assertEquals("", compactPath(""));
-        assertEquals("/", compactPath("/"));
-        assertEquals("/", compactPath("//"));
-        assertEquals("/foo/", compactPath("/foo//"));
-        assertEquals("/foo/", compactPath("//foo/"));
-        assertEquals("/foo/bar", compactPath("/foo/bar"));
-        assertEquals("/foo/bar", compactPath("//foo//bar"));
-        assertEquals("/foo/bar", compactPath("/foo///bar"));
-        assertEquals("/foo/bar?qux=quu//baz", compactPath("/foo/bar?qux=quu//baz"));
-    }
-
-    @Test
-    public void testRelativePath()
-    {
-        assertEquals("", relativePath("/foo", null));
-        assertEquals("", relativePath("/foo", ""));
-        assertEquals("", relativePath("/foo", "/foo"));
-        assertEquals("", relativePath("/foo", "/foo/")); // XXX or "/"?
-        assertEquals("/foo", relativePath("/", "/foo"));
-        assertEquals("/foo/", relativePath("/", "/foo/"));
-        assertEquals("/foo/", relativePath(null, "/foo/"));
-        assertEquals("/bar", relativePath("/foo", "/foo/bar"));
-        assertEquals("/bar/foo", relativePath("/foo", "/bar/foo"));
-        assertEquals("/bar", relativePath("/foo/", "/foo/bar"));
-        assertEquals("/foobar", relativePath("/foo", "/foobar"));
-    }
-
-    @Test
     public void testConcatOk()
     {
         assertEquals(null, concat(null, null));



Mime
View raw message