You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by mi...@apache.org on 2010/03/15 17:26:11 UTC

svn commit: r923327 - in /incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils: pom.xml src/main/java/org/apache/clerezza/utils/Uri.java src/test/java/org/apache/clerezza/utils/UriUtilTest.java

Author: mir
Date: Mon Mar 15 16:26:10 2010
New Revision: 923327

URL: http://svn.apache.org/viewvc?rev=923327&view=rev
Log:
CLEREZZA-129: fixed encoding bug

Added:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/test/java/org/apache/clerezza/utils/UriUtilTest.java
Modified:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/pom.xml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/main/java/org/apache/clerezza/utils/Uri.java

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/pom.xml?rev=923327&r1=923326&r2=923327&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/pom.xml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/pom.xml Mon Mar 15 16:26:10 2010
@@ -21,6 +21,11 @@
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpcore-osgi</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/main/java/org/apache/clerezza/utils/Uri.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/main/java/org/apache/clerezza/utils/Uri.java?rev=923327&r1=923326&r2=923327&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/main/java/org/apache/clerezza/utils/Uri.java (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/main/java/org/apache/clerezza/utils/Uri.java Mon Mar 15 16:26:10 2010
@@ -1558,7 +1558,7 @@ public class Uri implements Cloneable, C
         allowed_abs_path.or(abs_path);
         // allowed_abs_path.set('/');  // aleady included
         allowed_abs_path.andNot(percent);
-        allowed_abs_path.clear('+');
+        //allowed_abs_path.clear('+'); //legal according RFC2396
     }
 
 
@@ -1570,7 +1570,7 @@ public class Uri implements Cloneable, C
     static {
         allowed_rel_path.or(rel_path);
         allowed_rel_path.clear('%');
-        allowed_rel_path.clear('+');
+        //allowed_rel_path.clear('+'); //legal according RFC2396
     }
 
 

Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/test/java/org/apache/clerezza/utils/UriUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/test/java/org/apache/clerezza/utils/UriUtilTest.java?rev=923327&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/test/java/org/apache/clerezza/utils/UriUtilTest.java (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.utils/src/test/java/org/apache/clerezza/utils/UriUtilTest.java Mon Mar 15 16:26:10 2010
@@ -0,0 +1,34 @@
+/*
+ *  Copyright 2010 mir.
+ * 
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ * 
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *  under the License.
+ */
+
+package org.apache.clerezza.utils;
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author mir
+ */
+public class UriUtilTest {
+
+	@Test
+	public void encodePartlyEncodedPath() throws UriException {
+		Assert.assertEquals("!@%23$%25%5E&*()%7B%7D+", UriUtil.encodePartlyEncodedPath("!@#$%^&*(){}+", "UTF-8"));
+		Assert.assertEquals("!@%23$%25%5E&*()%7B%7D+", UriUtil.encodePartlyEncodedPath("!@%23$%25%5E&*()%7B%7D+", "UTF-8"));
+	}
+}