lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1387784 - in /lucene/dev/branches/branch_4x: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/ lucene/benchmark/ lucene/codecs/ lucene/core/ lucene/demo/ lucene/facet/ lucene...
Date Wed, 19 Sep 2012 21:41:22 GMT
Author: hossman
Date: Wed Sep 19 21:41:20 2012
New Revision: 1387784

URL: http://svn.apache.org/viewvc?rev=1387784&view=rev
Log:
SOLR-3087: Fixed DOMUtil so that code doing attribute validation will automaticly ignore nodes
in the resserved "xml" prefix (merge r1387778)

Added:
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-snippet-field.xml
      - copied unchanged from r1387778, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-snippet-field.xml
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-snippet-type.xml
      - copied unchanged from r1387778, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-snippet-type.xml
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xml
      - copied unchanged from r1387778, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-xinclude.xml
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-snippet-processor.xml
      - copied unchanged from r1387778, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-snippet-processor.xml
Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/BUILD.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/CHANGES.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/MIGRATE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/README.txt   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/   (props changed)
    lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java
  (props changed)
    lucene/dev/branches/branch_4x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_4x/lucene/benchmark/   (props changed)
    lucene/dev/branches/branch_4x/lucene/build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/codecs/   (props changed)
    lucene/dev/branches/branch_4x/lucene/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/demo/   (props changed)
    lucene/dev/branches/branch_4x/lucene/facet/   (props changed)
    lucene/dev/branches/branch_4x/lucene/grouping/   (props changed)
    lucene/dev/branches/branch_4x/lucene/highlighter/   (props changed)
    lucene/dev/branches/branch_4x/lucene/ivy-settings.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/join/   (props changed)
    lucene/dev/branches/branch_4x/lucene/licenses/   (props changed)
    lucene/dev/branches/branch_4x/lucene/memory/   (props changed)
    lucene/dev/branches/branch_4x/lucene/misc/   (props changed)
    lucene/dev/branches/branch_4x/lucene/module-build.xml   (props changed)
    lucene/dev/branches/branch_4x/lucene/queries/   (props changed)
    lucene/dev/branches/branch_4x/lucene/queryparser/   (props changed)
    lucene/dev/branches/branch_4x/lucene/sandbox/   (props changed)
    lucene/dev/branches/branch_4x/lucene/site/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/suggest/   (props changed)
    lucene/dev/branches/branch_4x/lucene/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/lucene/tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/README.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/cloud-dev/   (props changed)
    lucene/dev/branches/branch_4x/solr/common-build.xml   (props changed)
    lucene/dev/branches/branch_4x/solr/contrib/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/DOMUtil.java
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-xinclude.xml
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java
    lucene/dev/branches/branch_4x/solr/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt   (props changed)
    lucene/dev/branches/branch_4x/solr/scripts/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/testlogging.properties   (props changed)
    lucene/dev/branches/branch_4x/solr/webapp/   (props changed)

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1387784&r1=1387783&r2=1387784&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Wed Sep 19 21:41:20 2012
@@ -244,6 +244,11 @@ Bug Fixes
 * SOLR-3850: DataImportHandler "cacheKey" parameter was incorrectly renamed "cachePk"
   (James Dyer)
 
