mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Fix and improve the HTTP File Upload implementation
Fix a few resource leaks. Improve the API and add an integration test. Also add compability layer for XEP-0363: HTTP File Upload 0.2. SMACK-747
This commit is contained in:
parent
72d4c8b611
commit
09b6608a3a
26 changed files with 691 additions and 177 deletions
|
@ -235,4 +235,19 @@ public class ParserUtils {
|
|||
return uri;
|
||||
}
|
||||
|
||||
public static String getRequiredAttribute(XmlPullParser parser, String name) throws IOException {
|
||||
String value = parser.getAttributeValue("", name);
|
||||
if (StringUtils.isNullOrEmpty(value)) {
|
||||
throw new IOException("Attribute " + name + " is null or empty (" + value + ')');
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String getRequiredNextText(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
String text = parser.nextText();
|
||||
if (StringUtils.isNullOrEmpty(text)) {
|
||||
throw new IOException("Next text is null or empty (" + text + ')');
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue