Merge change 20200 into donut
* changes: Fix NPE that prevented any package w/o license to be installed.
This commit is contained in:
@@ -126,9 +126,13 @@ public class AddonPackage extends Package {
|
||||
super.saveProperties(props);
|
||||
|
||||
mVersion.saveProperties(props);
|
||||
if (mName != null) {
|
||||
props.setProperty(PROP_NAME, mName);
|
||||
}
|
||||
if (mVendor != null) {
|
||||
props.setProperty(PROP_VENDOR, mVendor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a <libs> element.
|
||||
|
||||
@@ -145,9 +145,15 @@ public abstract class Package implements IDescription {
|
||||
*/
|
||||
void saveProperties(Properties props) {
|
||||
props.setProperty(PROP_REVISION, Integer.toString(mRevision));
|
||||
if (mLicense != null) {
|
||||
props.setProperty(PROP_LICENSE, mLicense);
|
||||
}
|
||||
if (mDescription != null) {
|
||||
props.setProperty(PROP_DESC, mDescription);
|
||||
}
|
||||
if (mDescUrl != null) {
|
||||
props.setProperty(PROP_DESC_URL, mDescUrl);
|
||||
}
|
||||
|
||||
if (mSource != null) {
|
||||
props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
|
||||
|
||||
@@ -87,8 +87,10 @@ public class PlatformPackage extends Package {
|
||||
super.saveProperties(props);
|
||||
|
||||
mVersion.saveProperties(props);
|
||||
if (mVersionName != null) {
|
||||
props.setProperty(PROP_VERSION, mVersionName);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the version, a string, for platform packages. */
|
||||
public String getVersionName() {
|
||||
|
||||
@@ -36,6 +36,8 @@ import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -304,8 +306,21 @@ class UpdaterData {
|
||||
|
||||
} catch (Throwable t) {
|
||||
// Display anything unexpected in the monitor.
|
||||
monitor.setResult("Unexpected Error: %1$s", t.getMessage());
|
||||
String msg = t.getMessage();
|
||||
if (msg != null) {
|
||||
monitor.setResult("Unexpected Error installing '%1%s: %2$s",
|
||||
archive.getParentPackage().getShortDescription(), msg);
|
||||
} else {
|
||||
// no error info? get the stack call to display it
|
||||
// At least that'll give us a better bug report.
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
t.printStackTrace(new PrintStream(baos));
|
||||
|
||||
// and display it
|
||||
monitor.setResult("Unexpected Error installing '%1$s\n%2$s",
|
||||
archive.getParentPackage().getShortDescription(),
|
||||
baos.toString());
|
||||
}
|
||||
} finally {
|
||||
|
||||
// Always move the progress bar to the desired position.
|
||||
|
||||
Reference in New Issue
Block a user