Bug in CObject.isRequired() method?

Hi,

I think there is a bug in CObject.isRequired().

If I set a node in Archetype to have 1 and only 1 occurrence.
Java ADL parser will parse it with occurrence.lower = 1 and occurrence.upper = 1 (not occurrences == null)

But the code below assumed that the occurrences == null for the above condition.

Thus the method return false which should be true instead.

public boolean isRequired() {

if (occurrences == null) { // default {1..1} // occurrences parsed from ADL parser is not null

return true;

}

if (occurrences.getLower() != null && occurrences.getLower() > 0

&& occurrences.getUpper() != null

&& occurrences.getLower() < occurrences.getUpper()) { // 1 < 1 is false

return true;

}

return false; // {0..N} // false is return!

}

Best Regards,

Kruy Vanna
Graduate School of Global Information and Telecommunication Studies,
Waseda University


http://kvanna.multiply.com
http://vannit.blogspot.com