in java6-utils/src/com/intellij/rt/coverage/report/XMLCoverageReport.java [76:106]
public static boolean canReadFile(File file) {
InputStream is = null;
XMLStreamReader in = null;
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
is = new BufferedInputStream(new FileInputStream(file));
in = factory.createXMLStreamReader(is);
while (in.hasNext()) {
if (in.next() == XMLStreamReader.START_ELEMENT) {
if (!REPORT_TAG.equals(in.getLocalName())) return false;
while (in.hasNext()) {
if (in.next() == XMLStreamReader.START_ELEMENT) {
if (PACKAGE_TAG.equals(in.getLocalName()) && in.getAttributeCount() >= 1 && NAME_TAG.equals(in.getAttributeLocalName(0))) {
return true;
}
}
}
}
}
} catch (Throwable ignored) {
} finally {
CoverageIOUtil.close(is);
if (in != null) {
try {
in.close();
} catch (XMLStreamException ignored) {
}
}
}
return false;
}