Fix for issue 209 - make use of _allowMultipleMatches FilterParsingDelegate
diff --git a/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java b/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java
index 7900229..bf68cd7 100644
--- a/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java
+++ b/src/main/java/com/fasterxml/jackson/core/filter/FilteringParserDelegate.java
@@ -221,6 +221,21 @@
@Override
public JsonToken nextToken() throws IOException
{
+ //Check for _allowMultipleMatches - false and atleast there is one token - which is _currToken
+ // check for no buffered context _exposedContext - null
+ //If all the conditions matches then check for scalar / non-scalar property
+ if(!_allowMultipleMatches && _currToken != null && _exposedContext == null){
+ //if not scalar and ended successfully, then return null
+ if((_currToken.isStructEnd() && _headContext.isStartHandled()) ){
+ return (_currToken = null);
+ }
+ //else if scalar, and scalar not present in obj/array and !includePath and INCLUDE_ALL matched once
+ // then return null
+ else if(_currToken.isScalarValue() && !_headContext.isStartHandled() && !_includePath
+ && _itemFilter == TokenFilter.INCLUDE_ALL) {
+ return (_currToken = null);
+ }
+ }
// Anything buffered?
TokenFilterContext ctxt = _exposedContext;
@@ -877,4 +892,5 @@
}
return _headContext;
}
+
}