I used File Manager to ingest a large file and then attempted to view the progress of the transfer using the 'cas-product' RSS web application (RSSProductTransferServlet ). This caused a NumberFormatException as follows:
From further testing I found that this exception occurs for files approximately 10MB in size or larger.
This exception occurs because the XmlRpcStructFactory class is attempting to set the value of a long variable using a binary representation (i.e. treating the binary number as a decimal number). The size of the binary representation exceeds the maximum capacity of the long because it is not being converted to a decimal representation.
I traced the problem to the following methods in class XmlRpcStructFactory :
In the getXmlRpcFileTransferStatus method shown above, the following line converts the value returned by 'status.getBytesTransferred()' to a binary representation and stores it as a String in the 'statusHash' Hashtable:
But when the value is retrieved from statusHash in method getFileTransferStatusFromXmlRpc, it isn't assumed to be a binary number:
For large files, the binary representation exceeds the capacity of a long. In the example above, the input string "11100111001101000000000000" converted directly to a long (i.e. treated as a decimal) will exceed the maximum size of a long (9,223,372,036,854,775,807).
A simple fix for this would be to add a radix argument to Long.parseLong in method getFileTransferStatusFromXmlRpc, as follows:
I tested this out on a large file (over 100MB) and it seemed to solve the problem. Would this be an acceptable fix? I'll attach a patch to this issue for reference.
An alternative solution would be not to store a binary representation in the statusHash Hashtable. But I'm assuming there's a reason why it's converted to binary for the hash.