activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1416614 - in /activemq/activemq-apollo/trunk: apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala apollo-website/src/documentation/stomp-manual.md
Date Mon, 03 Dec 2012 18:18:38 GMT
Author: chirino
Date: Mon Dec  3 18:18:36 2012
New Revision: 1416614

URL: http://svn.apache.org/viewvc?rev=1416614&view=rev
Log:
Implement smarter escape processing.

Modified:
    activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala
    activemq/activemq-apollo/trunk/apollo-website/src/documentation/stomp-manual.md

Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala?rev=1416614&r1=1416613&r2=1416614&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.scala
Mon Dec  3 18:18:36 2012
@@ -118,7 +118,7 @@ class PathParser {
   var regex_wildcard_start = "{"
   var regex_wildcard_end = "}"
   var path_separator = "."
-  var part_pattern = Pattern.compile("[ a-zA-Z0-9\\_\\-\\%\\~\\:]+")
+  var part_pattern = Pattern.compile("""[ a-zA-Z0-9\_\-\%\~\:\(\)]+""")
 
   def copy(other:PathParser) = {
     any_descendant_wildcard = other.any_descendant_wildcard
@@ -134,15 +134,17 @@ class PathParser {
     val matcher = allowed.matcher(ascii);
     var pos = 0;
     val rc = new StringBuffer(ascii.length())
-    while( pos < ascii.length() ) {
-      val c = ascii.charAt(pos)
-      if( matcher.find(pos) ) {
-        rc.append(c)
-      } else {
-        rc.append("%%%02x".format(c))
-      }
-      pos += 1
+
+    def escape_until(end:Int) = while( pos < end ) {
+      rc.append("%%%02x".format(ascii.charAt(pos).toInt))
+      pos+=1
+    }
+    while( matcher.find(pos) ) {
+      escape_until(matcher.start)
+      rc.append(ascii.substring(matcher.start, matcher.end))
+      pos+=(matcher.end-matcher.start)
     }
+    escape_until(ascii.length)
     rc.toString
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/stomp-manual.md
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/stomp-manual.md?rev=1416614&r1=1416613&r2=1416614&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-website/src/documentation/stomp-manual.md (original)
+++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/stomp-manual.md Mon Dec
 3 18:18:36 2012
@@ -672,7 +672,7 @@ header in the STOMP `SUBSCRIBE` frame to
 ### Destination Name Restrictions
 
 Destination names are restricted to using the characters `a-z`, `A-Z`, `0-9`,
-`_`, `-` `%`, `~`, `:`, ' ', or `.` in addition to composite separator `,` and the wild
+`_`, `-` `%`, `~`, `:`, ' ', '(', ')' or `.` in addition to composite separator `,` and the
wild
 card `*`.  Any other characters must be UTF-8 and then URL encoded if you wish to 
 preserve their significance.
 



Mime
View raw message