Please review my fix for JDK-8049244: http://cr.openjdk.java.net/~mullan/webrevs/8049244/webrev.00/
This is a direct port of the corresponding fix from Apache Santuario. No regression test since this is a performance related fix. However, the customer that reported this to the Apache Santuario project has already tested the patch and confirmed that it fixes the issue.
Thanks, Sean