Skip to content

Commit b399f7e

Browse files
committed
#40 - Change Jackson adapter to throw UncheckedIOException rather than RuntimeException
1 parent bbbb2b1 commit b399f7e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<dependency>
3535
<groupId>io.avaje</groupId>
3636
<artifactId>avaje-jsonb</artifactId>
37-
<version>0.8</version>
37+
<version>0.11</version>
3838
<optional>true</optional>
3939
</dependency>
4040

client/src/main/java/io/avaje/http/client/JacksonBodyAdapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.databind.type.CollectionType;
77

88
import java.io.IOException;
9+
import java.io.UncheckedIOException;
910
import java.util.List;
1011
import java.util.concurrent.ConcurrentHashMap;
1112

@@ -98,7 +99,7 @@ public T readBody(String content) {
9899
try {
99100
return reader.readValue(content);
100101
} catch (IOException e) {
101-
throw new RuntimeException(e);
102+
throw new UncheckedIOException(e);
102103
}
103104
}
104105

@@ -107,7 +108,7 @@ public T read(BodyContent bodyContent) {
107108
try {
108109
return reader.readValue(bodyContent.content());
109110
} catch (IOException e) {
110-
throw new RuntimeException(e);
111+
throw new UncheckedIOException(e);
111112
}
112113
}
113114
}
@@ -132,7 +133,7 @@ public BodyContent write(T bean) {
132133
try {
133134
return BodyContent.asJson(writer.writeValueAsBytes(bean));
134135
} catch (JsonProcessingException e) {
135-
throw new RuntimeException(e);
136+
throw new UncheckedIOException(e);
136137
}
137138
}
138139
}

0 commit comments

Comments
 (0)