On Wednesday 10 October 2007 18:06, [EMAIL PROTECTED] wrote: > 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 "%"
Why don't assert in public methods?
A name is an HTML tag name - why is the below check not useful?
>
> 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) {
>
> _______________________________________________
> cvs mailing list
> [EMAIL PROTECTED]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>
pgpFu7Ol7Fmci.pgp
Description: PGP signature
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
