Commit bbec5255 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Improved handling of improperly formated file transfer request.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/branches@6003 b35dd754-fafc-0310-a699-88a17e54d16e
parent 04dce48b
......@@ -81,12 +81,12 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans
}
protected static Element getChildElement(Element element, String namespace) {
List elements = element.elements();
//noinspection unchecked
List<Element> elements = element.elements();
if (elements.isEmpty()) {
return null;
}
for (int i = 0; i < elements.size(); i++) {
Element childElement = (Element) elements.get(i);
for (Element childElement : elements) {
String childNamespace = childElement.getNamespaceURI();
if (namespace.equals(childNamespace)) {
return childElement;
......@@ -139,7 +139,18 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans
return null;
}
String fileName = fileTransferElement.attributeValue("name");
long size = Long.parseLong(fileTransferElement.attributeValue("size"));
String sizeString = fileTransferElement.attributeValue("size");
if (fileName == null || sizeString == null) {
return null;
}
long size;
try {
size = Long.parseLong(sizeString);
}
catch (Exception ex) {
return null;
}
transfer = new FileTransfer(from.toString(), to.toString(),
streamID, fileName, size, mimeType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment