Fix NPE that prevented any package w/o license to be installed.
java.util.Properties#setProperty() doesn't like it when the value is null which was the case when a package had no license. Made sure it won't happen on other properties than the license as well. Also improved error display when an unexpected Throwable is thrown during install (Stack Call is now display if the Throwable has no message). BUG:2037085
This commit is contained in:
@@ -126,8 +126,12 @@ public class AddonPackage extends Package {
|
||||
super.saveProperties(props);
|
||||
|
||||
mVersion.saveProperties(props);
|
||||
props.setProperty(PROP_NAME, mName);
|
||||
props.setProperty(PROP_VENDOR, mVendor);
|
||||
if (mName != null) {
|
||||
props.setProperty(PROP_NAME, mName);
|
||||
}
|
||||
if (mVendor != null) {
|
||||
props.setProperty(PROP_VENDOR, mVendor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,9 +145,15 @@ public abstract class Package implements IDescription {
|
||||
*/
|
||||
void saveProperties(Properties props) {
|
||||
props.setProperty(PROP_REVISION, Integer.toString(mRevision));
|
||||
props.setProperty(PROP_LICENSE, mLicense);
|
||||
props.setProperty(PROP_DESC, mDescription);
|
||||
props.setProperty(PROP_DESC_URL, mDescUrl);
|
||||
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,7 +87,9 @@ public class PlatformPackage extends Package {
|
||||
super.saveProperties(props);
|
||||
|
||||
mVersion.saveProperties(props);
|
||||
props.setProperty(PROP_VERSION, mVersionName);
|
||||
if (mVersionName != null) {
|
||||
props.setProperty(PROP_VERSION, mVersionName);
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the version, a string, for platform packages. */
|
||||
|
||||
Reference in New Issue
Block a user