gpt4 book ai didi

java - 无法删除 GAE 文件

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:53:17 24 4
gpt4 key购买 nike

我正在尝试使用

在上传失败后删除文件
final FileService fileService = FileServiceFactory.getFileService();
fileService.delete(file);

但是我得到:

java.lang.UnsupportedOperationException: File \/blobstore\/writable:AD8BvukH[...]qau-Bb7AD does not have a finalized name

当我尝试用

完成文件时
FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);
writeChannel.closeFinally();

然后 openWriteChannel() 失败了

com.google.appengine.api.files.FinalizationException
[...]
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 101:

ApplicationError 101 是什么意思?如何正确删除文件?

最佳答案

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

Sep 11, 2013 at 1:14 am

We have now fixed this issue from reoccurring in future. However, there are some blobs created in the past that still give errors. We are working on a fix for these blobs.

John Lowry On behalf of the App Engine team

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

UnsupportedOperationException

对于第一个错误,the documentation states :

java.lang.UnsupportedOperationException - if a file's type is not supported by delete or file does not have a finalized name.

可能是文件已经定稿,由于其他原因无法删除。

应用程序错误:101

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

FinalizationError: ApplicationError: 101 Blobkey not found.

这可能会为您澄清问题。

You only use finalize if you create a file and write to it. But you cannot write to a file, after it has been finalized. To update a file in the blobstore, you always have to create a new one. And when you read a file, you do not have to finalize it. To read a file you have to use a blobreader. See: https://developers.google.com/appengine/docs/python/blobstore/blobreaderclass

通过https://stackoverflow.com/a/12855653/1085891

修复损坏的上传

你可以 resume the upload .

If the transfer is interrupted, you can resume the transfer from where it left off using the --db_filename=... argument.

通过How to finish a broken data upload to the production Google App Engine server?

其他解决方案/信息:

关于java - 无法删除 GAE 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21021129/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com