1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 18:29:45 +02:00

Do not call XmlPullParser.getName() when the event is unknown

XmlPullParser.getName() only returns a result if the current parser
event is START_ELEMENT or END_ELEMENT. If this is not the case, then
the method may throw (if StAX is used).
This commit is contained in:
Florian Schmaus 2021-07-06 12:33:11 +02:00
parent 4120b42761
commit 5eef31e49c
25 changed files with 74 additions and 90 deletions

View file

@ -42,8 +42,8 @@ public class PubkeyElementProvider extends ExtensionElementProvider<PubkeyElemen
Date date = ParserUtils.getDateFromOptionalXep82String(dateString);
while (true) {
XmlPullParser.Event tag = parser.next();
String name = parser.getName();
if (tag == XmlPullParser.Event.START_ELEMENT) {
String name = parser.getName();
switch (name) {
case PubkeyElement.PubkeyDataElement.ELEMENT:
String base64EncodedOpenPgpPubKey = parser.nextText();