cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

Why is my local DropBox folder not readable with java?

Why is my local DropBox folder not readable with java?

BruceVWilcox
Explorer | Level 4

 

I am trying to read files in DropBox folders on my Mac with java.

The following code:

String dir
= "/Users/brucewilcox/Library/CloudStorage/Dropbox/Apps/Form8949DotCom/taxdochub-forms-pdf/XXXX";
File directory = new File( dir );
boolean canRead = directory.canRead( );
String message = String.format( "canRead is: %s", canRead );
System.out.println( message );

emits

canRead is: false

 

The directory object exists, is a directory, and display an absolute path.

 

What is the root cause of this?

 

How can I fix?

 

Thank you.

4 Replies 4

DB-Des
Dropbox Engineer

Hi @BruceVWilcox,

 

The local Dropbox folder should be readable. The issue you are encountering is most likely a local permissions issue.

 

Since the behavior you are describing is not an error from the Dropbox API itself, we can't offer much more help with that in particular.

BruceVWilcox
Explorer | Level 4

@DB-Des wrote:

Hi @BruceVWilcox,

 

The local Dropbox folder should be readable. The issue you are encountering is most likely a local permissions issue.

 

Since the behavior you are describing is not an error from the Dropbox API itself, we can't offer much more help with that in particular.


The folder is populated programmatically with files from a java app in Google Cloud. It turns out that the individual files do not have ANY permissions for other than me as a user. I am running the java app from my IntelliJ IDE. Not sure why the permissions are so narrow. And not sure who the user is when the IDE runs.

BruceVWilcox
Explorer | Level 4

It turns out that all of the individual files in the folder do not have ANY permissions for users other than me. As such the folder itself is not readable.


I am running the java app to read the directory and files from my IntelliJ IDE. I am not sure who the user is when the IDE runs.

 

But I am not sure why the permissions are so narrow. The folder is populated programmatically with files from a java app running in Google Cloud.

 

What controls the file permissions?

 

Here are code excerpts:

 

DbxClientV2 client = getDbxClientV2( );

try ( InputStream in = new ByteArrayInputStream( fileBytes ) ) {

FileMetadata metadata
= client.files( )
.uploadBuilder( filePath )
.uploadAndFinish( in );

///…

}

public DbxClientV2 getDbxClientV2( ) {

String accessToken = this.getAccessToken( );

DbxRequestConfig config
= DbxRequestConfig
.newBuilder( this.getAppIdentifier( ) )
.build( );

DbxClientV2 client = new DbxClientV2( config, accessToken );

return client;

}

 

DB-Des
Dropbox Engineer

@BruceVWilcox, file permissions are controlled by the user locally. Once the Dropbox app is installed and syncing is allowed, that user should have access to the contents of that Dropbox folder.

 

Have you confirmed the file or folder you are attempting to access exists with directory.exists() function in your Java script?

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    DB-Des Dropbox Engineer
  • User avatar
    BruceVWilcox Explorer | Level 4
What do Dropbox user levels mean?