Skip to content

Commit

Permalink
And then replacing/removing JsonGenerationException with `StreamWri…
Browse files Browse the repository at this point in the history
…teException` where possible
  • Loading branch information
cowtowncoder committed Jan 21, 2021
1 parent 8122144 commit 0793e87
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.core.exc.StreamWriteException;
import com.fasterxml.jackson.core.io.CharacterEscapes;
import com.fasterxml.jackson.core.io.SegmentedStringWriter;
import com.fasterxml.jackson.core.type.ResolvedType;
Expand Down Expand Up @@ -3106,7 +3107,7 @@ public JsonNode readTree(URL source) throws IOException
*/
@Override
public void writeValue(JsonGenerator g, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_assertNotNull("g", g);
SerializationConfig config = getSerializationConfig();
Expand Down Expand Up @@ -3679,7 +3680,7 @@ public <T> T readValue(DataInput src, JavaType valueType) throws IOException
* JSON output, written to File provided.
*/
public void writeValue(File resultFile, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(resultFile, JsonEncoding.UTF8), value);
}
Expand All @@ -3696,7 +3697,7 @@ public void writeValue(File resultFile, Object value)
* is closed).
*/
public void writeValue(OutputStream out, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(out, JsonEncoding.UTF8), value);
}
Expand All @@ -3720,7 +3721,7 @@ public void writeValue(DataOutput out, Object value) throws IOException
* is closed).
*/
public void writeValue(Writer w, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(w), value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.concurrent.atomic.AtomicReference;

import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.exc.StreamWriteException;
import com.fasterxml.jackson.core.io.CharacterEscapes;
import com.fasterxml.jackson.core.io.SegmentedStringWriter;
import com.fasterxml.jackson.core.io.SerializedString;
Expand Down Expand Up @@ -1021,7 +1022,7 @@ public void writeValue(JsonGenerator g, Object value) throws IOException
* JSON output, written to File provided.
*/
public void writeValue(File resultFile, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(resultFile, JsonEncoding.UTF8), value);
}
Expand All @@ -1038,7 +1039,7 @@ public void writeValue(File resultFile, Object value)
* is closed).
*/
public void writeValue(OutputStream out, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(out, JsonEncoding.UTF8), value);
}
Expand All @@ -1054,7 +1055,7 @@ public void writeValue(OutputStream out, Object value)
* is closed).
*/
public void writeValue(Writer w, Object value)
throws IOException, JsonGenerationException, JsonMappingException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(w), value);
}
Expand All @@ -1063,7 +1064,7 @@ public void writeValue(Writer w, Object value)
* @since 2.8
*/
public void writeValue(DataOutput out, Object value)
throws IOException
throws IOException, StreamWriteException, JsonMappingException
{
_writeValueAndClose(createGenerator(out), value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public DOMSerializer() {

@Override
public void serialize(Node value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException
throws IOException
{
if (_domImpl == null) throw new IllegalStateException("Could not find DOM LS");
LSSerializer writer = _domImpl.createLSSerializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,10 @@ protected void serializeFields(Object bean, JsonGenerator gen, SerializerProvide
*/
protected void serializeFieldsFiltered(Object bean, JsonGenerator gen,
SerializerProvider provider)
throws IOException, JsonGenerationException
throws IOException
{
/* note: almost verbatim copy of "serializeFields"; copied (instead of merged)
* so that old method need not add check for existence of filter.
*/
// note: almost verbatim copy of "serializeFields"; copied (instead of merged)
// so that old method need not add check for existence of filter.
final BeanPropertyWriter[] props;
if (_filteredProps != null && provider.getActiveView() != null) {
props = _filteredProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static class AtomicBooleanSerializer
public AtomicBooleanSerializer() { super(AtomicBoolean.class, false); }

@Override
public void serialize(AtomicBoolean value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException {
public void serialize(AtomicBoolean value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeBoolean(value.get());
}

Expand All @@ -84,7 +84,7 @@ public static class AtomicIntegerSerializer
public AtomicIntegerSerializer() { super(AtomicInteger.class, false); }

@Override
public void serialize(AtomicInteger value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException {
public void serialize(AtomicInteger value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeNumber(value.get());
}

Expand All @@ -106,7 +106,7 @@ public static class AtomicLongSerializer
public AtomicLongSerializer() { super(AtomicLong.class, false); }

@Override
public void serialize(AtomicLong value, JsonGenerator gen, SerializerProvider provider) throws IOException, JsonGenerationException {
public void serialize(AtomicLong value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeNumber(value.get());
}

Expand Down

0 comments on commit 0793e87

Please sign in to comment.