webwork/src/main/webwork/util Query.java,1.23,1.24

[email protected] Mon, 17 Nov 2003 15:47:42 -0800
Newsgroups gmane.comp.java.open-symphony.cvs
Message-ID <[email protected]>
Update of /cvsroot/opensymphony/webwork/src/main/webwork/util
In directory sc8-pr-cvs1:/tmp/cvs-serv9278

Modified Files:
	Query.java 
Log Message:
Make it possible to call methods without any parameters

Index: Query.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/util/Query.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- Query.java	17 Nov 2003 00:55:47 -0000	1.23
+++ Query.java	17 Nov 2003 23:47:40 -0000	1.24
@@ -6,6 +6,7 @@
  */
 package webwork.util;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -160,7 +161,7 @@
          // of the parser expects slashes to be skipped, but not other elements.
          if (query[queryIdx] == LBRACKET)
             queryIdx--;
-
+            
       }
 
       int lastExprIdx;
@@ -309,9 +310,15 @@
                }
 
                // create the parsed parameter and add it to the query segment
-               String parameter = new String(query, paramStart, (paramEnd - paramStart) + 1);
-//               Query paramQuery = getQuery(parameter);
-               qs.addValue(parameter);
+               String parameter = new String(query, paramStart, (paramEnd - paramStart) + 1).trim();
+               // If it is the first and only parameter and it is not empty, then don't add it
+               if (commaNbr==0 && paramIdxs[commaNbr+1] <= -1 && parameter.length()==0)
+                  qs.createValues();
+               else
+               {
+                  Query paramQuery = getQuery(parameter);
+                  qs.addValue(paramQuery);
+               }
 
                // bump the start one past the end token position
                paramStart = paramIdxs[commaNbr] + 1;




-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl