Skip to content

Commit

Permalink
Further cleanup for #1253 wrt 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 27, 2016
1 parent e98a273 commit dcc7087
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ public final void writeStartObject() throws IOException
@Override // since 2.8
public void writeStartObject(Object forValue) throws IOException
{
_writeContext.writeValue();
_append(JsonToken.START_OBJECT);
JsonWriteContext ctxt = _writeContext.createChildObjectContext();
_writeContext = ctxt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,29 @@ private void _verifyOutputContext(JsonStreamContext ctxt1, JsonStreamContext ctx
_verifyOutputContext(ctxt1.getParent(), ctxt2.getParent());
}

// [databind#1253]
public void testParentSiblingContext() throws IOException
{
TokenBuffer buf = new TokenBuffer(null, false); // no ObjectCodec

// {"a":{},"b":{"c":"cval"}}

buf.writeStartObject();
buf.writeFieldName("a");
buf.writeStartObject();
buf.writeEndObject();

buf.writeFieldName("b");
buf.writeStartObject();
buf.writeFieldName("c");
//This assertion fails (because of 'a')
assertEquals("b", buf.getOutputContext().getParent().getCurrentName());
buf.writeString("cval");
buf.writeEndObject();
buf.writeEndObject();
buf.close();
}

/*
/**********************************************************
/* Tests to verify interaction of TokenBuffer and JsonParserSequence
Expand Down
38 changes: 0 additions & 38 deletions src/test/java/com/fasterxml/jackson/failing/TestTokenBuffer.java

This file was deleted.

0 comments on commit dcc7087

Please sign in to comment.