[Title] add checking duplicate name..
authorjihye kim <jihye1128.kim@samsung.com>
Mon, 13 Aug 2012 06:35:44 +0000 (15:35 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Mon, 13 Aug 2012 06:35:44 +0000 (15:35 +0900)
[Type] work
[Module] emulator-manager
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

package/pkginfo.manifest
src/org/tizen/emulator/manager/console/ActionList.java
src/org/tizen/emulator/manager/image/BaseImage.java
src/org/tizen/emulator/manager/image/Platform.java

index 1f7ab37..7a345c4 100644 (file)
@@ -1,5 +1,5 @@
 Source: emulator-manager
-Version: 1.3.16
+Version: 1.3.17
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 
 Package: emulator-manager
index 1f79436..8b313a3 100644 (file)
@@ -323,7 +323,7 @@ class Create extends Action {
                // b : standard image
                // p : custom image
                commandList.add(new Command("b", Actions.OP_BASE,
-                               "Select ID of base disk image. (Currently, only 1 is avaliable)",
+                               "Select ID of base disk image.\n\t\t(Avaliable disk image can be found using 'list-image' command)",
                                "1", false, true));
                commandList.add(new Command("p", Actions.OP_PATH,
                                "Select path of base target image.", "", false, true));
index d2eef8e..0a83a3a 100644 (file)
@@ -73,7 +73,7 @@ public class BaseImage {
                        prop.load(new FileInputStream(f));
                        platformName = prop.getProperty(StringResource.IMAGE_PLATFORM, platform.getVersion());
                        type             = prop.getProperty(StringResource.IMAGE_TYPE, "default");
-                       name             = prop.getProperty(StringResource.IMAGE_NAME);
+                       name             = prop.getProperty(StringResource.IMAGE_NAME).toLowerCase();
                        if (name == null) {
                                throw new Exception();
                        }
index ab7f186..7281f0b 100644 (file)
@@ -152,25 +152,46 @@ public class Platform {
                File defaultImages = new File(platform_path + FilePath.getInstance().getDefaultImagePath());
                File addonsImages  = new File(platform_path + FilePath.getInstance().getAddonsImagePath());
 
+               //boolean isDuplicate = false;
                if(defaultImages.exists() && defaultImages.isDirectory()) {
+                       BaseImage image;
                        for (File f : defaultImages.listFiles()) {
                                if (f.isDirectory()) {
                                        try {
-                                               imageList.add(new BaseImage(this, f, ++id));
+                                               image = new BaseImage(this, f, ++id);
+                                               for (BaseImage i : imageList) {
+                                                       if (i.getName().equals(image.getName())){
+                                                               // TODO: duplicate name...
+                                                               EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )");
+                                                               --id;
+                                                               throw new Exception();
+                                                       }
+                                               }
+                                               imageList.add(image);
                                        } catch (Exception e) {
-                                               EMLogger.getLogger().warning("Failed adding base image..\n" + f.getAbsolutePath());
+                                               EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath());
                                        }
                                }
                        }
                }
 
                if (addonsImages.exists() && addonsImages.isDirectory()) {
+                       BaseImage image;
                        for (File f : addonsImages.listFiles()) {
                                if (f.isDirectory()) {
                                        try {
-                                               imageList.add(new BaseImage(this, f, ++id));
+                                               image = new BaseImage(this, f, ++id);
+                                               for (BaseImage i : imageList) {
+                                                       if (i.getName().equals(image.getName())){
+                                                               // TODO: duplicate name...
+                                                               EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )");
+                                                               --id;
+                                                               throw new Exception();
+                                                       }
+                                               }
+                                               imageList.add(image);
                                        } catch (Exception e) {
-                                               EMLogger.getLogger().warning("Failed adding base image..\n" + f.getAbsolutePath());
+                                               EMLogger.getLogger().warning("Failed adding base image..\n" + "Base Disk Image Path: " + f.getAbsolutePath());
                                        }
                                }
                        }