Skip to content

Commit c63b32f

Browse files
committed
Minor tweaks wrt earlier fix
1 parent 8280a1e commit c63b32f

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/JSR310FormattedSerializerBase.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,14 @@ protected abstract JSR310FormattedSerializerBase<?> withFormat(Boolean useTimest
102102
/**
103103
* @since 2.8
104104
*/
105+
@Deprecated // since 2.9.5
105106
protected JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId) {
106107
// 01-Jul-2016, tatu: Sub-classes need to override
107108
return this;
108109
}
109110

110111
/**
111-
* @since 2.9
112+
* @since 2.9.5
112113
*/
113114
protected JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId,
114115
Boolean writeNanoseconds) {
@@ -153,7 +154,7 @@ public JsonSerializer<?> createContextual(SerializerProvider prov,
153154
}
154155
Boolean writeZoneId = format.getFeature(JsonFormat.Feature.WRITE_DATES_WITH_ZONE_ID);
155156
Boolean writeNanoseconds = format.getFeature(JsonFormat.Feature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS);
156-
if (writeZoneId != null || writeNanoseconds != null) {
157+
if ((writeZoneId != null) || (writeNanoseconds != null)) {
157158
ser = ser.withFeatures(writeZoneId, writeNanoseconds);
158159
}
159160
return ser;
@@ -195,7 +196,7 @@ protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaTyp
195196

196197
protected boolean useTimestamp(SerializerProvider provider) {
197198
if (_useTimestamp != null) {
198-
return _useTimestamp;
199+
return _useTimestamp.booleanValue();
199200
}
200201
if (_shape != null) {
201202
if (_shape == Shape.STRING) {
@@ -211,14 +212,14 @@ protected boolean useTimestamp(SerializerProvider provider) {
211212

212213
protected boolean _useTimestampExplicitOnly(SerializerProvider provider) {
213214
if (_useTimestamp != null) {
214-
return _useTimestamp;
215+
return _useTimestamp.booleanValue();
215216
}
216217
return false;
217218
}
218219

219220
protected boolean useNanoseconds(SerializerProvider provider) {
220221
if (_useNanoseconds != null) {
221-
return _useNanoseconds;
222+
return _useNanoseconds.booleanValue();
222223
}
223224
if (_shape != null) {
224225
if (_shape == Shape.NUMBER_INT) {

datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/LocalDateTimeSerializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private final void _serializeAsArrayContents(LocalDateTime value, JsonGenerator
118118
}
119119
}
120120
}
121-
121+
122122
@Override // since 2.9
123123
protected JsonToken serializationShape(SerializerProvider provider) {
124124
return useTimestamp(provider) ? JsonToken.START_ARRAY : JsonToken.VALUE_STRING;

datetime/src/main/java/com/fasterxml/jackson/datatype/jsr310/ser/ZonedDateTimeSerializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected JSR310FormattedSerializerBase<?> withFormat(
5555
}
5656

5757
@Override
58+
@Deprecated
5859
protected JSR310FormattedSerializerBase<?> withFeatures(Boolean writeZoneId) {
5960
return new ZonedDateTimeSerializer(this, _useTimestamp, _formatter, writeZoneId);
6061
}

0 commit comments

Comments
 (0)