|
@@ -224,8 +224,7 @@ public class FileDataStorageManager {
|
|
cv, ProviderTableMeta._ID + "=?",
|
|
cv, ProviderTableMeta._ID + "=?",
|
|
new String[]{String.valueOf(file.getFileId())});
|
|
new String[]{String.valueOf(file.getFileId())});
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -238,8 +237,7 @@ public class FileDataStorageManager {
|
|
result_uri = getContentProviderClient().insert(
|
|
result_uri = getContentProviderClient().insert(
|
|
ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
ProviderTableMeta.CONTENT_URI_FILE, cv);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (result_uri != null) {
|
|
if (result_uri != null) {
|
|
@@ -412,7 +410,7 @@ public class FileDataStorageManager {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -603,7 +601,7 @@ public class FileDataStorageManager {
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
ProviderTableMeta.FILE_PATH + " ASC "
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, e.getMessage(), e);
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -820,7 +818,7 @@ public class FileDataStorageManager {
|
|
ProviderTableMeta.FILE_PARENT + "=?",
|
|
ProviderTableMeta.FILE_PARENT + "=?",
|
|
new String[]{String.valueOf(parentId)}, null);
|
|
new String[]{String.valueOf(parentId)}, null);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, e.getMessage(), e);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -872,9 +870,7 @@ public class FileDataStorageManager {
|
|
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
|
|
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=?",
|
|
new String[]{value, mAccount.name}, null);
|
|
new String[]{value, mAccount.name}, null);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- "Couldn't determine file existance, assuming non existance: "
|
|
|
|
- + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Couldn't determine file existance, assuming non existance: " + e.getMessage(), e);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -902,7 +898,7 @@ public class FileDataStorageManager {
|
|
+ "=?", new String[]{value, mAccount.name},
|
|
+ "=?", new String[]{value, mAccount.name},
|
|
null);
|
|
null);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Could not get file details: " + e.getMessage(), e);
|
|
c = null;
|
|
c = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1000,8 +996,7 @@ public class FileDataStorageManager {
|
|
cv, ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + "=?",
|
|
cv, ProviderTableMeta.OCSHARES_ID_REMOTE_SHARED + "=?",
|
|
new String[]{String.valueOf(share.getRemoteId())});
|
|
new String[]{String.valueOf(share.getRemoteId())});
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -1014,8 +1009,7 @@ public class FileDataStorageManager {
|
|
result_uri = getContentProviderClient().insert(
|
|
result_uri = getContentProviderClient().insert(
|
|
ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
ProviderTableMeta.CONTENT_URI_SHARE, cv);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (result_uri != null) {
|
|
if (result_uri != null) {
|
|
@@ -1102,14 +1096,12 @@ public class FileDataStorageManager {
|
|
c = getContentProviderClient().query(
|
|
c = getContentProviderClient().query(
|
|
ProviderTableMeta.CONTENT_URI_SHARE,
|
|
ProviderTableMeta.CONTENT_URI_SHARE,
|
|
null,
|
|
null,
|
|
- key + AND
|
|
|
|
- + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
|
|
|
|
|
+ key + AND + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
|
new String[]{value, mAccount.name},
|
|
new String[]{value, mAccount.name},
|
|
null
|
|
null
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.w(TAG,
|
|
|
|
- "Could not get details, assuming share does not exist: "+ e.getMessage());
|
|
|
|
|
|
+ Log_OC.w(TAG, "Could not get details, assuming share does not exist: "+ e.getMessage());
|
|
c = null;
|
|
c = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1170,13 +1162,16 @@ public class FileDataStorageManager {
|
|
null);
|
|
null);
|
|
|
|
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Could not get file details: " + e.getMessage(), e);
|
|
cursor = null;
|
|
cursor = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
OCShare share = null;
|
|
OCShare share = null;
|
|
- if (cursor != null && cursor.moveToFirst()) {
|
|
|
|
- share = createShareInstance(cursor);
|
|
|
|
|
|
+ if (cursor != null) {
|
|
|
|
+ if (cursor.moveToFirst()) {
|
|
|
|
+ share = createShareInstance(cursor);
|
|
|
|
+ }
|
|
cursor.close();
|
|
cursor.close();
|
|
}
|
|
}
|
|
return share;
|
|
return share;
|
|
@@ -1226,10 +1221,9 @@ public class FileDataStorageManager {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
try {
|
|
try {
|
|
- getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where,
|
|
|
|
- whereArgs);
|
|
|
|
|
|
+ getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Exception in resetShareFlagsInAllFiles" + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Exception in resetShareFlagsInAllFiles" + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1248,10 +1242,9 @@ public class FileDataStorageManager {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
try {
|
|
try {
|
|
- getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where,
|
|
|
|
- whereArgs);
|
|
|
|
|
|
+ getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1270,10 +1263,9 @@ public class FileDataStorageManager {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
try {
|
|
try {
|
|
- getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where,
|
|
|
|
- whereArgs);
|
|
|
|
|
|
+ getContentProviderClient().update(ProviderTableMeta.CONTENT_URI, cv, where, whereArgs);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Exception in resetShareFlagsInFolder " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1290,7 +1282,7 @@ public class FileDataStorageManager {
|
|
getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_SHARE, where,
|
|
getContentProviderClient().delete(ProviderTableMeta.CONTENT_URI_SHARE, where,
|
|
whereArgs);
|
|
whereArgs);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Exception in cleanShares" + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Exception in cleanShares" + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1353,11 +1345,8 @@ public class FileDataStorageManager {
|
|
results = getContentProviderClient().applyBatch(operations);
|
|
results = getContentProviderClient().applyBatch(operations);
|
|
}
|
|
}
|
|
|
|
|
|
- } catch (OperationApplicationException e) {
|
|
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
-
|
|
|
|
- } catch (RemoteException e) {
|
|
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
|
|
+ } catch (OperationApplicationException | RemoteException e) {
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1444,8 +1433,7 @@ public class FileDataStorageManager {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
-
|
|
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1496,8 +1484,7 @@ public class FileDataStorageManager {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
-
|
|
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1542,8 +1529,7 @@ public class FileDataStorageManager {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
-
|
|
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1572,8 +1558,7 @@ public class FileDataStorageManager {
|
|
}
|
|
}
|
|
|
|
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
} catch (OperationApplicationException | RemoteException e) {
|
|
- Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage());
|
|
|
|
-
|
|
|
|
|
|
+ Log_OC.e(TAG, EXCEPTION_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1684,17 +1669,20 @@ public class FileDataStorageManager {
|
|
null, where, whereArgs, null);
|
|
null, where, whereArgs, null);
|
|
|
|
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage(), e);
|
|
cursor = null;
|
|
cursor = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
ArrayList<OCShare> shares = new ArrayList<OCShare>();
|
|
ArrayList<OCShare> shares = new ArrayList<OCShare>();
|
|
OCShare share = null;
|
|
OCShare share = null;
|
|
- if (cursor != null && cursor.moveToFirst()) {
|
|
|
|
- do {
|
|
|
|
- share = createShareInstance(cursor);
|
|
|
|
- shares.add(share);
|
|
|
|
- } while (cursor.moveToNext());
|
|
|
|
|
|
+ if (cursor != null) {
|
|
|
|
+ if (cursor.moveToFirst()) {
|
|
|
|
+ do {
|
|
|
|
+ share = createShareInstance(cursor);
|
|
|
|
+ shares.add(share);
|
|
|
|
+ } while (cursor.moveToNext());
|
|
|
|
+ }
|
|
|
|
+
|
|
cursor.close();
|
|
cursor.close();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1745,7 +1733,7 @@ public class FileDataStorageManager {
|
|
MediaStore.Video.Media.DATA + "=?", new String[]{path});
|
|
MediaStore.Video.Media.DATA + "=?", new String[]{path});
|
|
}
|
|
}
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Exception deleting media file in MediaStore " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Exception deleting media file in MediaStore " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1773,7 +1761,7 @@ public class FileDataStorageManager {
|
|
new String[]{String.valueOf(file.getFileId())}
|
|
new String[]{String.valueOf(file.getFileId())}
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1784,7 +1772,7 @@ public class FileDataStorageManager {
|
|
/// set conflict in all ancestor folders
|
|
/// set conflict in all ancestor folders
|
|
|
|
|
|
long parentId = file.getParentId();
|
|
long parentId = file.getParentId();
|
|
- Set<String> ancestorIds = new HashSet<String>();
|
|
|
|
|
|
+ Set<String> ancestorIds = new HashSet<>();
|
|
while (parentId != FileDataStorageManager.ROOT_PARENT_ID) {
|
|
while (parentId != FileDataStorageManager.ROOT_PARENT_ID) {
|
|
ancestorIds.add(Long.toString(parentId));
|
|
ancestorIds.add(Long.toString(parentId));
|
|
parentId = getFileById(parentId).getParentId();
|
|
parentId = getFileById(parentId).getParentId();
|
|
@@ -1814,7 +1802,7 @@ public class FileDataStorageManager {
|
|
ancestorIds.toArray(new String[]{})
|
|
ancestorIds.toArray(new String[]{})
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} // else file is ROOT folder, no parent to set in conflict
|
|
} // else file is ROOT folder, no parent to set in conflict
|
|
@@ -1855,7 +1843,7 @@ public class FileDataStorageManager {
|
|
null
|
|
null
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Failed querying for descendents in conflict " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Failed querying for descendents in conflict " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (descendentsInConflict == null || descendentsInConflict.getCount() == 0) {
|
|
if (descendentsInConflict == null || descendentsInConflict.getCount() == 0) {
|
|
@@ -1878,7 +1866,7 @@ public class FileDataStorageManager {
|
|
, new String[]{mAccount.name, parentPath}
|
|
, new String[]{mAccount.name, parentPath}
|
|
);
|
|
);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1948,8 +1936,7 @@ public class FileDataStorageManager {
|
|
cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
|
cv, ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=?",
|
|
new String[]{mAccount.name});
|
|
new String[]{mAccount.name});
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -1962,8 +1949,7 @@ public class FileDataStorageManager {
|
|
result_uri = getContentProviderClient().insert(
|
|
result_uri = getContentProviderClient().insert(
|
|
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
|
ProviderTableMeta.CONTENT_URI_CAPABILITIES, cv);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- FAILED_TO_INSERT_MSG + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, FAILED_TO_INSERT_MSG + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (result_uri != null) {
|
|
if (result_uri != null) {
|
|
@@ -2003,9 +1989,7 @@ public class FileDataStorageManager {
|
|
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ",
|
|
ProviderTableMeta.CAPABILITIES_ACCOUNT_NAME + "=? ",
|
|
new String[]{accountName}, null);
|
|
new String[]{accountName}, null);
|
|
} catch (RemoteException e) {
|
|
} catch (RemoteException e) {
|
|
- Log_OC.e(TAG,
|
|
|
|
- "Couldn't determine capability existance, assuming non existance: "
|
|
|
|
- + e.getMessage());
|
|
|
|
|
|
+ Log_OC.e(TAG, "Couldn't determine capability existence, assuming non existance: " + e.getMessage(), e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|