.append(File.separatorChar).append("logs");//$NON-NLS-1$
File logsSaveFolderPath = new File(logPath.toString());
if (!logsSaveFolderPath.exists()) {
- logsSaveFolderPath.mkdirs();
+ if (!logsSaveFolderPath.mkdirs()) {
+ // if it failed creating folder
+ return false;
+ }
}
if(manageIDELogFileCount(logsSaveFolderPath)){
List<File> listLogFile = sortIDELogFile(logFiles);
int logSize = listLogFile.size();
for (int i = IDE_LOG_SAVE_COUNT - 1; i < logSize; i++) {
- listLogFile.get(i).delete();
+ if (!listLogFile.get(i).delete()) {
+ // if it failed deleting the file, do nothing this time. it will try again later.
+ }
}
return true;
}
import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;
public class DAServerManager extends Thread {
- private final int MAXBUFSIZE = 1024;
+ private final static int MAXBUFSIZE = 1024;
private static DAServerManager instance;
File folder = new File(savePath.toString());
if (!folder.exists()) {
- folder.mkdirs();
+ if (!folder.mkdirs()) {
+ // if it failed creating folder
+ return false;
+ }
}
savePath.append(ACTIVE_DA_PLUGIN);
File file = new File(savePath.toString());
try {
fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
+ fileLock = fchannel.tryLock();
+ if (fileLock == null) {
+ isActiveDA = true;
+ }
} catch (FileNotFoundException e1) {
e1.printStackTrace();
- return false; // when creating file channel, it consider DA is not activated.
- }
- try {
- fileLock = fchannel.tryLock();
} catch (IOException e) {
e.printStackTrace();
- }
-
- if (fileLock == null) {
- isActiveDA = true;
- } else {
- isActiveDA = false;
- if (null != fchannel) {
+ } finally {
+ if (fchannel != null) {
try {
fchannel.close();
} catch (IOException e) {
.append(File.separatorChar).append(DANAIC_ANALYZER)
.append(File.separatorChar).append(SAVE);
- File logs = new File(savePath.toString());
- if (!logs.exists()) {
- logs.mkdirs();
+ File saveDir = new File(savePath.toString());
+ if (!saveDir.exists()) {
+ if (!saveDir.mkdirs()) {
+ // if it failed creating folder, Do nothing.
+ // Exception should be handled in caller.
+ }
}
savePath.append(File.separatorChar).append(CURRENT_ACTIVE_IDE_PORT);
public class TizenNativeApplicationDADelegate extends
AbstractTizenCLaunchDelegate {
- private final String TOOLS = "tools";// $NON_NLS-1$
- private final String DYNAMIC_ANALYZER = "dynamic-analyzer";// $NON_NLS-1$
- private final String PKG_TYPE = CommonProjectDependentPackager.DEFAULT;
+ private final static String TOOLS = "tools";// $NON_NLS-1$
+ private final static String DYNAMIC_ANALYZER = "dynamic-analyzer";// $NON_NLS-1$
+ private final static String PKG_TYPE = CommonProjectDependentPackager.DEFAULT;
private boolean bSuccessBuild = true;
private static class ExtFilter implements FilenameFilter {
CommonProjectDependentPackager packager = ProjectTypeManager
.getProjectPackagerInstance(project);
- RdsDeployer rdsDeployer= null;
+ RdsDeployer rdsDeployer = null;
try {
if (RdsPreferencePage.isRdsMode(project)) {
TizenLaunchCommand tizenCommand = new TizenLaunchCommand(
}
LaunchUtils.touchExecutableFile(project);
} catch (CoreException e) {
- if (rdsDeployer != null) {
- rdsDeployer.cleanDeltaInfo();
- }
DALog.dlgErrorMessage(Labels.MESSAGE_ERROR,
e.getMessage());
bSuccessBuild = false;
monitor.done();
+ } finally {
+ if (rdsDeployer != null) {
+ try {
+ rdsDeployer.close();
+ } catch (IOException e) {
+ DALog.dlgErrorMessage("Failed to close RDSDeployer",
+ e.getMessage());
+ }
+ }
}
if(monitor.isCanceled()) {
}
}
- private ILaunchConfiguration createLaunchConfiguration(IProject project)
- throws CoreException {
- IDevice device = LaunchUtils.getCurrentDeployDevice();
-
- String projectName = project.getName();
- String configName = ProjectUtil.getLaunchConfigurationName(project);
-
- ILaunchConfigurationType configType = getCLaunchConfigType();
-
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
- getLaunchManager().generateLaunchConfigurationName(configName));
-
- TizenLaunchConfiguration tc = new TizenLaunchConfiguration(wc, device);
- tc.setDefaults();
-
- String programName = ProjectUtil.getDefaultConfiguration(project)
- .getName()
- + File.separatorChar
- + ProjectUtil.getBinaryName(project);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- programName);
- wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- projectName);
- wc.setMappedResources(new IResource[] { project });
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, "");//$NON-NLS-1$
- LaunchUtils.setDeviceToLaunchConfiguration(wc, device);
-
- setStopAtMain(wc, project);
-
- ICProjectDescription projDes = CCorePlugin.getDefault()
- .getProjectDescription(project);
- if (projDes != null) {
- String buildConfigID = projDes.getActiveConfiguration().getId();
- wc.setAttribute(
- ICDTLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_ID,
- buildConfigID);
- String buildConfigName = projDes.getActiveConfiguration().getName();
- wc.setAttribute(
- TizenLaunchConfigurationConstants.ATTR_PROJECT_BUILD_CONFIG_NAME,
- buildConfigName);
- }
-
- return wc.doSave();
- }
-
private ILaunchConfiguration createLaunchConfiguration(GomLaunchData data) {
ILaunchConfiguration config = null;
IProject project = data.getProject();