Skip to content

Commit 73d834d

Browse files
committed
Merge branch '2.10'
2 parents 97ed96f + ee5596c commit 73d834d

File tree

4 files changed

+50
-55
lines changed

4 files changed

+50
-55
lines changed

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/AvroGenerator.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ private Feature(boolean defaultState) {
8080
}
8181

8282
/*
83-
/**********************************************************
83+
/**********************************************************************
8484
/* Configuration
85-
/**********************************************************
85+
/**********************************************************************
8686
*/
8787

8888
final protected IOContext _ioContext;
@@ -97,9 +97,9 @@ private Feature(boolean defaultState) {
9797
protected AvroSchema _rootSchema;
9898

9999
/*
100-
/**********************************************************
100+
/**********************************************************************
101101
/* Output state
102-
/**********************************************************
102+
/**********************************************************************
103103
*/
104104

105105
final protected OutputStream _output;
@@ -126,9 +126,9 @@ private Feature(boolean defaultState) {
126126
protected boolean _complete;
127127

128128
/*
129-
/**********************************************************
129+
/**********************************************************************
130130
/* Life-cycle
131-
/**********************************************************
131+
/**********************************************************************
132132
*/
133133

134134
public AvroGenerator(ObjectWriteContext writeCtxt, IOContext ctxt,
@@ -158,9 +158,9 @@ public void setSchema(AvroSchema schema)
158158
}
159159

160160
/*
161-
/**********************************************************
161+
/**********************************************************************
162162
/* Versioned
163-
/**********************************************************
163+
/**********************************************************************
164164
*/
165165

166166
@Override
@@ -169,9 +169,9 @@ public Version version() {
169169
}
170170

171171
/*
172-
/**********************************************************
172+
/**********************************************************************
173173
/* Output state handling
174-
/**********************************************************
174+
/**********************************************************************
175175
*/
176176

177177
@Override
@@ -186,11 +186,11 @@ public Object getCurrentValue() {
186186
public void setCurrentValue(Object v) {
187187
_tokenWriteContext.setCurrentValue(v);
188188
}
189-
189+
190190
/*
191-
/**********************************************************
191+
/**********************************************************************
192192
/* Overridden methods, configuration
193-
/**********************************************************
193+
/**********************************************************************
194194
*/
195195

196196
@Override
@@ -232,9 +232,9 @@ public void setSchema(FormatSchema schema)
232232
}
233233

234234
/*
235-
/**********************************************************
235+
/**********************************************************************
236236
/* Extended API, configuration
237-
/**********************************************************
237+
/**********************************************************************
238238
*/
239239

240240
public AvroGenerator enable(Feature f) {
@@ -292,9 +292,9 @@ public final void writeStringField(String fieldName, String value)
292292
}
293293

294294
/*
295-
/**********************************************************
295+
/**********************************************************************
296296
/* Public API: low-level I/O
297-
/**********************************************************
297+
/**********************************************************************
298298
*/
299299

300300
@Override
@@ -350,9 +350,9 @@ public void close() throws IOException
350350
}
351351

352352
/*
353-
/**********************************************************
353+
/**********************************************************************
354354
/* Public API: structural output
355-
/**********************************************************
355+
/**********************************************************************
356356
*/
357357

358358
@Override
@@ -381,7 +381,7 @@ public final void writeEndArray() throws IOException
381381

382382
@Override
383383
public final void writeStartObject() throws IOException {
384-
_tokenWriteContext = _tokenWriteContext.createChildObjectContext();
384+
_tokenWriteContext = _tokenWriteContext.createChildObjectContext(null);
385385
_complete = false;
386386
}
387387

@@ -408,9 +408,9 @@ public final void writeEndObject() throws IOException
408408
}
409409

410410
/*
411-
/**********************************************************
411+
/**********************************************************************
412412
/* Output method implementations, textual
413-
/**********************************************************
413+
/**********************************************************************
414414
*/
415415

416416
@Override
@@ -444,9 +444,9 @@ public final void writeUTF8String(byte[] text, int offset, int len) throws IOExc
444444
}
445445

446446
/*
447-
/**********************************************************
447+
/**********************************************************************
448448
/* Output method implementations, unprocessed ("raw")
449-
/**********************************************************
449+
/**********************************************************************
450450
*/
451451

452452
@Override
@@ -494,9 +494,9 @@ public void writeRawValue(char[] text, int offset, int len) throws IOException {
494494
}
495495

496496
/*
497-
/**********************************************************
497+
/**********************************************************************
498498
/* Output method implementations, base64-encoded binary
499-
/**********************************************************
499+
/**********************************************************************
500500
*/
501501

