Author: yonik
Date: Thu Jan  3 13:30:05 2008
New Revision: 608637

URL: http://svn.apache.org/viewvc?rev=608637&view=rev
Log:
SolrJ xml parsing: allow different types in an array and allow null in array

Modified:
    
lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java

Modified: 
lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java
URL: 
http://svn.apache.org/viewvc/lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java?rev=608637&r1=608636&r2=608637&view=diff
==============================================================================
--- 
lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java
 (original)
+++ 
lucene/solr/trunk/client/java/solrj/src/org/apache/solr/client/solrj/impl/XMLResponseParser.java
 Thu Jan  3 13:30:05 2008
@@ -263,9 +263,12 @@
         if( type == null ) {
           type = t;
         }
-        else if( type != t ) {
+        /*** actually, there is no rule that arrays need the same type
+        else if( type != t && !(t == KnownType.NULL || type == 
KnownType.NULL)) {
           throw new RuntimeException( "arrays must have the same type! 
("+type+"!="+t+") "+parser.getLocalName() );
         }
+        ***/
+        type = t;
 
         builder.setLength( 0 ); // reset the text
         
@@ -286,7 +289,7 @@
         }
         //System.out.println( "ARR:"+type+"::"+builder );
         Object val = type.read( builder.toString().trim() );
-        if( val == null ) {
+        if( val == null && type != KnownType.NULL) {
           throw new XMLStreamException( "error reading value:"+type, 
parser.getLocation() );
         }
         vals.add( val );


Reply via email to