projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sync progress indicator
[pub/Android/ownCloud.git]
/
src
/
eu
/
alefzero
/
owncloud
/
datamodel
/
FileDataStorageManager.java
diff --git
a/src/eu/alefzero/owncloud/datamodel/FileDataStorageManager.java
b/src/eu/alefzero/owncloud/datamodel/FileDataStorageManager.java
index
e862a5a
..
7ecb491
100644
(file)
--- a/
src/eu/alefzero/owncloud/datamodel/FileDataStorageManager.java
+++ b/
src/eu/alefzero/owncloud/datamodel/FileDataStorageManager.java
@@
-53,17
+53,23
@@
public class FileDataStorageManager implements DataStorageManager {
@Override
public OCFile getFileByPath(String path) {
Cursor c = getCursorForValue(ProviderTableMeta.FILE_PATH, path);
@Override
public OCFile getFileByPath(String path) {
Cursor c = getCursorForValue(ProviderTableMeta.FILE_PATH, path);
- if (c.moveToFirst())
- return createFileInstance(c);
- return null;
+ OCFile file = null;
+ if (c.moveToFirst()) {
+ file = createFileInstance(c);
+ c.close();
+ }
+ return file;
}
@Override
public OCFile getFileById(long id) {
Cursor c = getCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
}
@Override
public OCFile getFileById(long id) {
Cursor c = getCursorForValue(ProviderTableMeta._ID, String.valueOf(id));
- if (c.moveToFirst())
- return createFileInstance(c);
- return null;
+ OCFile file = null;
+ if (c.moveToFirst()) {
+ file = createFileInstance(c);
+ c.close();
+ }
+ return file;
}
@Override
}
@Override
@@
-92,6
+98,7
@@
public class FileDataStorageManager implements DataStorageManager {
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
if (fileExists(file.getPath())) {
cv.put(ProviderTableMeta.FILE_ACCOUNT_OWNER, mAccount.name);
if (fileExists(file.getPath())) {
+ file.setFileId(getFileByPath(file.getPath()).getFileId());
overriden = true;
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI,
overriden = true;
if (getContentResolver() != null) {
getContentResolver().update(ProviderTableMeta.CONTENT_URI,
@@
-157,7
+164,7
@@
public class FileDataStorageManager implements DataStorageManager {
}
public Vector<OCFile> getDirectoryContent(OCFile f) {
}
public Vector<OCFile> getDirectoryContent(OCFile f) {
- if (f.isDirectory() && f.getFileId() != -1) {
+ if (f
!= null && f
.isDirectory() && f.getFileId() != -1) {
Vector<OCFile> ret = new Vector<OCFile>();
Uri req_uri = Uri.withAppendedPath(
Vector<OCFile> ret = new Vector<OCFile>();
Uri req_uri = Uri.withAppendedPath(