Merge change 20200 into donut
* changes: Fix NPE that prevented any package w/o license to be installed.
This commit is contained in:
@@ -126,8 +126,12 @@ public class AddonPackage extends Package {
|
|||||||
super.saveProperties(props);
|
super.saveProperties(props);
|
||||||
|
|
||||||
mVersion.saveProperties(props);
|
mVersion.saveProperties(props);
|
||||||
props.setProperty(PROP_NAME, mName);
|
if (mName != null) {
|
||||||
props.setProperty(PROP_VENDOR, mVendor);
|
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) {
|
void saveProperties(Properties props) {
|
||||||
props.setProperty(PROP_REVISION, Integer.toString(mRevision));
|
props.setProperty(PROP_REVISION, Integer.toString(mRevision));
|
||||||
props.setProperty(PROP_LICENSE, mLicense);
|
if (mLicense != null) {
|
||||||
props.setProperty(PROP_DESC, mDescription);
|
props.setProperty(PROP_LICENSE, mLicense);
|
||||||
props.setProperty(PROP_DESC_URL, mDescUrl);
|
}
|
||||||
|
if (mDescription != null) {
|
||||||
|
props.setProperty(PROP_DESC, mDescription);
|
||||||
|
}
|
||||||
|
if (mDescUrl != null) {
|
||||||
|
props.setProperty(PROP_DESC_URL, mDescUrl);
|
||||||
|
}
|
||||||
|
|
||||||
if (mSource != null) {
|
if (mSource != null) {
|
||||||
props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
|
props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ public class PlatformPackage extends Package {
|
|||||||
super.saveProperties(props);
|
super.saveProperties(props);
|
||||||
|
|
||||||
mVersion.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. */
|
/** Returns the version, a string, for platform packages. */
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ import com.android.sdkuilib.repository.UpdaterWindow.ISdkListener;
|
|||||||
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -304,8 +306,21 @@ class UpdaterData {
|
|||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// Display anything unexpected in the monitor.
|
// 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 {
|
} finally {
|
||||||
|
|
||||||
// Always move the progress bar to the desired position.
|
// Always move the progress bar to the desired position.
|
||||||
|
|||||||
Reference in New Issue
Block a user