String name = description.type;
String namespace = description.namespace;
// IQ provider?
PacketExtensionProvider provider = (PacketExtensionProvider) ProviderManager
.getInstance().getExtensionProvider(name, namespace);
byte[] data;
try {
if (provider == null) {
/*
* We MUST reject. Else the peer will remain in a endless cycle
* in BinaryChannel.sendDirect()
*/
transferObject.reject();
return;
}
data = transferObject.accept(monitor);
} catch (SarosCancellationException e) {
log.error("User canceled. This is unexpected", e);
return;
} catch (IOException e) {
log.error("Could not deserialize incoming "
+ "transfer object or a connection error occurred", e);
return;
}
if (data == null) {
log.debug("Received empty transferobject. Discarding transferObject:"
+ transferObject.toString() + ")");
return;
}
MXParser parser = new MXParser();
PacketExtension extension = null;
try {
parser.setInput(new ByteArrayInputStream(data), "UTF-8");
/*
* We have to skip the empty start tag because Smack expects a
* parser that already has started parsing.
*/
parser.next();
extension = provider.parseExtension(parser);
} catch (XmlPullParserException e) {
log.error("Unexpected encoding error:", e);
return;
} catch (Exception e) {