Revision: 1078
http://stripes.svn.sourceforge.net/stripes/?rev=1078&view=rev
Author: bengunter
Date: 2009-03-01 03:29:05 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
STS-262: Fixed a couple of little parser quirks for URL bindings. One ensures
that all URL bindings start with / and the other catches bindings that end with
an open brace or escape character.
Modified Paths:
--------------
trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
Modified:
trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
2009-03-01 02:58:17 UTC (rev 1077)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/UrlBindingFactory.java
2009-03-01 03:29:05 UTC (rev 1078)
@@ -557,10 +557,15 @@
* @throws ParseException If the pattern cannot be parsed
*/
public static UrlBinding parseUrlBinding(Class<? extends ActionBean>
beanType, String pattern) {
- // check that value is not null or empty
- if (pattern == null || pattern.length() < 1)
+ // check that value is not null
+ if (pattern == null)
return null;
+ // make sure it starts with /
+ if (pattern == null || pattern.length() < 1 ||
!pattern.startsWith("/")) {
+ throw new ParseException(pattern, "A URL binding must begin with
/");
+ }
+
// parse the pattern
String path = null;
List<Object> components = new ArrayList<Object>();
@@ -618,13 +623,15 @@
escape = false;
}
+ // Were we led to expect more characters?
+ if (escape)
+ throw new ParseException(pattern, "Expression must not end with
escape character");
+ else if (braceLevel > 0)
+ throw new ParseException(pattern, "Unterminated left brace ('{')
in expression");
+
// handle whatever is left
if (buf.length() > 0) {
- if (escape)
- throw new ParseException(pattern, "Expression must not end
with escape character");
- else if (braceLevel > 0)
- throw new ParseException(pattern, "Unterminated left brace
('{') in expression");
- else if (path == null)
+ if (path == null)
path = buf.toString();
else if (c == '}')
components.add(parseUrlBindingParameter(beanType,
buf.toString()));
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development