Fix to transfer status since the "error" JSON property is optional.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22463 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-09-13 14:54:08 +00:00
parent 37a10a7816
commit e095ff3744

View File

@@ -546,15 +546,20 @@ public class HttpClientTransmitterImpl implements TransferTransmitter
int currentPosition = statusObj.getInt("currentPosition");
int endPosition = statusObj.getInt("endPosition");
String statusStr= statusObj.getString("status");
JSONObject errorJSON = statusObj.getJSONObject("error");
Throwable throwable = rehydrateError(errorJSON);
TransferProgress p = new TransferProgress();
if(statusObj.has("error"))
{
JSONObject errorJSON = statusObj.getJSONObject("error");
Throwable throwable = rehydrateError(errorJSON);
p.setError(throwable);
}
p.setStatus(TransferProgress.Status.valueOf(statusStr));
p.setCurrentPosition(currentPosition);
p.setEndPosition(endPosition);
p.setError(throwable);
return p;
}
catch (RuntimeException e)