According to http://www.oasis-open.org/committees/download.php/2384/cs-entity-xml-catalogs-1.0.html#s.rewritesystem and http://www.oasis-open.org/committees/download.php/2384/cs-entity-xml-catalogs-1.0.html#s.rewriteuri "If more than one entry matches, the matching entry with the longest normalized StartString value is used." However, when I review the code it would seem that, due to the incorrect placement of a closing brace in two places (resolveLocalSystem and resolveLocalURI), xml-commons/java/src/org/apache/xml/resolver/Catalog.java will use the first match. Please note that this report is based on code review only.
Created attachment 9424 [details] Move closing braces to correct place.
Please note that the patch also is based on code review only; it has not been tested.
Nice catch!