Source:
public void downloadFile(Operation operation) throws AndroidAgentException { String fileName = null; validateOperation(operation); try { JSONObject inputData = new JSONObject(operation.getPayLoad().toString()); final String fileURL = inputData.getString(Constants.FileTransfer.FILE_URL); final String userName = inputData.getString(Constants.FileTransfer.USER_NAME); final String password = inputData.getString(Constants.FileTransfer.PASSWORD); final String location = inputData.getString(Constants.FileTransfer.FILE_LOCATION); String savingLocation = getSavingLocation(operation, location); if (fileURL.startsWith(Constants.FileTransfer.HTTP)) { downloadFileUsingHTTPClient(operation, fileURL, userName, password, savingLocation); } else { String[] userInfo = urlSplitter(operation, fileURL, false); String ftpUserName; if (userName.isEmpty()) { ftpUserName = userInfo[0]; } else { ftpUserName = userName; } String fileDirectory = userInfo[1]; String host = userInfo[2]; int serverPort = 0; if (userInfo[3] != null) { serverPort = Integer.parseInt(userInfo[3]); } String protocol = userInfo[4]; fileName = userInfo[5]; if (Constants.DEBUG_MODE_ENABLED) { printLogs(ftpUserName, host, fileName, fileDirectory, savingLocation, serverPort); } selectDownloadClient(protocol, operation, host, ftpUserName, password, savingLocation, fileName, serverPort, fileDirectory); } } catch (ArrayIndexOutOfBoundsException | JSONException | URISyntaxException e) { handleOperationError(operation, fileTransferExceptionCause(e, fileName), e); } finally { Log.d(TAG, operation.getStatus()); setResponse(operation); } }

Target:
public void downloadFile(Operation operation) throws AndroidAgentException { String fileName = null; validateOperation(operation); try { JSONObject inputData = new JSONObject(operation.getPayLoad().toString()); final String fileURL = inputData.getString(Constants.FileTransfer.FILE_URL); final String userName = inputData.getString(Constants.FileTransfer.USER_NAME); final String password = inputData.getString(Constants.FileTransfer.PASSWORD); final String location = inputData.getString(Constants.FileTransfer.FILE_LOCATION); String savingLocation = getSavingLocation(operation, location); if (fileURL.startsWith(Constants.FileTransfer.HTTP)) { downloadFileUsingHTTPClient(operation, fileURL, userName, password, savingLocation); } else { String[] userInfo = urlSplitter(operation, fileURL, false); String ftpUserName; if (userName.isEmpty()) { ftpUserName = userInfo[0]; } else { ftpUserName = userName; } String fileDirectory = userInfo[1]; String host = userInfo[2]; int serverPort = 0; if (userInfo[3] != null) { serverPort = Integer.parseInt(userInfo[3]); } String protocol = userInfo[4]; fileName = userInfo[5]; if (Constants.DEBUG_MODE_ENABLED) { printLogs(ftpUserName, host, fileName, fileDirectory, savingLocation, serverPort); } selectDownloadClient(protocol, operation, host, ftpUserName, password, savingLocation, fileName, serverPort, fileDirectory); } } catch (ArrayIndexOutOfBoundsException | JSONException | URISyntaxException e) { handleOperationError(operation, fileTransferExceptionCause(e, fileName), e); } finally { if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, operation.getStatus()); } setResponse(operation); } }