Skip to content

Commit 7775919

Browse files
authored
Merge pull request #59 from exceptionless/no-serializer-found-error
Disabling failure on empty beans during serialization
2 parents a8b32ab + ffaf9b4 commit 7775919

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/main/java/com/exceptionless/exceptionlessclient/utils/Utils.java

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public final class Utils {
1717
JSON_MAPPER = new ObjectMapper();
1818
JSON_MAPPER.registerModule(new JavaTimeModule());
1919
JSON_MAPPER.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
20+
JSON_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
2021
}
2122

2223
private static final Logger LOG = LoggerFactory.getLogger(Utils.class);

src/test/java/com/exceptionless/exceptionlessclient/ExceptionlessClientTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package com.exceptionless.exceptionlessclient;
22

33
import com.exceptionless.exceptionlessclient.configuration.ConfigurationManager;
4-
import com.exceptionless.exceptionlessclient.models.Event;
5-
import com.exceptionless.exceptionlessclient.models.UserDescription;
64
import com.exceptionless.exceptionlessclient.enums.EventPropertyKey;
75
import com.exceptionless.exceptionlessclient.enums.EventType;
8-
import com.exceptionless.exceptionlessclient.settings.SettingsResponse;
9-
import com.exceptionless.exceptionlessclient.submission.SubmissionResponse;
6+
import com.exceptionless.exceptionlessclient.models.Event;
7+
import com.exceptionless.exceptionlessclient.models.UserDescription;
108
import com.exceptionless.exceptionlessclient.queue.DefaultEventQueue;
119
import com.exceptionless.exceptionlessclient.settings.DefaultSettingsClient;
1210
import com.exceptionless.exceptionlessclient.settings.ServerSettings;
11+
import com.exceptionless.exceptionlessclient.settings.SettingsResponse;
1312
import com.exceptionless.exceptionlessclient.storage.InMemoryStorage;
1413
import com.exceptionless.exceptionlessclient.storage.InMemoryStorageProvider;
1514
import com.exceptionless.exceptionlessclient.submission.DefaultSubmissionClient;
15+
import com.exceptionless.exceptionlessclient.submission.SubmissionResponse;
1616
import org.junit.jupiter.api.BeforeEach;
1717
import org.junit.jupiter.api.Test;
1818
import org.junit.jupiter.api.extension.ExtendWith;

src/test/java/com/exceptionless/exceptionlessclient/utils/UtilsTest.java

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.exceptionless.exceptionlessclient.utils;
22

3+
import com.fasterxml.jackson.core.JsonProcessingException;
34
import org.junit.jupiter.api.Test;
45

56
import java.net.URI;
@@ -80,4 +81,11 @@ public void itCanMatchAValueToAPattern() {
8081
assertThat(Utils.match("abc", "def")).isFalse();
8182
assertThat(Utils.match("ABC", "abc")).isTrue();
8283
}
84+
85+
@Test
86+
public void itCanSerializeEmptyBeans() throws JsonProcessingException {
87+
class EmptyBean {}
88+
89+
assertThat(Utils.JSON_MAPPER.writeValueAsString(new EmptyBean())).isEqualTo("{}");
90+
}
8391
}

0 commit comments

Comments
 (0)