cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We want to hear from you on accessibility tools and features for Dropbox - get involved in the conversation here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Android, uploadBuilder, IllegalArgumentException: Value is null

Android, uploadBuilder, IllegalArgumentException: Value is null

afritz a.
Helpful | Level 5
Go to solution

I have an App named "Android Outliner" with DropBox Api2 integration. One of my customers has an issue while trying to upload a file.

 

fileMetadata = dbxClientV2       
.files()
       .uploadBuilder("/" + dropboxDir + "/" + file.getName())
       .withAutorename(false)
       .withMode(WriteMode.OVERWRITE)
       .withMute(false)
       .uploadAndFinish(fileInputStream);

...

Dropbox: upload file ... treepad Infoca.hjt Dropbox: Something else went wrong while uploading. java.lang.IllegalArgumentException: Value is null at com.dropbox.core.v2.files.WriteMode.com.dropbox.core.v2.files.WriteMode update(java.lang.String)(SourceFile:170) at at.ff.util.Util.java.lang.String uploadFileToDropbox(android.content.Context,java.lang.String,java.lang.String,java.io.File,java.lang.String,java.lang.String)(SourceFile:745) at at.ff.outliner.SyncTreepad.boolean exportSync(long,java.util.ArrayList)(SourceFile:414) at at.ff.outliner.ActivityList.boolean saveState(boolean)(SourceFile:2667) at at.ff.outliner.ActivityList$SaveStateTask.java.lang.Boolean doInBackground(java.lang.Void[])(SourceFile:2896) at at.ff.outliner.ActivityList$SaveStateTask.java.lang.Object doInBackground(java.lang.Object[])(SourceFile:2848) at android.os.AsyncTask$2.call(AsyncTask.java:295) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) export sync: upload to Dropbox failed null /storage/emulated/0/outliner/sync/treepad/Infoca.hjt

 

Creating of folders within the "apps" folder works, just uploading files fails.

 

This happens, even if the user tries with an other dropbox account.

 

Usually the App-folder, which Outliner is allowed to access, always is

"Apps/outliner".

In the case of this customer it is

"Aplicaciones/outliner".

This is also the folder where Outliner successfully created the subfolders.

The customer's Android Settings as well as the Application language is spanish.

The customer also told me that he uses a Linux desktop with a Dropbox client.
 
 
 
1 Accepted Solution

Accepted Solutions

afritz a.
Helpful | Level 5
Go to solution

You were completely right, Greg. The user's setting told me that the called code was this one instead of the one I told you in the first post:

 

fileMetadata = dbxClientV2
      .files()
      .uploadBuilder("/" + dropboxDir + "/" + file.getName())
      .withAutorename(true)
      .withMode(WriteMode.update(oldRevision))
      .withMute(false)
      .uploadAndFinish(fileInputStream);

 

I did not cleanup everything correctly after the user changed his sync method from another provider to DropBox and did send a wrong oldRevision.

 

Thanks for the quick feedback and the accurate suggestion.

 

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

@afritz a. Is that definitely the exact code that is triggering this error? The code shows you using the "overwrite" write mode, but the error mentions the "update" write mode instead. 

 

Also, for reference, the "/Apps" folder name is localized based on the user's account language, but this doesn't affect the API behavior, as app's with the app folder permission don't need to know that app folder root path. The API automatically converts the root path for these apps to be the app folder on the backend.

 

 

afritz a.
Helpful | Level 5
Go to solution

@Greg-DB wrote:

@afritz a. Is that definitely the exact code that is triggering this error? The code shows you using the "overwrite" write mode, but the error mentions the "update" write mode instead. 

 

 

Thanks for the reply.

I will check this but have to ask the customer about a Setting. I will tell you.

Greg-DB
Dropbox Staff
Go to solution

Thanks. For example, I was able to reproduce this using:

 

.withMode(WriteMode.update(null))

The value passed in to WriteMode.update should be the 'rev' value, not null.

afritz a.
Helpful | Level 5
Go to solution

You were completely right, Greg. The user's setting told me that the called code was this one instead of the one I told you in the first post:

 

fileMetadata = dbxClientV2
      .files()
      .uploadBuilder("/" + dropboxDir + "/" + file.getName())
      .withAutorename(true)
      .withMode(WriteMode.update(oldRevision))
      .withMute(false)
      .uploadAndFinish(fileInputStream);

 

I did not cleanup everything correctly after the user changed his sync method from another provider to DropBox and did send a wrong oldRevision.

 

Thanks for the quick feedback and the accurate suggestion.

 

Need more support?