简体   繁体   中英

Google Drive SDK File.getFileSize() NullPointerException

Steps to reproduce:

  • Using the newest Google Drive SDK v2-rev25-1.12.0
  • Retrieve the list of files using the LIST API of Google Drive
  • You should have now a List<File>
  • Looping trough the list read the file size with File.getFileSize()
  • Folders and files with extensions work ok, you get the file size 0 or something > 0
  • Call getFileSize on GoogleDocs Files stored in the Google Drive produce a NullPointerException

File size on google native documents have no real meaning for the end user, because he will never download a file having the native format of google docs. You may have an idea of the space occupied on the user's drive using the quotaBytesUsed property of File.

By the way, are you sure you get a NPE when you call file.getFileSize() or when you use the result of this invokation in other method ? Because such a call should return null but should not throw an Exception

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM