labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r1138560 - /labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
Date Wed, 22 Jun 2011 17:30:00 GMT
Author: simoneg
Date: Wed Jun 22 17:30:00 2011
New Revision: 1138560

URL: http://svn.apache.org/viewvc?rev=1138560&view=rev
Log:
Fix on empty parameters in url

Modified:
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java?rev=1138560&r1=1138559&r2=1138560&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
(original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/WebHandler.java
Wed Jun 22 17:30:00 2011
@@ -98,12 +98,23 @@ public class WebHandler implements Templ
 		if (pathInfo == null) {
 			info = new String[] { "" };
 		} else {
+			/*
+			 * This way led to errors with empty parameters not being considered
 			StringTokenizer stok = new StringTokenizer(pathInfo, "/" + paramSeparator);
 			info = new String[stok.countTokens()];
 			int pos = 0;
 			while (stok.hasMoreTokens()) {
 				info[pos++] = stok.nextToken();
 			}
+			*/
+			if (pathInfo.startsWith("/")) pathInfo = pathInfo.substring(1);
+			info = pathInfo.split("[\\Q/" + paramSeparator + "\\E]");
+			if (pathInfo.endsWith(paramSeparator + "")) {
+				String[] ninfo = new String[info.length + 1];
+				System.arraycopy(info, 0, ninfo, 0, info.length);
+				ninfo[info.length] = "";
+				info = ninfo;
+			}
 		}
 		return info;
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message