| | |
| | | |
| | | package com.mozillaonline.providers.downloads; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.SyncFailedException; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.util.Locale; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | |
| | | import android.content.ContentValues; |
| | | import android.content.Context; |
| | | import android.net.http.AndroidHttpClient; |
| | |
| | | import android.util.Pair; |
| | | import android.widget.Toast; |
| | | |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import org.apache.http.Header; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.SyncFailedException; |
| | | import java.net.URI; |
| | | import java.net.URISyntaxException; |
| | | import java.util.Locale; |
| | | |
| | | |
| | | /** |
| | | * Runs an actual download |
| | |
| | | if (state.mFilename != null && Downloads.isStatusError(finalStatus)) { |
| | | new File(state.mFilename).delete(); |
| | | state.mFilename = null; |
| | | MobclickAgent.reportError(mContext, "File delete status:" + finalStatus); |
| | | } |
| | | } |
| | | |
| | |
| | | } catch (FileNotFoundException ex) { |
| | | Log.w(Constants.TAG, "file " + state.mFilename + " not found: " |
| | | + ex); |
| | | MobclickAgent.reportError(mContext, ex); |
| | | } catch (SyncFailedException ex) { |
| | | Log.w(Constants.TAG, "file " + state.mFilename + " sync failed: " |
| | | + ex); |
| | | MobclickAgent.reportError(mContext, ex); |
| | | } catch (IOException ex) { |
| | | Log.w(Constants.TAG, "IOException trying to sync " |
| | | + state.mFilename + ": " + ex); |
| | | MobclickAgent.reportError(mContext, ex); |
| | | } catch (RuntimeException ex) { |
| | | Log.w(Constants.TAG, "exception while syncing file: ", ex); |
| | | MobclickAgent.reportError(mContext, ex); |
| | | } finally { |
| | | if (downloadedFileStream != null) { |
| | | try { |