Commit a16cafd2 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/3_1_branch@6003 b35dd754-fafc-0310-a699-88a17e54d16e
parent 49871513
...@@ -81,12 +81,12 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans ...@@ -81,12 +81,12 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans
} }
protected static Element getChildElement(Element element, String namespace) { protected static Element getChildElement(Element element, String namespace) {
List elements = element.elements(); //noinspection unchecked
List<Element> elements = element.elements();
if (elements.isEmpty()) { if (elements.isEmpty()) {
return null; return null;
} }
for (int i = 0; i < elements.size(); i++) { for (Element childElement : elements) {
Element childElement = (Element) elements.get(i);
String childNamespace = childElement.getNamespaceURI(); String childNamespace = childElement.getNamespaceURI();
if (namespace.equals(childNamespace)) { if (namespace.equals(childNamespace)) {
return childElement; return childElement;
...@@ -139,7 +139,18 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans ...@@ -139,7 +139,18 @@ public class DefaultFileTransferManager extends BasicModule implements FileTrans
return null; return null;
} }
String fileName = fileTransferElement.attributeValue("name"); 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(), transfer = new FileTransfer(from.toString(), to.toString(),
streamID, fileName, size, mimeType); 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