SolrJ xml parsing: allow different types in an array and allow null in array

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@608637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2008-01-03 21:30:05 +00:00
parent dc484ada1e
commit a7610123de
1 changed files with 5 additions and 2 deletions

View File

@ -263,9 +263,12 @@ public class XMLResponseParser implements ResponseParser
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 @@ public class XMLResponseParser implements ResponseParser
}
//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 );