COMMON: fixed to get a invalid platform version 08/12708/1
authorGun Kim <gune.kim@samsung.com>
Thu, 21 Nov 2013 10:44:10 +0000 (19:44 +0900)
committerGun Kim <gune.kim@samsung.com>
Thu, 21 Nov 2013 10:52:50 +0000 (19:52 +0900)
Sometimes the SDB send invalid platform information to IDE.
In this case, ODI logic generates a exception. So, the IDE can't execute Connection Explorer.
This commit improves to check whether the platform information is valid or not.

Change-Id: I338a142e7d4fc804ff73cbe76a61affe574ddeeb
Signed-off-by: Gun Kim <gune.kim@samsung.com>
org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java
org.tizen.common/src/org/tizen/common/core/application/ProfileInfo.java

index 7fb1b04..216c1b6 100755 (executable)
@@ -76,10 +76,10 @@ final public class InstallPathConfig {
     private static final String DIR_CHECKER = "checker";
     private static final String DIR_DOCUMENTS = "documents";
     // PLATFORM directory format: <platform>-<majorNumber>.<minorNumber>
-    private static final String REG_PROFILE = "[a-zA-Z\\-]+";
-    private static final String REG_VERSION = "(((\\d)|([1-9]\\d{2,}))\\.)((\\d)|([1-9]\\d{2,}))";
-    private static final String PLATFORM_SEPARATOR = "-";
-    private static final String REG_DIR_PLATFORM = REG_PROFILE + PLATFORM_SEPARATOR + REG_VERSION;
+    public static final String REG_PROFILE = "[a-zA-Z\\-]+";
+    public static final String REG_VERSION = "(((\\d)|([1-9]\\d{2,}))\\.)((\\d)|([1-9]\\d{2,}))";
+    public static final String PLATFORM_SEPARATOR = "-";
+    public static final String REG_DIR_PLATFORM = REG_PROFILE + PLATFORM_SEPARATOR + REG_VERSION;
     public static final String FORMAT_PLATFORM_NAME = "%s-%s";
 
     private final static String SDKSUFFIX = DIR_SDK_DATA + File.separatorChar + "tizensdkpath";
index ad6f51c..e2caa84 100644 (file)
@@ -170,6 +170,10 @@ public class ProfileInfo {
             String path = null;
 
             String version = major + "." + minor;
+            if ( !version.matches(InstallPathConfig.REG_VERSION) ) {
+                throw new Exception("Failed to get a device's profile version");
+            }
+            
             String profile = platformInfo.getProfileName().split("-")[0];
 
             ProfileInfo profileInfo = InstallPathConfig.getProfileInfo(profile);