Java 类android.database.sqlite.SQLiteFullException 实例源码

项目:GitHub    文件:DownloadStatusCallback.java   
private void handleError(Exception exception) {
    Exception errProcessEx = exFiltrate(exception);

    if (errProcessEx instanceof SQLiteFullException) {
        // If the error is sqLite full exception already, no need to  update it to the database
        // again.
        handleSQLiteFullException((SQLiteFullException) errProcessEx);
    } else {
        // Normal case.
        try {

            model.setStatus(FileDownloadStatus.error);
            model.setErrMsg(exception.toString());

            database.updateError(model.getId(), errProcessEx, model.getSoFar());
        } catch (SQLiteFullException fullException) {
            errProcessEx = fullException;
            handleSQLiteFullException((SQLiteFullException) errProcessEx);
        }
    }

    processParams.setException(errProcessEx);
    onStatusChanged(FileDownloadStatus.error);
}
项目:YuiHatano    文件:ShadowDatabaseUtils.java   
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
    switch (code) {
        case 2:
            throw new IllegalArgumentException(msg);
        case 3:
            throw new UnsupportedOperationException(msg);
        case 4:
            throw new SQLiteAbortException(msg);
        case 5:
            throw new SQLiteConstraintException(msg);
        case 6:
            throw new SQLiteDatabaseCorruptException(msg);
        case 7:
            throw new SQLiteFullException(msg);
        case 8:
            throw new SQLiteDiskIOException(msg);
        case 9:
            throw new SQLiteException(msg);
        case 11:
            throw new OperationCanceledException(msg);
        default:
            reply.readException(code, msg);
    }
}
项目:FileDownloader-master    文件:DownloadStatusCallback.java   
private void handleError(Exception exception) {
    Exception errProcessEx = exFiltrate(exception);

    if (errProcessEx instanceof SQLiteFullException) {
        // If the error is sqLite full exception already, no need to  update it to the database
        // again.
        handleSQLiteFullException((SQLiteFullException) errProcessEx);
    } else {
        // Normal case.
        try {

            model.setStatus(FileDownloadStatus.error);
            model.setErrMsg(exception.toString());

            database.updateError(model.getId(), errProcessEx, model.getSoFar());
        } catch (SQLiteFullException fullException) {
            errProcessEx = fullException;
            handleSQLiteFullException((SQLiteFullException) errProcessEx);
        }
    }

    processParams.setException(errProcessEx);
    onStatusChanged(FileDownloadStatus.error);
}
项目:KBUnitTest    文件:ShadowDatabaseUtils.java   
private static final void readExceptionFromParcel(Parcel reply, String msg, int code) {
    switch (code) {
        case 2:
            throw new IllegalArgumentException(msg);
        case 3:
            throw new UnsupportedOperationException(msg);
        case 4:
            throw new SQLiteAbortException(msg);
        case 5:
            throw new SQLiteConstraintException(msg);
        case 6:
            throw new SQLiteDatabaseCorruptException(msg);
        case 7:
            throw new SQLiteFullException(msg);
        case 8:
            throw new SQLiteDiskIOException(msg);
        case 9:
            throw new SQLiteException(msg);
        case 11:
            throw new OperationCanceledException(msg);
        default:
            reply.readException(code, msg);
    }
}
项目:RLibrary    文件:DownloadStatusCallback.java   
private void handleError(Exception exception) {
    Exception errProcessEx = exFiltrate(exception);

    if (errProcessEx instanceof SQLiteFullException) {
        // If the error is sqLite full exception already, no need to  update it to the database
        // again.
        handleSQLiteFullException((SQLiteFullException) errProcessEx);
    } else {
        // Normal case.
        try {

            model.setStatus(FileDownloadStatus.error);
            model.setErrMsg(exception.toString());

            database.updateError(model.getId(), errProcessEx, model.getSoFar());
        } catch (SQLiteFullException fullException) {
            errProcessEx = fullException;
            handleSQLiteFullException((SQLiteFullException) errProcessEx);
        }
    }

    processParams.setException(errProcessEx);
    onStatusChanged(FileDownloadStatus.error);
}
项目:FileDownloader    文件:DownloadStatusCallback.java   
private void handleError(Exception exception) {
    Exception errProcessEx = exFiltrate(exception);

    if (errProcessEx instanceof SQLiteFullException) {
        // If the error is sqLite full exception already, no need to  update it to the database
        // again.
        handleSQLiteFullException((SQLiteFullException) errProcessEx);
    } else {
        // Normal case.
        try {

            model.setStatus(FileDownloadStatus.error);
            model.setErrMsg(exception.toString());

            database.updateError(model.getId(), errProcessEx, model.getSoFar());
        } catch (SQLiteFullException fullException) {
            errProcessEx = fullException;
            handleSQLiteFullException((SQLiteFullException) errProcessEx);
        }
    }

    processParams.setException(errProcessEx);
    onStatusChanged(FileDownloadStatus.error);
}
项目:android_maplib    文件:VectorLayer.java   
@Override
public boolean delete()
        throws SQLiteException
{
    try {
        //drop table
        MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
        SQLiteDatabase db = map.getDatabase(false);
        String tableDrop = "DROP TABLE IF EXISTS " + mPath.getName();
        db.execSQL(tableDrop);
    } catch (SQLiteFullException e) {
        e.printStackTrace();
    }

    return super.delete();
}
项目:GitHub    文件:DownloadStatusCallback.java   
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
    final int id = model.getId();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite " +
                        "full exception[%s], so remove it from the database directly.",
                id, sqLiteFullException.toString());
    }

    model.setErrMsg(sqLiteFullException.toString());
    model.setStatus(FileDownloadStatus.error);

    database.remove(id);
    database.removeConnections(id);
}
项目:weex-3d-map    文件:DefaultWXStorage.java   
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    SQLiteDatabase database = mDatabaseSupplier.getDatabase();
    if (database == null) {
        return false;
    }

    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = null;
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement = database.compileStatement(sql);
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if (e instanceof SQLiteFullException) {
            if (allowRetryWhenFull && trimToSize()) {
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
                return performSetItem(key, value, isPersistent, false);
            }
        }

        return false;
    } finally {
        if(statement != null) {
            statement.close();
        }
    }
}
项目:ucar-weex-core    文件:DefaultWXStorage.java   
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    SQLiteDatabase database = mDatabaseSupplier.getDatabase();
    if (database == null) {
        return false;
    }

    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = null;
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement = database.compileStatement(sql);
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if (e instanceof SQLiteFullException) {
            if (allowRetryWhenFull && trimToSize()) {
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
                return performSetItem(key, value, isPersistent, false);
            }
        }

        return false;
    } finally {
        if(statement != null) {
            statement.close();
        }
    }
}
项目:PaoMovie    文件:Logger.java   
/**
 * 数据库文件已达到最大空间(数据库已满)
 * 
 * @param e
 */
