I already did send this message to
webm...@javapractices.com, but since this e-mail is somewhat anonymous, I thought I post it on this mailing list as well to make sure that persons concerned get the message.
It might be that the issue in question is not directly related to web4j, though I have all reasons to believe that the implementation of ModelUtil.hash(int aSeed, Object aObject) is the same as the HashCodeUtil.( int aSeed , Object aObject ) from
http://www.javapractices.com/topic/TopicAction.do?Id=28. So, without further ado:
This refers to the HashCodeUtil listed on
If an object has a field which is an array (or List as in my case) which contains the object itself as an element, then using HashCodeUtil.( int aSeed , Object aObject ) to hash the field will cause stack overflow.
The following two marked lines might be a solution to the problem, though I have not tested it:
public static int hash( int aSeed , Object aObject ) {
...
for ( int idx = 0; idx < length; ++idx ) {
Object item = Array.get(aObject, idx);
> if(item.equals(aObject)) result = hash(result, aObject.hashCode());
> else
//recursive call!
result = hash(result, item);
}
...
}
Please confirm if the problem is real and if my solution is right.
While currently I am in no need to use web4j, I do like the idea of simplicity and minimalism, as well convention over configuration. If I even need to build a web app I will surely seriously consider web4j for the job.