* @param sortedMessageList The list to populate with messages in the
* order they are resolved. Can be null.
*/
public static void resolveInheritance(Iterator msgIterator, List sortedMessageList)
{
MetadataCompoundValidationException comp = null;
Holder circularMessageSet = new IdentityHashHolder();
Holder resolvedMessageSet = new IdentityHashHolder();
while (msgIterator.hasNext())
{
Message message = (Message)msgIterator.next();
circularMessageSet.add(message);
// Process inheritance starting on the root messages.
if (message.m_base == null)
{
try
{
message.resolveInheritance(resolvedMessageSet, sortedMessageList);
}
catch (UncheckedException ex)
{
if (comp == null)
{
comp = new MetadataCompoundValidationException();
}
message.addException(comp, ex);
}
}
}
// Inheritance cycles have no message where m_base == null, so they are never resolved.
if (circularMessageSet.size() != resolvedMessageSet.size())
{
circularMessageSet.removeAll(resolvedMessageSet);
if (comp == null)
{
comp = new MetadataCompoundValidationException();
}
for (Iterator itr = circularMessageSet.iterator(); itr.hasNext(); )
{
Message circularMessage = (Message)itr.next();