Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 01a214a

Browse files
committed
Better logging in case MPS response codes does not match.
1 parent 3eabdbe commit 01a214a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<dependency>
124124
<groupId>org.slf4j</groupId>
125125
<artifactId>slf4j-api</artifactId>
126-
<version>1.6.1</version>
126+
<version>1.7.7</version>
127127
</dependency>
128128

129129
<dependency>

src/main/java/com/notnoop/mpns/internal/Utilities.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.apache.http.Header;
4141
import org.apache.http.HttpResponse;
4242
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
43+
import org.slf4j.LoggerFactory;
4344

4445
public final class Utilities {
4546
private Utilities() { throw new AssertionError("Uninstantiable class"); }
@@ -49,6 +50,8 @@ public final class Utilities {
4950
*/
5051
public static String XML_CONTENT_TYPE = "text/xml";
5152

53+
private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(Utilities.class);
54+
5255
public static ThreadSafeClientConnManager poolManager(int maxConnections) {
5356
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
5457
cm.setMaxTotal(maxConnections);
@@ -158,8 +161,13 @@ public static MpnsResponse logicalResponseFor(HttpResponse response) {
158161
}
159162

160163
// Didn't find anything
161-
assert false;
162-
return null;
164+
LOG.error(
165+
"Unmatched error code - Notification status: [{}], Connection status: [{}], Subscription status: [{}], Status code: [{}]",
166+
notificationStatus,
167+
deviceConnectionStatus,
168+
subscriptionStatus,
169+
statusCode);
170+
return MpnsResponse.UNDEFINED;
163171
}
164172

165173
public static void fireDelegate(MpnsNotification message, HttpResponse response, MpnsDelegate delegate) {

0 commit comments

Comments
 (0)