[freenet-dev] [freenet-cvs] r15442 - trunk/freenet/src/freenet/support

Matthew Toseland toad at amphibian.dyndns.org
Sat Oct 20 23:27:06 UTC 2007


On Wednesday 10 October 2007 18:06, bombe at freenetproject.org 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
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/devl/attachments/20071021/edcf21b2/attachment.pgp 


More information about the Devl mailing list