if (errors != null) {
errors.clear();
}
final StAX2SAXAdapter adapter = new StAX2SAXAdapter(true);
// Parse the XMLReader and generate SAX events
try {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws XMLStreamException, SAXException {
adapter.parse(reader, handler);
return null;
}
});
} catch (PrivilegedActionException e) {
throw new Resource.IOWrappedException(e.getException());