Source: emulator-manager
-Version: 1.3.25
+Version: 1.3.26
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Package: emulator-manager
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.util.Properties;
+import java.util.logging.Level;
+import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.tool.StringResource;
public class BaseImage {
private void loadProperty(int id, File path) throws Exception {
this.id = Integer.toString(id);
File f = new File(path + File.separator + StringResource.IMAGE_INFO_FILENAME);
- if (f.exists()) {
- FileInputStream inputStream = new FileInputStream(f);
- Properties prop = new Properties();
- prop.load(inputStream);
- platformName = prop.getProperty(StringResource.IMAGE_PLATFORM, platform.getVersion());
- type = prop.getProperty(StringResource.IMAGE_TYPE, "default");
- name = prop.getProperty(StringResource.IMAGE_NAME).toLowerCase();
- if (name == null) {
- throw new Exception();
+ FileInputStream inputStream = null;
+ try {
+ if (f.exists()) {
+ inputStream = new FileInputStream(f);
+ Properties prop = new Properties();
+ prop.load(inputStream);
+ platformName = prop.getProperty(StringResource.IMAGE_PLATFORM, platform.getVersion());
+ type = prop.getProperty(StringResource.IMAGE_TYPE, "default");
+ name = prop.getProperty(StringResource.IMAGE_NAME).toLowerCase();
+ if (name == null) {
+ throw new Exception();
+ }
+ version = prop.getProperty(StringResource.IMAGE_VERSION, platform.getVersion());
+ domain = prop.getProperty(StringResource.PRODUCT_DOMAIN, "Phone");
+ cpu = prop.getProperty(StringResource.TARGET_CPU, "x86");
+ cpu = cpu.toLowerCase();
+ release = prop.getProperty(StringResource.RELEASE_VERSION, "Not identified");
+ } else {
+ throw new Exception("This file does not exist (" + path + ")");
}
- version = prop.getProperty(StringResource.IMAGE_VERSION, platform.getVersion());
- domain = prop.getProperty(StringResource.PRODUCT_DOMAIN, "Phone");
- cpu = prop.getProperty(StringResource.TARGET_CPU, "x86");
- cpu = cpu.toLowerCase();
- release = prop.getProperty(StringResource.RELEASE_VERSION, "Not identified");
-
+ } finally {
// clear
- inputStream.close();
- } else {
- throw new Exception("This file does not exist (" + path + ")");
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ EMLogger.getLogger().log(Level.WARNING, e.getMessage());
+ }
+ }
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.image;
import java.io.File;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.tool;
import java.io.File;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.tool;
import java.io.File;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.ui.detail;
import java.io.File;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.ui.detail;
public interface TableWidgetChangeListener {
import java.io.BufferedReader;
import java.io.File;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
int isLinux = System.getProperty("os.name").toLowerCase().indexOf("linux");
int isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows");
int isMac = System.getProperty("os.name").toLowerCase().indexOf("mac");
- try {
- String line;
- List<String> cmd = new ArrayList<String>();
- if(isLinux > -1) {
- cmd.add("/bin/ps");
- cmd.add("-ef");
- }
- else if(isWindows > -1) {
- cmd.add("tasklist");
- cmd.add("/V");
- cmd.add("/FI");
- cmd.add("\"IMAGENAME eq java.exe\"");
- cmd.add("/FO");
- cmd.add("CSV");
- }
- else if (isMac > -1){
- cmd.add("/bin/ps");
- cmd.add("-ef");
- }
+ String line;
+ List<String> cmd = new ArrayList<String>();
+ if(isLinux > -1) {
+ cmd.add("/bin/ps");
+ cmd.add("-ef");
+ }
+ else if(isWindows > -1) {
+ cmd.add("tasklist");
+ cmd.add("/V");
+ cmd.add("/FI");
+ cmd.add("\"IMAGENAME eq java.exe\"");
+ cmd.add("/FO");
+ cmd.add("CSV");
+ }
+ else if (isMac > -1){
+ cmd.add("/bin/ps");
+ cmd.add("-ef");
+ }
- ProcessBuilder pb = new ProcessBuilder(cmd);
- Process p = pb.start();
- InputStreamReader inputReader = new InputStreamReader(p.getInputStream());
- BufferedReader stdOut = new BufferedReader(inputReader);
+ ProcessBuilder pb = null;
+ Process p = null;
+ InputStreamReader inputReader = null;
+ BufferedReader stdOut = null;
+ try {
+ pb = new ProcessBuilder(cmd);
+ p = pb.start();
+ inputReader = new InputStreamReader(p.getInputStream());
+ stdOut = new BufferedReader(inputReader);
if(isLinux > -1) {
while ((line = stdOut.readLine()) != null) {
String imagePath = property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue();
}
}
- // clear;
- stdOut.close();
- inputReader.close();
if (!result) {
logger.log(Level.INFO, "The same name of VM not exist anywhere. You can continue your job.\n");
}
msg.openWarningDialog("Error occured while checking if the same VM .\n" +
err.getMessage());
return false;
+ } finally {
+ // clear;
+ if (stdOut != null) {
+ try {
+ stdOut.close();
+ } catch (IOException e) {
+ logger.log(Level.WARNING, e.getMessage());
+ }
+ }
+ if (inputReader != null) {
+ try {
+ inputReader.close();
+ } catch (IOException e) {
+ logger.log(Level.WARNING, e.getMessage());
+ }
+ }
}
}
}