diff options
| author | Bob Lee <crazybob@google.com> | 2009-07-10 13:34:04 -0700 |
|---|---|---|
| committer | Bob Lee <crazybob@google.com> | 2009-07-10 13:34:37 -0700 |
| commit | b8b8f044f4735b08f5a422637cfdcef43ac1a824 (patch) | |
| tree | b3af49555ad3e6d6f784abf0f12cd2f86c743fd0 /core/java/android/net | |
| parent | d1e5e3ffc22478bad8525dec4f1c6d57fe0ad368 (diff) | |
| download | frameworks_base-b8b8f044f4735b08f5a422637cfdcef43ac1a824.zip frameworks_base-b8b8f044f4735b08f5a422637cfdcef43ac1a824.tar.gz frameworks_base-b8b8f044f4735b08f5a422637cfdcef43ac1a824.tar.bz2 | |
Uri.EMPTY.toString() was returning null due to an initialization order bug. Fixes internal issue #1957015.
Diffstat (limited to 'core/java/android/net')
| -rw-r--r-- | core/java/android/net/Uri.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java index c23df21..6a755c3 100644 --- a/core/java/android/net/Uri.java +++ b/core/java/android/net/Uri.java @@ -105,6 +105,18 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { private static final String LOG = Uri.class.getSimpleName(); /** + * NOTE: EMPTY accesses this field during its own initialization, so this + * field *must* be initialized first, or else EMPTY will see a null value! + * + * Placeholder for strings which haven't been cached. This enables us + * to cache null. We intentionally create a new String instance so we can + * compare its identity and there is no chance we will confuse it with + * user data. + */ + @SuppressWarnings("RedundantStringConstructorCall") + private static final String NOT_CACHED = new String("NOT CACHED"); + + /** * The empty URI, equivalent to "". */ public static final Uri EMPTY = new HierarchicalUri(null, Part.NULL, @@ -350,15 +362,6 @@ public abstract class Uri implements Parcelable, Comparable<Uri> { private final static int NOT_CALCULATED = -2; /** - * Placeholder for strings which haven't been cached. This enables us - * to cache null. We intentionally create a new String instance so we can - * compare its identity and there is no chance we will confuse it with - * user data. - */ - @SuppressWarnings("RedundantStringConstructorCall") - private static final String NOT_CACHED = new String("NOT CACHED"); - - /** * Error message presented when a user tries to treat an opaque URI as * hierarchical. */ |
