am be4cbcc2: SDK Manager: fix NPE in AVD > Start when there\'s no skin name.

Merge commit 'be4cbcc2267e3778776c68785b52f871f72c67f7' into eclair

* commit 'be4cbcc2267e3778776c68785b52f871f72c67f7':
  SDK Manager: fix NPE in AVD > Start when there's no skin name.
This commit is contained in:
Raphael
2009-10-29 14:31:05 -07:00
committed by Android Git Automerger
2 changed files with 30 additions and 22 deletions

View File

@@ -1044,7 +1044,13 @@ public final class AvdManager {
} }
if (configIniFile != null) { if (configIniFile != null) {
properties = SdkManager.parsePropertyFile(configIniFile, log); if (!configIniFile.isFile()) {
if (log != null) {
log.warning("Missing file '%1$s'.", configIniFile.getPath());
}
} else {
properties = SdkManager.parsePropertyFile(configIniFile, log);
}
} }
// get name // get name

View File

@@ -120,7 +120,7 @@ final class AvdStartDialog extends GridDialog {
l.setText("Skin:"); l.setText("Skin:");
l = new Label(parent, SWT.NONE); l = new Label(parent, SWT.NONE);
l.setText(mSkinDisplay); l.setText(mSkinDisplay == null ? "None" : mSkinDisplay);
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l = new Label(parent, SWT.NONE); l = new Label(parent, SWT.NONE);
@@ -417,27 +417,29 @@ final class AvdStartDialog extends GridDialog {
Map<String, String> prop = mAvd.getProperties(); Map<String, String> prop = mAvd.getProperties();
String skinName = prop.get(AvdManager.AVD_INI_SKIN_NAME); String skinName = prop.get(AvdManager.AVD_INI_SKIN_NAME);
Matcher m = AvdManager.NUMERIC_SKIN_SIZE.matcher(skinName); if (skinName != null) {
if (m.matches()) { Matcher m = AvdManager.NUMERIC_SKIN_SIZE.matcher(skinName);
mSize1 = Integer.parseInt(m.group(1)); if (m != null && m.matches()) {
mSize2 = Integer.parseInt(m.group(2)); mSize1 = Integer.parseInt(m.group(1));
mSkinDisplay = skinName; mSize2 = Integer.parseInt(m.group(2));
mEnableScaling = true; mSkinDisplay = skinName;
} else { mEnableScaling = true;
// The resolution is inside the layout file of the skin. }
mEnableScaling = false; // default to false for now. }
// path to the skin layout file. // The resolution is inside the layout file of the skin.
File skinFolder = new File(mSdkLocation, prop.get(AvdManager.AVD_INI_SKIN_PATH)); mEnableScaling = false; // default to false for now.
if (skinFolder.isDirectory()) {
File layoutFile = new File(skinFolder, "layout"); // path to the skin layout file.
if (layoutFile.isFile()) { File skinFolder = new File(mSdkLocation, prop.get(AvdManager.AVD_INI_SKIN_PATH));
if (parseLayoutFile(layoutFile)) { if (skinFolder.isDirectory()) {
mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2); File layoutFile = new File(skinFolder, "layout");
mEnableScaling = true; if (layoutFile.isFile()) {
} else { if (parseLayoutFile(layoutFile)) {
mSkinDisplay = skinName; mSkinDisplay = String.format("%1$s (%2$dx%3$d)", skinName, mSize1, mSize2);
} mEnableScaling = true;
} else {
mSkinDisplay = skinName;
} }
} }
} }