/** * Verify that the given URI is indeed a valid extension namespace URI, and if so enable it. * * <p>This method does all the error handling. */ protected final void checkAndEnable(String uri) throws SAXException { if (!isRecognizableExtension(uri)) { String nearest = EditDistance.findNearest(uri, recognizableExtensions); // not the namespace URI we know of error(Messages.ERR_UNSUPPORTED_EXTENSION.format(uri, nearest)); } else if (!isSupportedExtension(uri)) { // recognizable but not not supported, meaning // the plug-in isn't enabled // look for plug-in that handles this URI Plugin owner = null; for (Plugin p : options.getAllPlugins()) { if (p.getCustomizationURIs().contains(uri)) { owner = p; break; } } if (owner != null) // we know the plug-in that supports this namespace, but it's not enabled error(Messages.ERR_PLUGIN_NOT_ENABLED.format(owner.getOptionName(), uri)); else { // this shouldn't happen, but be defensive... error(Messages.ERR_UNSUPPORTED_EXTENSION.format(uri)); } } // as an error recovery enable this namespace URI anyway. enabledExtensions.add(uri); }