Author: bombe
Date: 2007-10-10 17:06:17 +0000 (Wed, 10 Oct 2007)
New Revision: 15442

Modified:
   trunk/freenet/src/freenet/support/HTMLNode.java
Log:
fix wrong assertion: a) don't assert in public methods, b) allow all possible 
node names, including "#" and "%"

Modified: trunk/freenet/src/freenet/support/HTMLNode.java
===================================================================
--- trunk/freenet/src/freenet/support/HTMLNode.java     2007-10-09 04:41:49 UTC 
(rev 15441)
+++ trunk/freenet/src/freenet/support/HTMLNode.java     2007-10-10 17:06:17 UTC 
(rev 15442)
@@ -42,9 +42,9 @@
        public HTMLNode(String name, String[] attributeNames, String[] 
attributeValues, String content) {

                Matcher nameMatcher = namePattern.matcher(name);
-               
-               assert nameMatcher.matches();
-               
+               if (!nameMatcher.matches() && !"#".equals(name) && 
!"%".equals(name)) {
+                       throw new IllegalArgumentException("name must start 
with letter and may only contain letters, digits, and underscore");
+               }
                this.name = name.toLowerCase(Locale.ENGLISH);
                if ((attributeNames != null) && (attributeValues != null)) {
                        if (attributeNames.length != attributeValues.length) {


Reply via email to