*/
@SuppressWarnings("restriction")
public final class SpringElementContentDescriber extends XMLContentDescriber {
private int checkCriteria(InputSource contents) throws IOException {
XMLRootHandler xmlHandler = new XMLRootHandler(true);
try {
if (!xmlHandler.parseContents(contents)) {
return INDETERMINATE;
}
}
catch (SAXException e) {
// we may be handed any kind of contents... it is normal we fail to
// parse
return INDETERMINATE;
}
catch (ParserConfigurationException e) {
// some bad thing happened - force this describer to be disabled
String message = ContentMessages.content_parserConfiguration;
RuntimeLog.log(new Status(IStatus.ERROR, ContentMessages.OWNER_NAME, 0, message, e));
throw new RuntimeException(message);
}
// Check to see if we matched our criteria.
String ns = xmlHandler.getRootNamespace();
if (ns.startsWith(org.springframework.ide.eclipse.beans.core.namespaces.NamespaceUtils.DEFAULT_NAMESPACE_URI)) {
return VALID;
}
if (ns != null) {