Skip to content

Commit a40ae14

Browse files
authored
Merge pull request #20 from yury-awesome/bugfix/empty-json-error
Fix: no String-argument constructor/factory method to deserialize from String value ('')
2 parents 8811806 + 38ab98f commit a40ae14

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.github.meituan-dianping.lyrebird.sdk</groupId>
77
<artifactId>lyrebird-java-client</artifactId>
8-
<version>1.1.2</version>
8+
<version>1.1.3</version>
99

1010
<name>lyrebird-java-client</name>
1111
<url>https://github.com/Meituan-Dianping/lyrebird-java-client</url>

src/main/java/com/meituan/lyrebird/client/LyrebirdClient.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.meituan.lyrebird.client;
22

3+
import com.fasterxml.jackson.databind.DeserializationFeature;
4+
import com.fasterxml.jackson.databind.ObjectMapper;
35
import com.meituan.lyrebird.client.api.bandwidth.Bandwidth;
46
import com.meituan.lyrebird.client.api.bandwidth.BandwidthTemplate;
57
import com.meituan.lyrebird.client.api.bandwidth.SpeedLimit;
@@ -19,10 +21,12 @@ public class LyrebirdClient {
1921
private Socket socket;
2022

2123
public LyrebirdClient(String lyrebirdRemoteAddress) {
24+
ObjectMapper mapper = new ObjectMapper();
25+
mapper.enable(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT);
2226
Retrofit retrofit = new Retrofit
2327
.Builder()
2428
.baseUrl(lyrebirdRemoteAddress)
25-
.addConverterFactory(JacksonConverterFactory.create())
29+
.addConverterFactory(JacksonConverterFactory.create(mapper))
2630
.build();
2731
lyrebirdService = retrofit.create(LyrebirdService.class);
2832
}

0 commit comments

Comments
 (0)