excalibur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Semantic bug in Framework?
Date Thu, 29 Jul 2004 06:58:05 GMT


Since I am digging in Framework, I also stumbled upon another problem. Either 
it is a semantic bug in the intentions, or a bug in the 
ConfigurationUtils.equals() method.

The problem is highlighted in an added testcase, which now fails in Framework 

It goes something like this;

The two configurations
Configuration a = 


Configuration b =

a.equals( b ) --> TRUE

It is not specified in the Javadocs of Configuration, but it is said in 
Javadocs of DefaultConfiguration that getChild( String element ), will return 
the FIRST child.

String v1 = a.getChild( "b" ).getValue();
String v2 = b.getChild( "b" ).getValue();
return v1.equals( v2 );

evaluates to FALSE !!!!
In which case the two Configurations can NOT be considered equal.

I can imagine this is quite a headache, and the only way out as I see it, is 
that Configurations must be same in order of its children as well, to be 
considered equal. 

Furthermore, the current equals() implementation is very slow for large 
configurations, as it does at worst O(n!) iterations through the tree.

What are we going to do about this?

  / http://www.bali.ac        /
 / http://niclas.hedhman.org / 

To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/

View raw message