这里发生了奇怪的事情。运行任何调用的单元测试时:
FileService fileService = FileServiceFactory.getFileService();
writeChannel = fileService.openWriteChannel(file, lock);
writeChannel.closeFinally();
我得到以下异常 - 代码在单元测试之外和其他工作站上运行良好 - 所以这是我被迫使用的 Windows XP 笔记本电脑上的环境问题。测试在我的其他电脑和笔记本电脑上运行良好(运行 ubuntu)
java.lang.RuntimeException: illegal blobKey: pIONuF92LGIK8TV41YSSdQ
at com.google.appengine.api.blobstore.dev.FileBlobStorage.getFileForBlob(FileBlobStorage.java:95)
at com.google.appengine.api.blobstore.dev.FileBlobStorage.storeBlob(FileBlobStorage.java:45)
at com.google.appengine.api.files.dev.BlobstoreFile.getOutputStream(BlobstoreFile.java:225)
at com.google.appengine.api.files.dev.FileMetadata.setFinalized(FileMetadata.java:97)
at com.google.appengine.api.files.dev.BlobstoreFile.setFinalized(BlobstoreFile.java:212)
at com.google.appengine.api.files.dev.LocalFileService.close(LocalFileService.java:334)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:498)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:452)
at com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:430)
at java.util.concurrent.Executors$PrivilegedCallable$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.concurrent.Executors$PrivilegedCallable.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)