public static void printStackTrace(String TAG, SQLiteFullException e) {
    if (IsDebug) {
        e.printStackTrace();
    } else {
        logException(TAG, e);
    }
}
项目:YuiHatano    文件:ShadowDatabaseUtils.java   
/**
 * Special function for writing an exception result at the header of
 * a parcel, to be used when returning an exception from a transaction.
 * exception will be re-thrown by the function in another process
 *
 * @param reply Parcel to write to
 * @param e     The Exception to be written.
 * @see Parcel#writeNoException
 * @see Parcel#writeException
 */
public static final void writeExceptionToParcel(Parcel reply, Exception e) {
    int     code         = 0;
    boolean logException = true;
    if (e instanceof FileNotFoundException) {
        code = 1;
        logException = false;
    } else if (e instanceof IllegalArgumentException) {
        code = 2;
    } else if (e instanceof UnsupportedOperationException) {
        code = 3;
    } else if (e instanceof SQLiteAbortException) {
        code = 4;
    } else if (e instanceof SQLiteConstraintException) {
        code = 5;
    } else if (e instanceof SQLiteDatabaseCorruptException) {
        code = 6;
    } else if (e instanceof SQLiteFullException) {
        code = 7;
    } else if (e instanceof SQLiteDiskIOException) {
        code = 8;
    } else if (e instanceof SQLiteException) {
        code = 9;
    } else if (e instanceof OperationApplicationException) {
        code = 10;
    } else if (e instanceof OperationCanceledException) {
        code = 11;
        logException = false;
    } else {
        reply.writeException(e);
        Log.e(TAG, "Writing exception to parcel", e);
        return;
    }
    reply.writeInt(code);
    reply.writeString(e.getMessage());

    if (logException) {
        Log.e(TAG, "Writing exception to parcel", e);
    }
}
项目:FileDownloader-master    文件:DownloadStatusCallback.java   
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
    final int id = model.getId();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite " +
                        "full exception[%s], so remove it from the database directly.",
                id, sqLiteFullException.toString());
    }

    model.setErrMsg(sqLiteFullException.toString());
    model.setStatus(FileDownloadStatus.error);

    database.remove(id);
    database.removeConnections(id);
}
项目:KBUnitTest    文件:ShadowDatabaseUtils.java   
/**
 * Special function for writing an exception result at the header of
 * a parcel, to be used when returning an exception from a transaction.
 * exception will be re-thrown by the function in another process
 *
 * @param reply Parcel to write to
 * @param e     The Exception to be written.
 * @see Parcel#writeNoException
 * @see Parcel#writeException
 */
