我正在使用dropbox API到java,我试图从dropbox中读取。
当我使用api的路径时,它看起来像这样 -
טיול פסח path: /Public/טיול פסח
(忽略希伯来语中的词语 - 就像 - someFolderName paht:/ Public / someFolderName)
它看起来和往常一样,但当我尝试走这条道路时,它会给我这个例外 -
Exception in thread "main" java.lang.NullPointerException
at node.Main.listFolders(Main.java:102)
at node.Main.main(Main.java:112)
当我使用api的toString()方法给出一些metaData,包括文件夹的路径时,它会告诉我这个 -
טיול פסח toString(): Folder("/Public/\u05d8\u05d9\u05d5\u05dc \u05e4\u05e1\u05d7"...)
当引号内的字符串应该是路径时。 当我试图将其作为路径输入时,它会给我这个例外 -
Exception in thread "main" java.lang.NullPointerException
at node.Main.listFolders(Main.java:102)
at node.Main.main(Main.java:112)
代码示例:
路径是" / Public" ,它是参数s。 客户端是我的Dropbox的访问权限。 列表是根文件夹的子项列表。
public static void listFolders(String s) throws DbxException, IOException {
//list of children.
DbxEntry.WithChildren listing = client.getMetadataWithChildren(s);
for (DbxEntry child : listing.children) {
System.out.println(" " + child.name + " toString(): " + child.toString());
System.out.println(" " + child.name + " path: " + child.path);
}
}
以" / Public" 作为参数的输出结果为:
טיול פסח toString(): Folder("/Public/\u05d8\u05d9\u05d5\u05dc \u05e4\u05e1\u05d7", iconName="folder", mightHaveThumbnail=false)
טיול פסח path: /Public/
有什么想法吗?