Remove unused code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1718344 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java b/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
index 84ab106..3c12958 100644
--- a/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
+++ b/http/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
@@ -26,9 +26,6 @@
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 @@
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 @@
* @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)
diff --git a/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java b/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
index 36717c7..41dcca2 100644
--- a/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
+++ b/http/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
@@ -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 @@
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));