You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2012/08/30 17:04:33 UTC
svn commit: r1378976 -
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Author: mukulg
Date: Thu Aug 30 15:04:33 2012
New Revision: 1378976
URL: http://svn.apache.org/viewvc?rev=1378976&view=rev
Log:
committing the fix for recent issue reported for jira issue, XERCESJ-1578.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1378976&r1=1378975&r2=1378976&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Thu Aug 30 15:04:33 2012
@@ -1215,7 +1215,7 @@ public class XSDHandler {
newSchemaRoot = resolveSchema(schemaSource, fSchemaGrammarDescription, mustResolve, child);
schemaNamespace = currSchemaInfo.fTargetNamespace;
if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
- if (isOverride && newSchemaRoot != null && schemaSource.getSystemId() != "") {
+ if (isOverride && newSchemaRoot != null && isValidTargetUriForOverride(schemaSource, locationHint)) {
final Element transformedSchemaRoot = (Element) fOverrideHandler.transform(schemaId, child, newSchemaRoot);
// Either we had a collision where the transformed
@@ -1278,6 +1278,14 @@ public class XSDHandler {
fDependencyMap.put(currSchemaInfo, dependencies);
return currSchemaInfo;
} // end constructTrees
+
+ /*
+ * Check if the target URI for <override> is correct. It must not be absent, and it should not point to the parent
+ * schema document (otherwise, this would result in an un-terminating recursion).
+ */
+ private boolean isValidTargetUriForOverride(XMLInputSource schemaSource, String locationHint) {
+ return schemaSource.getSystemId() != "" && ((locationHint != null) ? (schemaSource.getSystemId() != locationHint) : true);
+ }
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org