mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 18:48:00 +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:
parent
49a07980de
commit
48fac74878
1 changed files with 12 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue