You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by se...@apache.org on 2006/06/23 08:17:35 UTC
svn commit: r416582 - in /jakarta/turbine/core/trunk:
src/java/org/apache/turbine/util/uri/TurbineURI.java
src/test/org/apache/turbine/util/uri/TurbineURITest.java xdocs/changes.xml
Author: seade
Date: Thu Jun 22 23:17:34 2006
New Revision: 416582
URL: http://svn.apache.org/viewvc?rev=416582&view=rev
Log:
TRB-16: TurbineURI mishandles the empty String
Thanks to Juergen Hoffmann inspiring this patch.
Modified:
jakarta/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java
jakarta/turbine/core/trunk/src/test/org/apache/turbine/util/uri/TurbineURITest.java
jakarta/turbine/core/trunk/xdocs/changes.xml
Modified: jakarta/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java?rev=416582&r1=416581&r2=416582&view=diff
==============================================================================
--- jakarta/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java (original)
+++ jakarta/turbine/core/trunk/src/java/org/apache/turbine/util/uri/TurbineURI.java Thu Jun 22 23:17:34 2006
@@ -1,8 +1,7 @@
package org.apache.turbine.util.uri;
-
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -17,7 +16,6 @@
* limitations under the License.
*/
-
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -770,9 +768,11 @@
if(StringUtils.isEmpty(val))
{
- // Fixme?
- log.debug("Found a null value for " + key);
- output.append("null");
+ if (val == null && log.isDebugEnabled())
+ {
+ log.debug("Found a null value for " + key);
+ }
+ output.append(val);
}
else
{
Modified: jakarta/turbine/core/trunk/src/test/org/apache/turbine/util/uri/TurbineURITest.java
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/trunk/src/test/org/apache/turbine/util/uri/TurbineURITest.java?rev=416582&r1=416581&r2=416582&view=diff
==============================================================================
--- jakarta/turbine/core/trunk/src/test/org/apache/turbine/util/uri/TurbineURITest.java (original)
+++ jakarta/turbine/core/trunk/src/test/org/apache/turbine/util/uri/TurbineURITest.java Thu Jun 22 23:17:34 2006
@@ -1,8 +1,7 @@
package org.apache.turbine.util.uri;
-
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
@@ -17,7 +16,6 @@
* limitations under the License.
*/
-
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.apache.turbine.services.ServiceManager;
@@ -30,6 +28,7 @@
* Testing of the TurbineURI class
*
* @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
+ * @author <a href="mailto:seade@backstagetech.com.au">Scott Eade</a>
* @version $Id$
*/
public class TurbineURITest extends BaseTestCase
@@ -95,6 +94,39 @@
turi.removeQueryData("test");
assertEquals("TurbineURI must not have a queryData", false, turi.hasQueryData());
assertEquals("TurbineURI must not have a pathInfo", false, turi.hasPathInfo());
+ }
+
+ public void testEmptyAndNullQueryData()
+ {
+ // Check empty String
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
+ turi.addQueryData("test", "");
+ assertEquals("/context/servlet/turbine?test=", turi.getRelativeLink());
+ turi.removeQueryData("test");
+
+ // Check null
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
+ turi.addQueryData("test", null);
+ assertEquals("/context/servlet/turbine?test=null", turi.getRelativeLink());
+ turi.removeQueryData("test");
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
+ }
+
+ public void testEmptyAndNullPathInfo()
+ {
+ // Check empty String
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
+ turi.addPathInfo("test", "");
+ // Kind of susspect result - might result in "//" in the URL.
+ assertEquals("/context/servlet/turbine/test/", turi.getRelativeLink());
+ turi.removePathInfo("test");
+
+ // Check null
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
+ turi.addPathInfo("test", null);
+ assertEquals("/context/servlet/turbine/test/null", turi.getRelativeLink());
+ turi.removePathInfo("test");
+ assertEquals("/context/servlet/turbine", turi.getRelativeLink());
}
}
Modified: jakarta/turbine/core/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/turbine/core/trunk/xdocs/changes.xml?rev=416582&r1=416581&r2=416582&view=diff
==============================================================================
--- jakarta/turbine/core/trunk/xdocs/changes.xml (original)
+++ jakarta/turbine/core/trunk/xdocs/changes.xml Thu Jun 22 23:17:34 2006
@@ -23,7 +23,10 @@
</properties>
<body>
- <release version="2.4-M2" date="in cvs">
+ <release version="2.4-M2" date="in Subversion">
+ <action type="fix" dev="seade" issue="TRB-16" due-to="Jürgen Hoffmann">
+ TurbineURI was mishandling the empty String.
+ </action>
<action dev="seade" type="update">
Updated jar dependency: javamail to 1.3.3
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org