1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 16:22:06 +01:00

Protect against bad xmpp error types.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5458 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Matt Tucker 2006-09-20 16:43:40 +00:00 committed by matt
parent 49a07980de
commit 48fac74878

View file

@ -35,8 +35,8 @@ import java.util.Map;
/**
* Utility class that helps to parse packets. Any parsing packets method that must be shared
* between many clients must be placed in this utility class.
*
* between many clients must be placed in this utility class.
*
* @author Gaston Dombiak
*/
public class PacketParserUtils {
@ -337,8 +337,16 @@ public class PacketParserUtils {
}
}
}
return new XMPPError(Integer.parseInt(errorCode), XMPPError.Type
.valueOf(type.toUpperCase()), condition, message, extensions);
// Parse the error type.
XMPPError.Type errorType = XMPPError.Type.CANCEL;
try {
errorType = XMPPError.Type.valueOf(type.toUpperCase());
}
catch (IllegalArgumentException iae) {
// Print stack trace. We shouldn't be getting an illegal error type.
iae.printStackTrace();
}
return new XMPPError(Integer.parseInt(errorCode), errorType, condition, message, extensions);
}
/**