- throw new IllegalArgumentException("Illegal null account in UploadFileOperation creation");
- if (localPath == null || localPath.length() <= 0)
- throw new IllegalArgumentException("Illegal null or empty localPath in UploadFileOperation creation");
- if (remotePath == null || remotePath.length() <= 0)
- throw new IllegalArgumentException("Illegal null or empty remotePath in UploadFileOperation creation");
-
- mAccount = account;
- mLocalPath = localPath;
- mRemotePath = remotePath;
- mMimeType = mimeType;
- if (mMimeType == null || mMimeType.length() <= 0) {
- try {
- mMimeType = MimeTypeMap.getSingleton()
- .getMimeTypeFromExtension(
- localPath.substring(localPath.lastIndexOf('.') + 1));
- } catch (IndexOutOfBoundsException e) {
- Log.e(TAG, "Trying to find out MIME type of a file without extension: " + localPath);
- }
- }
- if (mMimeType == null) {
- mMimeType = "application/octet-stream";
+ throw new IllegalArgumentException("Illegal NULL account in UploadFileOperation creation");
+ if (file == null)
+ throw new IllegalArgumentException("Illegal NULL file in UploadFileOperation creation");
+ if (file.getStoragePath() == null || file.getStoragePath().length() <= 0 || !(new File(file.getStoragePath()).exists())) {
+ throw new IllegalArgumentException("Illegal file in UploadFileOperation; storage path invalid or file not found: " + file.getStoragePath());