diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
index 3913fe374..54d40a47a 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java
@@ -39,14 +39,14 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
*
conflict | CANCEL | 8.3.3.2 |
* feature-not-implemented | CANCEL | 8.3.3.3 |
* forbidden | AUTH | 8.3.3.4 |
- * gone | MODIFY | 8.3.3.5 |
+ * gone | CANCEL | 8.3.3.5 |
* internal-server-error | WAIT | 8.3.3.6 |
* item-not-found | CANCEL | 8.3.3.7 |
* jid-malformed | MODIFY | 8.3.3.8 |
- * not-acceptable | MODIFY | 8.3.3.9 |
+ * not-acceptable | MODIFY | 8.3.3.9 |
* not-allowed | CANCEL | 8.3.3.10 |
* not-authorized | AUTH | 8.3.3.11 |
- * policy-violation | AUTH | 8.3.3.12 |
+ * policy-violation | MODIFY | 8.3.3.12 |
* recipient-unavailable | WAIT | 8.3.3.13 |
* redirect | MODIFY | 8.3.3.14 |
* registration-required | AUTH | 8.3.3.15 |
@@ -55,7 +55,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
* resource-constraint | WAIT | 8.3.3.18 |
* service-unavailable | CANCEL | 8.3.3.19 |
* subscription-required | AUTH | 8.3.3.20 |
- * undefined-condition | WAIT | 8.3.3.21 |
+ * undefined-condition | MODIFY | 8.3.3.21 |
* unexpected-request | WAIT | 8.3.3.22 |
*
*
@@ -70,7 +70,7 @@ public class XMPPError extends AbstractError {
public static final String ERROR = "error";
private static final Logger LOGGER = Logger.getLogger(XMPPError.class.getName());
- private static final Map CONDITION_TO_TYPE = new HashMap();
+ static final Map CONDITION_TO_TYPE = new HashMap();
static {
CONDITION_TO_TYPE.put(Condition.bad_request, Type.MODIFY);
@@ -91,9 +91,10 @@ public class XMPPError extends AbstractError {
CONDITION_TO_TYPE.put(Condition.remote_server_not_found, Type.CANCEL);
CONDITION_TO_TYPE.put(Condition.remote_server_timeout, Type.WAIT);
CONDITION_TO_TYPE.put(Condition.resource_constraint, Type.WAIT);
- CONDITION_TO_TYPE.put(Condition.service_unavailable, Type.WAIT);
- CONDITION_TO_TYPE.put(Condition.subscription_required, Type.WAIT);
- CONDITION_TO_TYPE.put(Condition.unexpected_request, Type.MODIFY);
+ CONDITION_TO_TYPE.put(Condition.service_unavailable, Type.CANCEL);
+ CONDITION_TO_TYPE.put(Condition.subscription_required, Type.AUTH);
+ CONDITION_TO_TYPE.put(Condition.undefined_condition, Type.MODIFY);
+ CONDITION_TO_TYPE.put(Condition.unexpected_request, Type.WAIT);
}
private final Condition condition;
diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java
new file mode 100644
index 000000000..f2e84a3f7
--- /dev/null
+++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/XMPPErrorTest.java
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright © 2017 Ingo Bauersachs
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jivesoftware.smack.packet;
+
+import static org.jivesoftware.smack.packet.XMPPError.Condition;
+import static org.jivesoftware.smack.packet.XMPPError.Type;
+import static org.junit.Assert.assertEquals;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+public class XMPPErrorTest {
+ @Test
+ public void testConditionHasDefaultTypeMapping() throws NoSuchFieldException, IllegalAccessException {
+ Map conditionToTypeMap = XMPPError.CONDITION_TO_TYPE;
+ assertEquals("CONDITION_TO_TYPE map is likely out of sync with Condition enum",
+ Condition.values().length,
+ conditionToTypeMap.size());
+ }
+}