xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zong...@apache.org
Subject svn commit: r669372 - in /xalan/java/trunk/src/org/apache/xalan/xsltc/compiler: CallTemplate.java LiteralElement.java QName.java xpath.cup
Date Thu, 19 Jun 2008 03:39:52 GMT
Author: zongaro
Date: Wed Jun 18 20:39:52 2008
New Revision: 669372

URL: http://svn.apache.org/viewvc?rev=669372&view=rev
Log:
Part of fix for Jira issue XALANJ-2446:

The implementation of getQName(String,String,String) method was ensuring
that any particular pair of namespace URI and local part of the name would
result in a unique QName object.  It did not take into account the prefix,
despite the fact that the original prefix might be associated with a different
namespace URI in this new context or with no namespace at all.

Fixed this by making getQName take into account all three of the namespace URI,
local part of the name and prefix in order to create unique QName objects.

Reviewed by Christine Li (jycli () ca ! ibm ! com)

Modified:
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/CallTemplate.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/LiteralElement.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/QName.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/xpath.cup

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/CallTemplate.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/CallTemplate.java?rev=669372&r1=669371&r2=669372&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/CallTemplate.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/CallTemplate.java Wed Jun 18 20:39:52
2008
@@ -222,13 +222,13 @@
     	    	for (int k = 0; k < numParams; k++) {
     	    	    Object object = _parameters[k];
     	    	    if (object instanceof Param 
-    	    	        && ((Param)object).getName() == name) {
+    	    	        && ((Param)object).getName().equals(name)) {
     	    	        withParam.setDoParameterOptimization(true);
     	    	        _parameters[k] = withParam;
     	    	        break;
     	    	    }
     	    	    else if (object instanceof WithParam 
-    	    	        && ((WithParam)object).getName() == name) {
+    	    	        && ((WithParam)object).getName().equals(name)) {
     	    	        withParam.setDoParameterOptimization(true);
     	    	        _parameters[k] = withParam;    	    	        
     	    	        break;

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/LiteralElement.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/LiteralElement.java?rev=669372&r1=669371&r2=669372&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/LiteralElement.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/LiteralElement.java Wed Jun 18 20:39:52
2008
@@ -250,7 +250,7 @@
 	    // Handle xsl:use-attribute-sets. Attribute sets are placed first
 	    // in the vector or attributes to make sure that later local
 	    // attributes can override an attributes in the set.
-	    if (qname == parser.getUseAttributeSets()) {
+	    if (qname.equals(parser.getUseAttributeSets())) {
             	if (!Util.isValidQNames(val)) {
                     ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, val, this);
                     parser.reportError(Constants.ERROR, err);	
@@ -258,11 +258,11 @@
 		setFirstAttribute(new UseAttributeSets(val, parser));
 	    }
 	    // Handle xsl:extension-element-prefixes
-	    else if (qname == parser.getExtensionElementPrefixes()) {
+	    else if (qname.equals(parser.getExtensionElementPrefixes())) {
 		stable.excludeNamespaces(val);
 	    }
 	    // Handle xsl:exclude-result-prefixes
-	    else if (qname == parser.getExcludeResultPrefixes()) {
+	    else if (qname.equals(parser.getExcludeResultPrefixes())) {
 		stable.excludeNamespaces(val);
 	    }
 	    else {
@@ -305,11 +305,11 @@
 	    final String val = _attributes.getValue(i);
 
 	    // Handle xsl:extension-element-prefixes
-	    if (qname == parser.getExtensionElementPrefixes()) {
+	    if (qname.equals(parser.getExtensionElementPrefixes())) {
 		stable.unExcludeNamespaces(val);
 	    }
 	    // Handle xsl:exclude-result-prefixes
-	    else if (qname == parser.getExcludeResultPrefixes()) {
+	    else if (qname.equals(parser.getExcludeResultPrefixes())) {
 		stable.unExcludeNamespaces(val);
 	    }
 	}

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/QName.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/QName.java?rev=669372&r1=669371&r2=669372&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/QName.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/QName.java Wed Jun 18 20:39:52 2008
@@ -58,7 +58,9 @@
     }
 
     public boolean equals(Object other) {
-	return (this == other);
+	return (this == other)
+	           || (other instanceof QName
+	                   && _stringRep.equals(((QName) other).getStringRep()));
     }
 
     public String getLocalPart() {

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/xpath.cup
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/xpath.cup?rev=669372&r1=669371&r2=669372&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/xpath.cup (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/xpath.cup Wed Jun 18 20:39:52 2008
@@ -871,43 +871,43 @@
 FunctionCall ::= FunctionName:fname LPAREN RPAREN
         {: 
 
-          if (fname == parser.getQNameIgnoreDefaultNs("current")) {
+          if (parser.getQNameIgnoreDefaultNs("current").equals(fname)) {
             RESULT = new CurrentCall(fname);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("number")) {
+          else if (parser.getQNameIgnoreDefaultNs("number").equals(fname)) {
             RESULT = new NumberCall(fname, parser.EmptyArgs);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("string")) {
+          else if (parser.getQNameIgnoreDefaultNs("string").equals(fname)) {
             RESULT = new StringCall(fname, parser.EmptyArgs);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("concat")) {
+          else if (parser.getQNameIgnoreDefaultNs("concat").equals(fname)) {
             RESULT = new ConcatCall(fname, parser.EmptyArgs);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("true")) {
+          else if (parser.getQNameIgnoreDefaultNs("true").equals(fname)) {
             RESULT = new BooleanExpr(true);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("false")) {
+          else if (parser.getQNameIgnoreDefaultNs("false").equals(fname)) {
             RESULT = new BooleanExpr(false);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("name")) {
+          else if (parser.getQNameIgnoreDefaultNs("name").equals(fname)) {
             RESULT = new NameCall(fname);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) {
+          else if (parser.getQNameIgnoreDefaultNs("generate-id").equals(fname)) {
             RESULT = new GenerateIdCall(fname, parser.EmptyArgs);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) {
+          else if (parser.getQNameIgnoreDefaultNs("string-length").equals(fname)) {
             RESULT = new StringLengthCall(fname, parser.EmptyArgs);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("position")) {
+          else if (parser.getQNameIgnoreDefaultNs("position").equals(fname)) {
             RESULT = new PositionCall(fname);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("last")) {
+          else if (parser.getQNameIgnoreDefaultNs("last").equals(fname)) {
             RESULT = new LastCall(fname);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) {
+          else if (parser.getQNameIgnoreDefaultNs("local-name").equals(fname)) {
             RESULT = new LocalNameCall(fname);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) {
+          else if (parser.getQNameIgnoreDefaultNs("namespace-uri").equals(fname)) {
             RESULT = new NamespaceUriCall(fname);
 	  }
           else {
@@ -917,78 +917,78 @@
 
         | FunctionName:fname LPAREN NonemptyArgumentList:argl RPAREN
         {:
-          if (fname == parser.getQNameIgnoreDefaultNs("concat")) {
+          if (parser.getQNameIgnoreDefaultNs("concat").equals(fname)) {
             RESULT = new ConcatCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("number")) {
+          else if (parser.getQNameIgnoreDefaultNs("number").equals(fname)) {
             RESULT = new NumberCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("document")) {
+          else if (parser.getQNameIgnoreDefaultNs("document").equals(fname)) {
 	    parser.setMultiDocument(true);
             RESULT = new DocumentCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("string")) {
+          else if (parser.getQNameIgnoreDefaultNs("string").equals(fname)) {
             RESULT = new StringCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("boolean")) {
+          else if (parser.getQNameIgnoreDefaultNs("boolean").equals(fname)) {
             RESULT = new BooleanCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("name")) {
+          else if (parser.getQNameIgnoreDefaultNs("name").equals(fname)) {
             RESULT = new NameCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("generate-id")) {
+          else if (parser.getQNameIgnoreDefaultNs("generate-id").equals(fname)) {
             RESULT = new GenerateIdCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("not")) {
+          else if (parser.getQNameIgnoreDefaultNs("not").equals(fname)) {
             RESULT = new NotCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("format-number")) {
+          else if (parser.getQNameIgnoreDefaultNs("format-number").equals(fname)) {
             RESULT = new FormatNumberCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("unparsed-entity-uri")) {
+          else if (parser.getQNameIgnoreDefaultNs("unparsed-entity-uri").equals(fname)) {
             RESULT = new UnparsedEntityUriCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("key")) {
+          else if (parser.getQNameIgnoreDefaultNs("key").equals(fname)) {
             RESULT = new KeyCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("id")) {
+          else if (parser.getQNameIgnoreDefaultNs("id").equals(fname)) {
             RESULT = new KeyCall(fname, argl);
             parser.setHasIdCall(true);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("ceiling")) {
+          else if (parser.getQNameIgnoreDefaultNs("ceiling").equals(fname)) {
             RESULT = new CeilingCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("round")) {
+          else if (parser.getQNameIgnoreDefaultNs("round").equals(fname)) {
             RESULT = new RoundCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("floor")) {
+          else if (parser.getQNameIgnoreDefaultNs("floor").equals(fname)) {
             RESULT = new FloorCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("contains")) {
+          else if (parser.getQNameIgnoreDefaultNs("contains").equals(fname)) {
             RESULT = new ContainsCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("string-length")) {
+          else if (parser.getQNameIgnoreDefaultNs("string-length").equals(fname)) {
             RESULT = new StringLengthCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("starts-with")) {
+          else if (parser.getQNameIgnoreDefaultNs("starts-with").equals(fname)) {
             RESULT = new StartsWithCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("function-available")) {
+          else if (parser.getQNameIgnoreDefaultNs("function-available").equals(fname)) {
             RESULT = new FunctionAvailableCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("element-available")) {
+          else if (parser.getQNameIgnoreDefaultNs("element-available").equals(fname)) {
             RESULT = new ElementAvailableCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("local-name")) {
+          else if (parser.getQNameIgnoreDefaultNs("local-name").equals(fname)) {
             RESULT = new LocalNameCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("lang")) {
+          else if (parser.getQNameIgnoreDefaultNs("lang").equals(fname)) {
             RESULT = new LangCall(fname, argl);
 	  }
-          else if (fname == parser.getQNameIgnoreDefaultNs("namespace-uri")) {
+          else if (parser.getQNameIgnoreDefaultNs("namespace-uri").equals(fname)) {
             RESULT = new NamespaceUriCall(fname, argl);
 	  }
-          else if (fname == parser.getQName(Constants.TRANSLET_URI, "xsltc", "cast")) {
+          else if (parser.getQName(Constants.TRANSLET_URI, "xsltc", "cast").equals(fname))
{
             RESULT = new CastCall(fname, argl);
 	  }
 	  // Special case for extension function nodeset()



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message