Source:
public void uploadFile(Operation operation) throws AndroidAgentException { String fileName = "Unknown"; editor = PreferenceManager.getDefaultSharedPreferences(this).edit(); 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 fileLocation = inputData.getString(Constants.FileTransfer.FILE_LOCATION); if (fileURL.startsWith(Constants.FileTransfer.HTTP)) { uploadFileUsingHTTPClient(operation, fileURL, userName, password, fileLocation); } else { String[] userInfo = urlSplitter(operation, fileURL, true, resources); String ftpUserName; if (userName.isEmpty()) { ftpUserName = userInfo[0]; } else { ftpUserName = userName; } String uploadDirectory = userInfo[1]; String host = userInfo[2]; int serverPort = 0; if (userInfo[3] != null) { serverPort = Integer.parseInt(userInfo[3]); } String protocol = userInfo[4]; File file = new File(fileLocation); fileName = file.getName(); if (Constants.DEBUG_MODE_ENABLED) { printLogs(ftpUserName, host, fileName, file.getParent(), uploadDirectory, serverPort); } selectUploadClient(protocol, operation, host, ftpUserName, password, uploadDirectory, fileLocation, serverPort); } } catch (JSONException | URISyntaxException e) { handleOperationError(operation, fileTransferExceptionCause(e, fileName), e, resources); } finally { Log.d(TAG, operation.getStatus()); setResponse(operation); } }

Target:
public void uploadFile(Operation operation) throws AndroidAgentException { String fileName = "Unknown"; editor = PreferenceManager.getDefaultSharedPreferences(this).edit(); 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 fileLocation = inputData.getString(Constants.FileTransfer.FILE_LOCATION); if (fileURL.startsWith(Constants.FileTransfer.HTTP)) { uploadFileUsingHTTPClient(operation, fileURL, userName, password, fileLocation); } else { String[] userInfo = urlSplitter(operation, fileURL, true, resources); String ftpUserName; if (userName.isEmpty()) { ftpUserName = userInfo[0]; } else { ftpUserName = userName; } String uploadDirectory = userInfo[1]; String host = userInfo[2]; int serverPort = 0; if (userInfo[3] != null) { serverPort = Integer.parseInt(userInfo[3]); } String protocol = userInfo[4]; File file = new File(fileLocation); fileName = file.getName(); if (Constants.DEBUG_MODE_ENABLED) { printLogs(ftpUserName, host, fileName, file.getParent(), uploadDirectory, serverPort); } selectUploadClient(protocol, operation, host, ftpUserName, password, uploadDirectory, fileLocation, serverPort); } } catch (JSONException | URISyntaxException e) { handleOperationError(operation, fileTransferExceptionCause(e, fileName), e, resources); } finally { if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, operation.getStatus()); } setResponse(operation); } }