Skip to content

Commit

Permalink
adding try statement to other places in code
Browse files Browse the repository at this point in the history
  • Loading branch information
remibettan committed Feb 6, 2020
1 parent 15e49d3 commit b44a29d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ public FlashBackupTask(Device mDevice) {

@Override
protected Void doInBackground(Void... voids) {
final Updatable upd = mDevice.as(Extension.UPDATABLE);
FileUtilities.saveFileToExternalDir(mBackupFileName, upd.createFlashBackup());
return null;
try(final Updatable upd = mDevice.as(Extension.UPDATABLE)){
FileUtilities.saveFileToExternalDir(mBackupFileName, upd.createFlashBackup());
return null;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@ private void send() {
return;
}
try(Device device = devices.createDevice(0)){
DebugProtocol dp = device.as(Extension.DEBUG);
String content = mInputText.getText().toString();
String res = dp.SendAndReceiveRawData(mFilePath, content);
mOutputText.setText("command: " + mInputText.getText() + "\n\n" + res);
mInputText.setText("");
try(DebugProtocol dp = device.as(Extension.DEBUG)){
String content = mInputText.getText().toString();
String res = dp.SendAndReceiveRawData(mFilePath, content);
mOutputText.setText("command: " + mInputText.getText() + "\n\n" + res);
mInputText.setText("");
}
}
catch(Exception e){
mOutputText.setText("Error: " + e.getMessage());
Expand Down

0 comments on commit b44a29d

Please sign in to comment.