@@ -98,19 +98,26 @@ private int delete(SQLiteDatabase db, Uri uri, String where, String[] whereArgs)
9898 case SINGLE_FILE :
9999 Cursor c = query (db , uri , null , where , whereArgs , null );
100100 String remoteId = "" ;
101- if (c != null && c .moveToFirst ()) {
102- remoteId = c .getString (c .getColumnIndex (ProviderTableMeta .FILE_REMOTE_ID ));
103- //ThumbnailsCacheManager.removeFileFromCache(remoteId);
104- c .close ();
101+ try {
102+ if (c != null && c .moveToFirst ()) {
103+ remoteId = c .getString (c .getColumnIndex (ProviderTableMeta .FILE_REMOTE_ID ));
104+ //ThumbnailsCacheManager.removeFileFromCache(remoteId);
105+ }
106+ Log_OC .d (TAG , "Removing FILE " + remoteId );
107+
108+ count = db .delete (ProviderTableMeta .FILE_TABLE_NAME ,
109+ ProviderTableMeta ._ID
110+ + "="
111+ + uri .getPathSegments ().get (1 )
112+ + (!TextUtils .isEmpty (where ) ? " AND (" + where + ")" : "" ),
113+ whereArgs );
114+ } catch (Exception e ) {
115+ Log_OC .d (TAG , "DB-Error removing file!" , e );
116+ } finally {
117+ if (c != null ) {
118+ c .close ();
119+ }
105120 }
106- Log_OC .d (TAG , "Removing FILE " + remoteId );
107-
108- count = db .delete (ProviderTableMeta .FILE_TABLE_NAME ,
109- ProviderTableMeta ._ID
110- + "="
111- + uri .getPathSegments ().get (1 )
112- + (!TextUtils .isEmpty (where ) ? " AND (" + where
113- + ")" : "" ), whereArgs );
114121 break ;
115122 case DIRECTORY :
116123 // deletion of folder is recursive
0 commit comments