X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/b66e309dfa8b145a293cb47b7cbcf588dc0c79ab..e16f63591d6315081dc8eefaba3541f366dd14b9:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index 55aefbd3..4d2df0fe 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.apache.http.HttpStatus; +import org.apache.jackrabbit.webdav.DavConstants; import org.apache.jackrabbit.webdav.MultiStatus; import org.apache.jackrabbit.webdav.client.methods.PropFindMethod; @@ -128,8 +129,8 @@ public class FileUploader extends Service implements OnDatatransferProgressListe private RemoteViews mDefaultNotificationContentView; - public String getUploadFinishMessage() { - return getClass().getName().toString() + UPLOAD_FINISH_MESSAGE; + public static String getUploadFinishMessage() { + return FileUploader.class.getName().toString() + UPLOAD_FINISH_MESSAGE; } /** @@ -382,7 +383,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe return false; String targetKey = buildRemoteName(account, file); synchronized (mPendingUploads) { - if (file.isDirectory()) { + if (file.isFolder()) { // this can be slow if there are many uploads :( Iterator it = mPendingUploads.keySet().iterator(); boolean found = false; @@ -535,6 +536,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe mPendingUploads.remove(uploadKey); Log_OC.i(TAG, "Remove CurrentUploadItem from pending upload Item Map."); } + if (uploadResult.isException()) { + // enforce the creation of a new client object for next uploads; this grant that a new socket will + // be created in the future if the current exception is due to an abrupt lose of network connection + mUploadClient = null; + } } /// notify result @@ -617,8 +623,9 @@ public class FileUploader extends Service implements OnDatatransferProgressListe PropFindMethod propfind = null; RemoteOperationResult result = null; try { - propfind = new PropFindMethod(mUploadClient.getBaseUri() - + WebdavUtils.encodePath(mCurrentUpload.getRemotePath())); + propfind = new PropFindMethod(mUploadClient.getBaseUri() + WebdavUtils.encodePath(mCurrentUpload.getRemotePath()), + DavConstants.PROPFIND_ALL_PROP, + DavConstants.DEPTH_0); int status = mUploadClient.executeMethod(propfind); boolean isMultiStatus = (status == HttpStatus.SC_MULTI_STATUS); if (isMultiStatus) { @@ -723,12 +730,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe mNotification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon); /// includes a pending intent in the notification showing the details view of the file - Intent showDetailsIntent = null; - if (PreviewImageFragment.canBePreviewed(upload.getFile())) { - showDetailsIntent = new Intent(this, PreviewImageActivity.class); - } else { - showDetailsIntent = new Intent(this, FileDisplayActivity.class); - } + Intent showDetailsIntent = new Intent(this, FileDisplayActivity.class); showDetailsIntent.putExtra(FileActivity.EXTRA_FILE, upload.getFile()); showDetailsIntent.putExtra(FileActivity.EXTRA_ACCOUNT, upload.getAccount()); showDetailsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);