Google Prediction API - dataStoreFactory - setPermissionsToOwnerOnly

时间:2015-07-02 12:15:35

标签: java authentication credentials google-api-java-client

运行PredicitonSample.java我使用client_secrets.json设置了所有内容,当我使用所有凭据运行文件时,我收到此错误:

com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for everybody: C:\Users\100018349\.store\prediction_sample
Jul 01, 2015 4:19:02 PM com.google.api.client.util.store.FileDataStoreFactory setPermissionsToOwnerOnly
WARNING: unable to change permissions for owner: C:\Users\100018349\.store\prediction_sample
java.lang.NullPointerException
at java.io.Reader.<init>(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at PredictionEngine.authorize(PredictionEngine.java:96)
at PredictionEngine.main(PredictionEngine.java:262)

可以在此github repo中找到PredicitonSample.java的代码: https://github.com/gxlzlihao/GooglePredictionAPISample/blob/master/src/main/java/com/google/api/services/samples/prediction/cmdline/PredictionSample.java

1 个答案:

答案 0 :(得分:1)

试试这个:

/** Directory to store user credentials. */

private static final java.io.File DATA_STORE_DIR =
      new java.io.File(System.getProperty("user.home"), ".store/analytics_sample");

private static FileDataStoreFactory dataStoreFactory;

dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR);