mirror of https://github.com/apache/lucene.git
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:
parent
dc484ada1e
commit
a7610123de
|
@ -263,9 +263,12 @@ public class XMLResponseParser implements ResponseParser
|
||||||
if( type == null ) {
|
if( type == null ) {
|
||||||
type = t;
|
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() );
|
throw new RuntimeException( "arrays must have the same type! ("+type+"!="+t+") "+parser.getLocalName() );
|
||||||
}
|
}
|
||||||
|
***/
|
||||||
|
type = t;
|
||||||
|
|
||||||
builder.setLength( 0 ); // reset the text
|
builder.setLength( 0 ); // reset the text
|
||||||
|
|
||||||
|
@ -286,7 +289,7 @@ public class XMLResponseParser implements ResponseParser
|
||||||
}
|
}
|
||||||
//System.out.println( "ARR:"+type+"::"+builder );
|
//System.out.println( "ARR:"+type+"::"+builder );
|
||||||
Object val = type.read( builder.toString().trim() );
|
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() );
|
throw new XMLStreamException( "error reading value:"+type, parser.getLocation() );
|
||||||
}
|
}
|
||||||
vals.add( val );
|
vals.add( val );
|
||||||
|
|
Loading…
Reference in New Issue