502502
@Override
@@ -510,9 +510,9 @@ public void writeBinary(Base64Variant b64variant, byte[] data, int offset, int l
510510
}
511511

512512
/*
513-
/**********************************************************
513+
/**********************************************************************
514514
/* Output method implementations, primitive
515-
/**********************************************************
515+
/**********************************************************************
516516
*/
517517

518518
@Override
@@ -579,9 +579,9 @@ public void writeNumber(String encodedValue) throws IOException {
579579
}
580580

581581
/*
582-
/**********************************************************
582+
/**********************************************************************
583583
/* Implementations for methods from base class
584-
/**********************************************************
584+
/**********************************************************************
585585
*/
586586

587587
@Override
@@ -600,9 +600,9 @@ protected void _releaseBuffers() {
600600
}
601601

602602
/*
603-
/**********************************************************
603+
/**********************************************************************
604604
/* Helper methods
605-
/**********************************************************
605+
/**********************************************************************
606606
*/
607607

608608
protected void _complete() throws IOException

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/ser/AvroWriteContext.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ public static AvroWriteContext nullContext() {
7070

7171
public abstract AvroWriteContext createChildArrayContext(Object currValue) throws JsonMappingException;
7272

73-
public AvroWriteContext createChildObjectContext() throws JsonMappingException {
74-
return createChildObjectContext(null);
75-
}
76-
7773
public abstract AvroWriteContext createChildObjectContext(Object currValue) throws JsonMappingException;
7874

7975
public void complete() throws IOException {
@@ -115,6 +111,7 @@ public void setCurrentValue(Object v) {
115111
* iff column was recognized)
116112
*/
117113
public boolean writeFieldName(String name) throws IOException {
114+
// To be overridden by Record/Map contexts
118115
return false;
119116
}
120117

@@ -201,23 +198,33 @@ protected GenericArray<Object> _createArray(Schema schema)
201198
return new GenericData.Array<Object>(8, schema);
202199
}
203200

201+
// Removed from 2.10, should not be needed any more
202+
/*
204203
protected AvroWriteContext _createObjectContext(Schema schema) throws JsonMappingException {
205204
if (schema.getType() == Type.UNION) {
206205
schema = _recordOrMapFromUnion(schema);
207206
}
208207
return _createObjectContext(schema, null); // Object doesn't matter as long as schema isn't a union
209208
}
209+
*/
210210

211211
protected AvroWriteContext _createObjectContext(Schema schema, Object currValue)
212212
throws JsonMappingException
213213
{
214214
Type type = schema.getType();
215215
if (type == Schema.Type.UNION) {
216-
try {
217-
schema = resolveUnionSchema(schema, currValue);
218-
} catch (UnresolvedUnionException e) {
219-
// couldn't find an exact match
216+
// 14-Aug-2019, tatu: Mapping null is bit special; and without special handling
217+
// we get an exception after fix for [dataformats-binary#168]
218+
// ... but I am not sure I fully understand what or why, actually.
219+
if (currValue == null) {
220220
schema = _recordOrMapFromUnion(schema);
221+
} else {
222+
try {
223+
schema = resolveUnionSchema(schema, currValue);
224+
} catch (UnresolvedUnionException e) {
225+
// couldn't find an exact match
226+
schema = _recordOrMapFromUnion(schema);
227+
}
221228
}
222229
type = schema.getType();
223230
}

avro/src/main/java/com/fasterxml/jackson/dataformat/avro/ser/ObjectWriteContext.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ public final AvroWriteContext createChildArrayContext(Object currValue)
4747
return child;
4848
}
4949

50-
@Override
51-
public AvroWriteContext createChildObjectContext() throws JsonMappingException {
52-
_verifyValueWrite();
53-
Schema.Field field = _findField();
54-
if (field == null) { // unknown, to ignore
55-
return new NopWriteContext(TYPE_OBJECT, this, _generator, null);
56-
}
57-
AvroWriteContext child = _createObjectContext(field.schema());
58-
_record.put(_currentName, child.rawValue());
59-
return child;
60-
}
61-
6250
@Override
6351
public AvroWriteContext createChildObjectContext(Object currValue) throws JsonMappingException {
6452
_verifyValueWrite();

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/polymorphism/IonAnnotationIntrospector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
*/
4747
public class IonAnnotationIntrospector extends NopAnnotationIntrospector {
4848
private static final long serialVersionUID = 1L;
49-
50-
private final boolean resolveAllTypes;
49+
50+
// private final boolean resolveAllTypes;
5151

5252
public IonAnnotationIntrospector(boolean resolveAllTypes) {
53-
this.resolveAllTypes = resolveAllTypes;
53+
// this.resolveAllTypes = resolveAllTypes;
5454
}
5555

5656
/**

0 commit comments

Comments
 (0)