public static String[] runCommandReturningResult(String command) {
IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
CommonReceiver commonReceiver = new CommonReceiver();
-
+ String[] result = null;
try {
device.executeShellCommand(command, commonReceiver);
+ result = commonReceiver.getOutput();
+ commonReceiver.close();
} catch (TimeoutException e) {
e.printStackTrace();
} catch (SdbCommandRejectedException e) {
} catch (IOException e) {
e.printStackTrace();
}
- return commonReceiver.getOutput();
+ return result;
}
public static String[] runHostCommandReturningResult(String command) {
finally
{
tryClose( fileOut );
+ syncService.close();
}
}
SAXException {
ValgrindXMLParser parser;
+ FileInputStream in = null;
try {
- FileInputStream in = new FileInputStream(hostlog);
+ in = new FileInputStream(hostlog);
parser = new ValgrindXMLParser(in);
errors = parser.getErrors();
if (memcheckPart instanceof MemcheckViewPart) {
((MemcheckViewPart) memcheckPart).setErrors(errors.toArray(new ValgrindError[errors.size()]));
}
-
- in.close();
} catch (Exception e) {
e.printStackTrace();
+ } finally {
+ in.close();
}
}
private void loadData() throws FileNotFoundException, ParserConfigurationException, IOException, CoreException, SAXException {
ArrayList<ValgrindError> errorList = new ArrayList<ValgrindError>();
ValgrindXMLParser parser;
+ FileInputStream in = null;
try {
- FileInputStream in = new FileInputStream(this.filePath);
+ in = new FileInputStream(this.filePath);
parser = new ValgrindXMLParser(in);
errorList.addAll(parser.getErrors());
errors = errorList.toArray(new ValgrindError[errorList.size()]);
-
- in.close();
} catch (Exception e) {
e.printStackTrace();
+ } finally {
+ in.close();
}
}
}
// SyncResult result = syncService.doPush( fileIn, device.getFileEntry( dest ), null, -1 );
SyncResult result = syncService.push(src, device.getFileEntry(dest));
+ syncService.close();
return result.isOk();
// }
// catch ( final FileNotFoundException e )