public static final void writeExceptionToParcel(Parcel reply, Exception e) {
    int     code         = 0;
    boolean logException = true;
    if (e instanceof FileNotFoundException) {
        code = 1;
        logException = false;
    } else if (e instanceof IllegalArgumentException) {
        code = 2;
    } else if (e instanceof UnsupportedOperationException) {
        code = 3;
    } else if (e instanceof SQLiteAbortException) {
        code = 4;
    } else if (e instanceof SQLiteConstraintException) {
        code = 5;
    } else if (e instanceof SQLiteDatabaseCorruptException) {
        code = 6;
    } else if (e instanceof SQLiteFullException) {
        code = 7;
    } else if (e instanceof SQLiteDiskIOException) {
        code = 8;
    } else if (e instanceof SQLiteException) {
        code = 9;
    } else if (e instanceof OperationApplicationException) {
        code = 10;
    } else if (e instanceof OperationCanceledException) {
        code = 11;
        logException = false;
    } else {
        reply.writeException(e);
        Log.e(TAG, "Writing exception to parcel", e);
        return;
    }
    reply.writeInt(code);
    reply.writeString(e.getMessage());

    if (logException) {
        Log.e(TAG, "Writing exception to parcel", e);
    }
}
项目:weex-uikit    文件:DefaultWXStorage.java   
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    SQLiteDatabase database = mDatabaseSupplier.getDatabase();
    if (database == null) {
        return false;
    }

    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = null;
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement = database.compileStatement(sql);
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if (e instanceof SQLiteFullException) {
            if (allowRetryWhenFull && trimToSize()) {
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
                return performSetItem(key, value, isPersistent, false);
            }
        }

        return false;
    } finally {
        if(statement != null) {
            statement.close();
        }
    }
}
项目:RLibrary    文件:DownloadStatusCallback.java   
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
    final int id = model.getId();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite " +
                        "full exception[%s], so remove it from the database directly.",
                id, sqLiteFullException.toString());
    }

    model.setErrMsg(sqLiteFullException.toString());
    model.setStatus(FileDownloadStatus.error);

    database.remove(id);
    database.removeConnections(id);
}
项目:weex-3d-map    文件:DefaultWXStorage.java   
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    SQLiteDatabase database = mDatabaseSupplier.getDatabase();
    if (database == null) {
        return false;
    }

    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "set k-v to storage(key:" + key + ",value:" + value + ",isPersistent:" + isPersistent + ",allowRetry:" + allowRetryWhenFull + ")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = null;
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement = database.compileStatement(sql);
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if (e instanceof SQLiteFullException) {
            if (allowRetryWhenFull && trimToSize()) {
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE, "retry set k-v to storage(key:" + key + ",value:" + value + ")");
                return performSetItem(key, value, isPersistent, false);
            }
        }

        return false;
    } finally {
        if(statement != null) {
            statement.close();
        }
    }
}
项目:Weex-TestDemo    文件:DefaultWXStorage.java   
private boolean performSetItem(String key, String value, boolean isPersistent, boolean allowRetryWhenFull) {
    WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"set k-v to storage(key:"+ key + ",value:"+ value+",isPersistent:"+isPersistent+",allowRetry:"+allowRetryWhenFull+")");
    String sql = "INSERT OR REPLACE INTO " + WXSQLiteOpenHelper.TABLE_STORAGE + " VALUES (?,?,?,?);";
    SQLiteStatement statement = mDatabaseSupplier.getDatabase().compileStatement(sql);
    String timeStamp = WXSQLiteOpenHelper.sDateFormatter.format(new Date());
    try {
        statement.clearBindings();
        statement.bindString(1, key);
        statement.bindString(2, value);
        statement.bindString(3, timeStamp);
        statement.bindLong(4, isPersistent ? 1 : 0);
        statement.execute();
        return true;
    } catch (Exception e) {
        WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE,"DefaultWXStorage occurred an exception when execute setItem :" + e.getMessage());
        if(e instanceof SQLiteFullException){
            if(allowRetryWhenFull && trimToSize()){
                //try again
                //setItem/setItemPersistent method only allow try once when occurred a sqliteFullException.
                WXLogUtils.d(WXSQLiteOpenHelper.TAG_STORAGE,"retry set k-v to storage(key:"+key+",value:"+value+")");
                return performSetItem(key,value,isPersistent,false);
            }
        }

        return false;
    } finally {
        statement.close();
    }
}
项目:vlc_android_win    文件:MediaDatabase.java   
public static void setPicture(MediaWrapper m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        getInstance().updateMedia(
            m.getUri(),
                mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:VCL-Android    文件:MediaDatabase.java   
public static void setPicture(MediaWrapper m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        getInstance().updateMedia(
            m.getUri(),
                INDEX_MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:FileDownloader    文件:DownloadStatusCallback.java   
private void handleSQLiteFullException(final SQLiteFullException sqLiteFullException) {
    final int id = model.getId();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "the data of the task[%d] is dirty, because the SQLite "
                        + "full exception[%s], so remove it from the database directly.",
                id, sqLiteFullException.toString());
    }

    model.setErrMsg(sqLiteFullException.toString());
    model.setStatus(FileDownloadStatus.error);

    database.remove(id);
    database.removeConnections(id);
}
项目:vlc-android    文件:MediaDatabase.java   
public static void setPicture(MediaWrapper m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        getInstance().updateMedia(
            m.getUri(),
                mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:tribler-android    文件:Util.java   
public static void setPicture(Context context, Media m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        MediaDatabase.getInstance(context).updateMedia(
            m.getLocation(),
            MediaDatabase.mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:android_maplib    文件:FeatureChanges.java   
public static void delete(String tableName)
{
    try {
        MapContentProviderHelper map = (MapContentProviderHelper) MapBase.getInstance();
        SQLiteDatabase db = map.getDatabase(true);
        String tableDrop = "DROP TABLE IF EXISTS " + tableName;
        db.execSQL(tableDrop);
    } catch (SQLiteFullException e) {
        e.printStackTrace();
    }
}
项目:VlcTest    文件:MediaDatabase.java   
public static void setPicture(Media m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        getInstance().updateMedia(
            m.getLocation(),
            mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:popcorntime-android-kitkat    文件:Util.java   
public static void setPicture(Context context, Media m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        MediaDatabase.getInstance(context).updateMedia(
            m.getLocation(),
            MediaDatabase.mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:VCameraSample    文件:Logger.java   
/**
 * 数据库文件已达到最大空间(数据库已满)
 * 
 * @param e
 */
public static void printStackTrace(String TAG, SQLiteFullException e) {
    if (IsDebug) {
        e.printStackTrace();
    } else {
        logException(TAG, e);
    }
}
项目:tsap    文件:Util.java   
public static void setPicture(Context context, Media m, Bitmap p) {
    Log.d(TAG, "Setting new picture for " + m.getTitle());
    try {
        MediaDatabase.getInstance(context).updateMedia(
            m.getLocation(),
            MediaDatabase.mediaColumn.MEDIA_PICTURE,
            p);
    } catch (SQLiteFullException e) {
        Log.d(TAG, "SQLiteFullException while setting picture");
    }
    m.setPictureParsed(true);
}
项目:LaunchEnr    文件:SQLiteCacheHelper.java   
private void onDiskFull(SQLiteFullException e) {
    mIgnoreWrites = true;
}
项目:FlickLauncher    文件:SQLiteCacheHelper.java   
private void onDiskFull(SQLiteFullException e) {
    Log.e(TAG, "Disk full, all write operations will be ignored", e);
    mIgnoreWrites = true;
}
项目:SimpleUILauncher    文件:SQLiteCacheHelper.java   
private void onDiskFull(SQLiteFullException e) {
    Log.e(TAG, "Disk full, all write operations will be ignored", e);
    mIgnoreWrites = true;
}
项目:FLauncher    文件:SQLiteCacheHelper.java   
private void onDiskFull(SQLiteFullException e) {
    Log.e(TAG, "Disk full, all write operations will be ignored", e);
    mIgnoreWrites = true;
}