无法删除GAE文件

Mic*_*ael 8 java google-app-engine google-cloud-datastore

我试图在使用上传中断后删除文件

final FileService fileService = FileServiceFactory.getFileService();
fileService.delete(file);
Run Code Online (Sandbox Code Playgroud)

但我得到:

java.lang.UnsupportedOperationException: File \/blobstore\/writable:AD8BvukH[...]qau-Bb7AD does not have a finalized name
Run Code Online (Sandbox Code Playgroud)

当我尝试使用完成文件时

FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);
writeChannel.closeFinally();
Run Code Online (Sandbox Code Playgroud)

然后openWriteChannel()失败了

com.google.appengine.api.files.FinalizationException
[...]
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 101: 
Run Code Online (Sandbox Code Playgroud)

ApplicationError 101的含义是什么?如何正确删除文件?

JSu*_*uar 4

看起来其他人已经报告了这个问题,尽管它已得到解决,但仍然可能存在文件损坏的问题。

2013 年 9 月 11 日凌晨 1:14

我们现在已经解决了这个问题,以免将来再次出现。但是,过去创建的一些 blob 仍然会出现错误。我们正在努力修复这些斑点。

John Lowry 代表 App Engine 团队

http://grokbase.com/t/gg/google-appengine/138xrawqw0/broken-blobstore-files-what-to-do

UnsupportedOperationException

对于第一个错误,文档指出

java.lang.UnsupportedOperationException- 如果删除不支持文件类型或文件没有最终名称。

可能该文件已经完成,并且由于某些其他原因而无法删除它。

ApplicationError: 101

我认为第二个错误是指未找到异常。

FinalizationError: ApplicationError: 101 Blobkey not found.
Run Code Online (Sandbox Code Playgroud)

这可能会为您澄清这个问题。

仅当创建文件并写入文件时才使用 Finalize。但在文件完成后,您无法写入文件。要更新 blobstore 中的文件,您始终必须创建一个新文件。当您读取文件时,您不必最终确定它。要读取文件,您必须使用 blobreader。请参阅: https ://developers.google.com/appengine/docs/python/blobstore/blobreaderclass

通过/sf/answers/899895741/

修复损坏的上传

您可以恢复上传

如果传输中断,您可以使用参数从中断处恢复传输--db_filename=...

通过如何完成将损坏的数据上传到生产 Google App Engine 服务器?

其他解决方案/信息: