Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 805b263

Browse files
committed
Prevent NPE if super msg is null.
Fixes #476
1 parent db6b3fe commit 805b263

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22
- [FIXED] Create an array of strings for QueryBuilder.fields() when a single field is provided.
3+
- [FIXED] Potential NPE creating exception messages.
34
- [IMPROVED] Return exceptions directly from IAM token request failures instead of logging and
45
deferring the request to the service with no credentials. The exception type is the same, but
56
the message and cause are more clear and a round trip is avoided.

cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public String getReason() {
7777
public String getMessage() {
7878
String msg = super.getMessage();
7979
// trim trailing full stop
80-
msg = (msg.endsWith(".")) ? msg.substring(0, msg.length() - 1) : msg;
80+
msg = (msg != null && msg.endsWith(".")) ? msg.substring(0, msg.length() - 1) : msg;
8181

8282
// include the status code, URL, error and reason (if available)
8383
return ((getStatusCode() > 0) ? getStatusCode() + " " : "") + msg

0 commit comments

Comments
 (0)