skin: exception handling
authorgiwoong.kim <giwoong.kim@samsung.com>
Tue, 6 Nov 2012 11:22:11 +0000 (20:22 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 8 Nov 2012 08:28:25 +0000 (17:28 +0900)
Open the error popup when emulator load a invalid dbi file.

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index f126fd7ad86dc462075cb4daa204817451e1d595..3c0a436dcff076e26f2f8a266e0664ffaf264f88 100644 (file)
@@ -402,6 +402,21 @@ public class EmulatorSkin {
                Rectangle lcdBounds = SkinUtil.adjustLcdGeometry(
                                lcdCanvas, currentLcdWidth, currentLcdHeight, scale, rotationId,
                                skinInfo.isPhoneShape());
+               if (lcdBounds == null) {
+                       logger.severe("Failed to lcd information for phone shape skin.");
+                       SkinUtil.openMessage(shell, null,
+                                       "Failed to read lcd information for phone shape skin.\n" +
+                                       "Check the contents of skin dbi file.",
+                                       SWT.ICON_ERROR, config);
+                       System.exit(-1);
+               }
+
+               FormData dataCanvas = new FormData();
+               dataCanvas.left = new FormAttachment(0, lcdBounds.x);
+               dataCanvas.top = new FormAttachment(0, lcdBounds.y);
+               dataCanvas.width = lcdBounds.width;
+               dataCanvas.height = lcdBounds.height;
+               lcdCanvas.setLayoutData(dataCanvas);
 
                if (skinInfo.isPhoneShape() == false) {
 //                     /* folding button */
index c5cd5630c07f51a09e48576dfcc3b6cecf00385c..b307b626aa01f68c44efbc9a7403e1a9bdbd0674 100644 (file)
@@ -133,7 +133,14 @@ public class SkinUtil {
                        RotationType rotation = SkinRotation.getRotation(rotationId);
 
                        LcdType lcd = rotation.getLcd(); /* from dbi */
+                       if (lcd == null) {
+                               return null;
+                       }
+
                        RegionType region = lcd.getRegion();
+                       if (region == null) {
+                               return null;
+                       }
 
                        Integer left = region.getLeft();
                        Integer top = region.getTop();
@@ -146,13 +153,6 @@ public class SkinUtil {
                        lcdBounds.height = (int) (height * convertedScale);
                }
 
-               FormData data = new FormData();
-               data.left = new FormAttachment(0, lcdBounds.x);
-               data.top = new FormAttachment(0, lcdBounds.y);
-               data.width = lcdBounds.width;
-               data.height = lcdBounds.height;
-               lcdCanvas.setLayoutData(data);
-
                return lcdBounds;
        }