Bug 55974 - Honor the order when reporting XML parsing errors and warnings in XmlErrorHandler class
Summary: Honor the order when reporting XML parsing errors and warnings in XmlErrorHan...
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.47
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2014-01-07 22:59 UTC by Konstantin Kolinko
Modified: 2014-01-09 15:39 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
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.