*
* @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
* com.thoughtworks.xstream.converters.UnmarshallingContext)
*/
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
HTTPSampleResult res = (HTTPSampleResult) createCollection(context.getRequiredType());
retrieveAttributes(reader, context, res);
while (reader.hasMoreChildren()) {
reader.moveDown();
Object subItem = readItem(reader, context, res);
if (!retrieveItem(reader, context, res, subItem)) {
retrieveHTTPItem(reader, context, res, subItem);
}
reader.moveUp();
}
// If we have a file, but no data, then read the file
String resultFileName = res.getResultFileName();
if (resultFileName.length()>0
&& res.getResponseData().length == 0) {
readFile(resultFileName,res);
}
return res;
}