Skip to content

Commit

Permalink
Fix cache result of external grammar info.
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr authored and fbricon committed May 13, 2020
1 parent 9beabb5 commit 6fb6e08
Showing 1 changed file with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,32 +349,37 @@ private synchronized boolean intializeExternalGrammar() {
if (referencedExternalGrammarInitialized) {
return hasExternalGrammar;
}
if (resolverExtensionManager != null) {
// None grammar found with standard mean, check if it some components like XML
// file associations bind this XML document to a grammar with external schema
// location.
try {
externalSchemaLocation = resolverExtensionManager.getExternalSchemaLocation(new URI(getDocumentURI()));
if (externalSchemaLocation != null) {
return true;
try {
if (resolverExtensionManager != null) {
// No grammar found with standard mean, check if it some components like XML
// file associations bind this XML document to a grammar with external schema
// location.
try {
externalSchemaLocation = resolverExtensionManager
.getExternalSchemaLocation(new URI(getDocumentURI()));
if (externalSchemaLocation != null) {
return true;
}
} catch (URISyntaxException e) {
// Do nothing
}
} catch (URISyntaxException e) {
// Do nothing
}

// None grammar found with standard mean and external schema location, check if
// it some components like XML
// Catalog, XSL and XSD resolvers, etc bind this XML document to a grammar.
// Get root element
DOMElement documentElement = getDocumentElement();
if (documentElement == null) {
return false;
}
String namespaceURI = documentElement.getNamespaceURI();
return resolverExtensionManager.resolve(getDocumentURI(), namespaceURI, null) != null;
// No grammar found with standard mean and external schema location, check if
// it some components like XML
// Catalog, XSL and XSD resolvers, etc bind this XML document to a grammar.
// Get root element
DOMElement documentElement = getDocumentElement();
if (documentElement == null) {
return false;
}
String namespaceURI = documentElement.getNamespaceURI();
return resolverExtensionManager.resolve(getDocumentURI(), namespaceURI, null) != null;

}
return false;
} finally {
referencedExternalGrammarInitialized = true;
}
return false;
}

private static String getUnprefixedName(String name) {
Expand Down

0 comments on commit 6fb6e08

Please sign in to comment.