webwork/src/main/webwork/util Query.java,1.19,1.20
| 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-serv9429
Modified Files:
Query.java
Log Message:
Fixed problem where numbers starting with . were not handled.
This fixes Jira issue WW-296
Index: Query.java
===================================================================
RCS file: /cvsroot/opensymphony/webwork/src/main/webwork/util/Query.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Query.java 17 Jun 2003 09:55:39 -0000 1.19
+++ Query.java 9 Sep 2003 20:39:58 -0000 1.20
@@ -56,7 +56,8 @@
// Constructor ---------------------------------------------------
private Query(String queryString) {
- this.queryString = queryString;
+ // Trim the query of any surrounding whitespace
+ this.queryString = queryString.trim();
char[] query = this.queryString.toCharArray();
// Current value on top of stack
@@ -116,11 +117,14 @@
}
// Integers (first check to see if the first character is a number)
- if ((query[0] < ':' && query[0] > '/') || query[0] == '-' || query[0] == '.') {
+ // If it is a number starting with . then there must be at least
+ // one more character and it must be a number
+ if ((query[0] < ':' && query[0] > '/') || query[0] == '-' ||
+ (query[0] == '.' && query.length > 1 && (query[1] < ':' && query[1] > '/'))) {
Object val;
try {
String s = new String(query, 0, query.length);
- if (s.indexOf('.') > 0) {
+ if (s.indexOf('.') >= 0) {
val = new Double(s);
} else {
val = new Integer(s);
@@ -349,7 +353,6 @@
}
} while (queryIdx < query.length);
-
}
// Public --------------------------------------------------------
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf