Java – WARNING: unable to change permissions for everybody:

google-drive-apijava

When running the Java quickstart sample at https://developers.google.com/drive/web/quickstart/java?hl=hu in NetBeans, I'm receiving the error code:

Jun 04, 2015 12:12:11 AM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody:
C:\Users\Quibbles\credentials\drive-api-quickstart

What am I doing wrong?

Edit: This is the complete error message.

Jun 04, 2015 5:11:39 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner: C:\Users\Quibbles\.credentials\drive-api-quickstart
Exception in thread "main" java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:78)
    at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
    at DriveQuickstart.authorize(DriveQuickstart.java:64)
    at DriveQuickstart.getDriveService(DriveQuickstart.java:87)
    at DriveQuickstart.main(DriveQuickstart.java:96)
Java Result: 1

Best Solution

Had the same issue and wasted hours before realizing that "unable to change permissions for owner: C:\Users\Quibbles.credentials\drive-api-quickstart"
is just a warning.

The real issue is the null pointer here.

InputStream in =
            DriveQuickstart.class.getResourceAsStream("/client_secret.json");

This line was the issue in my case. "in" was null and hence the null pointer.

InputStream in    = new FileInputStream("<Full Path>\\client_secret.json");  

This resolved my issue.

Related Question