Skip to content

Commit 4456e66

Browse files
committed
Merge pull request FasterXML#149 from evanj/master
JsonParser, ObjectCodec: javadoc: empty docs to return null
2 parents e997287 + ea603c3 commit 4456e66

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/java/com/fasterxml/jackson/core/JsonParser.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,9 @@ public <T> Iterator<T> readValuesAs(TypeReference<?> valueTypeRef) throws IOExce
13901390
* represented by root {@link TreeNode} of resulting model.
13911391
* For JSON Arrays it will an array node (with child nodes),
13921392
* for objects object node (with child nodes), and for other types
1393-
* matching leaf node type
1393+
* matching leaf node type. Empty or whitespace documents are null.
1394+
*
1395+
* @return root of the document, or null if empty or whitespace.
13941396
*/
13951397
@SuppressWarnings("unchecked")
13961398
public <T extends TreeNode> T readValueAsTree() throws IOException {

src/main/java/com/fasterxml/jackson/core/ObjectCodec.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ public abstract void writeValue(JsonGenerator jgen, Object value)
113113
* using set of {@link TreeNode} instances. Returns
114114
* root of the resulting tree (where root can consist
115115
* of just a single node if the current event is a
116-
* value event, not container).
116+
* value event, not container). Empty or whitespace
117+
* documents return null.
118+
*
119+
* @return next tree from jp, or null if empty.
117120
*/
118121
@Override
119122
public abstract <T extends TreeNode> T readTree(JsonParser jp)

0 commit comments

Comments
 (0)