+* SOLR-3087: Fixed DOMUtil so that code doing attribute validation will 
+  automaticly ignore nodes in the resserved "xml" prefix - in particular this 
+  fixes some bugs related to xinclude and fieldTypes.
+  (Amit Nithian, hossman)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/DOMUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/DOMUtil.java?rev=1387784&r1=1387783&r2=1387784&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/DOMUtil.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/util/DOMUtil.java Wed
Sep 19 21:41:20 2012
@@ -31,6 +31,8 @@ import org.w3c.dom.NodeList;
  */
 public class DOMUtil {
 
+  public static final String XML_RESERVED_PREFIX = "xml";
+
   public static Map<String,String> toMap(NamedNodeMap attrs) {
     return toMapExcept(attrs);
   }
@@ -39,6 +41,10 @@ public class DOMUtil {
     Map<String,String> args = new HashMap<String,String>();
     outer: for (int j=0; j<attrs.getLength(); j++) {
       Node attr = attrs.item(j);
+
+      // automaticly exclude things in the xml namespace, ie: xml:base
+      if (XML_RESERVED_PREFIX.equals(attr.getPrefix())) continue outer;
+
       String attrName = attr.getNodeName();
       for (String ex : exclusions)
         if (ex.equals(attrName)) continue outer;

Modified: lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-xinclude.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-xinclude.xml?rev=1387784&r1=1387783&r2=1387784&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-xinclude.xml
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/solrconfig-xinclude.xml
Wed Sep 19 21:41:20 2012
@@ -25,4 +25,9 @@
       <xi:include href="solrconfig-reqHandler.incl" xmlns:xi="http://www.w3.org/2001/XInclude"/>
     </xi:fallback>
   </xi:include>
+
+  <updateRequestProcessorChain name="special-include" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <xi:include href="solrconfig-snippet-processor.xml" />
+  </updateRequestProcessorChain>
+
 </config>

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java?rev=1387784&r1=1387783&r2=1387784&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestXIncludeConfig.java
Wed Sep 19 21:41:20 2012
@@ -17,22 +17,20 @@ package org.apache.solr.core;
  * limitations under the License.
  */
 
-import org.apache.solr.request.SolrRequestHandler;
+import org.apache.solr.update.processor.UpdateRequestProcessorChain;
+import org.apache.solr.update.processor.RegexReplaceProcessorFactory;
+
 import org.apache.solr.util.AbstractSolrTestCase;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.junit.Assume;
 
-/**
- *
- *
- **/
 public class TestXIncludeConfig extends AbstractSolrTestCase {
-  protected boolean supports;
 
   @Override
   public String getSchemaFile() {
-    return "schema.xml";
+    return "schema-xinclude.xml";
   }
 
   //public String getSolrConfigFile() { return "solrconfig.xml"; }
@@ -43,28 +41,35 @@ public class TestXIncludeConfig extends 
 
   @Override
   public void setUp() throws Exception {
-    supports = true;
     javax.xml.parsers.DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
     try {
       //see whether it even makes sense to run this test
       dbf.setXIncludeAware(true);
       dbf.setNamespaceAware(true);
     } catch (UnsupportedOperationException e) {
-      supports = false;
+      Assume.assumeTrue(false);
     }
     super.setUp();
   }
 
   public void testXInclude() throws Exception {
-    //Figure out whether this JVM supports XInclude anyway, if it doesn't then don't run
this test????
-    // TODO: figure out a better way to handle this.
-    if (supports == true){
-      SolrCore core = h.getCore();
-      SolrRequestHandler solrRequestHandler = core.getRequestHandler("includedHandler");
-      assertNotNull("Solr Req Handler is null", solrRequestHandler);
-    } else {
-      log.info("Didn't run testXInclude, because this XML DocumentBuilderFactory doesn't
support it");
-    }
+    SolrCore core = h.getCore();
+
+    assertNotNull("includedHandler is null", 
+                  core.getRequestHandler("includedHandler"));
 
+    UpdateRequestProcessorChain chain 
+      = core.getUpdateProcessingChain("special-include");
+    assertNotNull("chain is missing included processor", chain);
+    assertEquals("chain with inclued processor is wrong size", 
+                 1, chain.getFactories().length);
+    assertEquals("chain has wrong included processor",
+                 RegexReplaceProcessorFactory.class,
+                 chain.getFactories()[0].getClass());
+
+    assertNotNull("ft-included is null",
+                  core.getSchema().getFieldTypeByName("ft-included"));
+    assertNotNull("field-included is null",
+                  core.getSchema().getFieldOrNull("field-included"));
   }
 }



Mime
View raw message