Bug 888665 - Bad stored add-ons cause document generation failure in the presence of good add-ons. r=nalexander

This commit is contained in:
Richard Newman 2013-07-02 12:08:09 -07:00
Родитель 710c46301c
Коммит 1800a6e01e
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -427,7 +427,16 @@ public class HealthReportGenerator {
/**
* Compute the *tree* difference set between the two objects. If the two
* objects are identical, returns null.
* objects are identical, returns <code>null</code>. If <code>from</code> is
* <code>null</code>, returns <code>to</code>. If <code>to</code> is
* <code>null</code>, behaves as if <code>to</code> were an empty object.
*
* (Note that this method does not check for {@link JSONObject#NULL}, because
* by definition it can't be provided as input to this method.)
*
* This behavior is intended to simplify life for callers: a missing object
* can be viewed as (and behaves as) an empty map, to a useful extent, rather
* than throwing an exception.
*
* @param from
* a JSONObject.
@ -445,10 +454,14 @@ public class HealthReportGenerator {
public static JSONObject diff(JSONObject from,
JSONObject to,
boolean includeNull) throws JSONException {
if (from == null || from == JSONObject.NULL) {
if (from == null) {
return to;
}
if (to == null) {
return diff(from, new JSONObject(), includeNull);
}
JSONObject out = new JSONObject();
HashSet<String> toKeys = includeNull ? new HashSet<String>(to.length())