Bug 55974

Summary: Honor the order when reporting XML parsing errors and warnings in XmlErrorHandler class
Product: Tomcat 7 Reporter: Konstantin Kolinko <knst.kolinko>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 7.0.47   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Konstantin Kolinko 2014-01-07 22:59:05 UTC
Originally reported in comment 1 of bug 55973.

o.a.t.util.descriptor.XmlErrorHandler class stores the errors and warnings in a HashSet. A hashset does not preserve ordering.

If there are several errors, then

a) When all errors are printed (e.g. via XmlErrorHandler#logFindings(...)), their order is random.

b) When only one error is reported (e.g. by code added in r1552826), the one error is chosen randomly.

The ordering can be preserved if the collection is stored as LinkedHashSet or an ArrayList. Is there a benefit of using a 'set' here, or a 'list' would suffice?
Comment 1 Mark Thomas 2014-01-09 15:39:20 UTC
Fixed in 8.0.x for 8.0.0 and 7.0.x for 7.0.51.