diff options
author | Steve Howard <showard@google.com> | 2010-08-18 09:03:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-18 09:03:34 -0700 |
commit | baf3869b88ab4e31f792dbe08f61725bc3619ea8 (patch) | |
tree | 771d11f5758f3db00a0afd83202f477ae942fadc | |
parent | face0c02a0c47f8585fa578d5a85a8fc37322326 (diff) | |
parent | 8651bd5d1813aaef5ccfe3581cd1ab6aa693fba8 (diff) | |
download | frameworks_base-baf3869b88ab4e31f792dbe08f61725bc3619ea8.zip frameworks_base-baf3869b88ab4e31f792dbe08f61725bc3619ea8.tar.gz frameworks_base-baf3869b88ab4e31f792dbe08f61725bc3619ea8.tar.bz2 |
Merge "Fix up handling of null fields in DownloadManager." into gingerbread
-rw-r--r-- | core/java/android/net/DownloadManager.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/core/java/android/net/DownloadManager.java b/core/java/android/net/DownloadManager.java index 447e642..cafe0f9 100644 --- a/core/java/android/net/DownloadManager.java +++ b/core/java/android/net/DownloadManager.java @@ -51,14 +51,14 @@ public class DownloadManager { public final static String COLUMN_ID = "id"; /** - * The client-supplied title for this download. This will be displayed in system notifications, - * if enabled. + * The client-supplied title for this download. This will be displayed in system notifications. + * Defaults to the empty string. */ public final static String COLUMN_TITLE = "title"; /** * The client-supplied description of this download. This will be displayed in system - * notifications, if enabled. + * notifications. Defaults to the empty string. */ public final static String COLUMN_DESCRIPTION = "description"; @@ -68,22 +68,24 @@ public class DownloadManager { public final static String COLUMN_URI = "uri"; /** - * Internet Media Type of the downloaded file. This will be filled in based on the server's - * response once the download has started. + * Internet Media Type of the downloaded file. If no value is provided upon creation, this will + * initially be null and will be filled in based on the server's response once the download has + * started. * * @see <a href="http://www.ietf.org/rfc/rfc1590.txt">RFC 1590, defining Media Types</a> */ public final static String COLUMN_MEDIA_TYPE = "media_type"; /** - * Total size of the download in bytes. This will be filled in once the download starts. + * Total size of the download in bytes. This will initially be -1 and will be filled in once + * the download starts. */ public final static String COLUMN_TOTAL_SIZE_BYTES = "total_size"; /** * Uri where downloaded file will be stored. If a destination is supplied by client, that URI - * will be used here. Otherwise, the value will be filled in with a generated URI once the - * download has started. + * will be used here. Otherwise, the value will initially be null and will be filled in with a + * generated URI once the download has started. */ public final static String COLUMN_LOCAL_URI = "local_uri"; @@ -688,8 +690,13 @@ public class DownloadManager { if (column.equals(COLUMN_MEDIA_TYPE)) { return getUnderlyingString(Downloads.COLUMN_MIME_TYPE); } + assert column.equals(COLUMN_LOCAL_URI); - return Uri.fromFile(new File(getUnderlyingString(Downloads._DATA))).toString(); + String localUri = getUnderlyingString(Downloads._DATA); + if (localUri == null) { + return null; + } + return Uri.fromFile(new File(localUri)).toString(); } private long translateLong(String column) { |