0
我目前正在Android Studio上使用Azure Blob存儲。我無法遍歷一個blob容器枚舉結果時發生錯誤,請查看原始異常以瞭解詳細信息
它告訴我
08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err: java.util.NoSuchElementException: An error occurred while enumerating the result, check the original exception for details.
08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err: at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:113)
08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err: at com.psv.starvision.blobHandler.ListImages(blobHandler.java:81)
Caused by: com.microsoft.azure.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err: at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:306)
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err: at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:177)
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err: at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)
這是ListImages.Class
public static String[] ListImages() {
LinkedList<String> blobNames = new LinkedList<>();
try {
CloudBlobContainer container = getContainer();
Log.e("listimages: ", "container " + container);
Iterable<ListBlobItem> blobs = container.listBlobs();
Log.e("listimages: ", "blobs " + blobs);
blobNames = new LinkedList<>();
for(ListBlobItem blob: blobs) { // the line that hit an error
blobNames.add(((CloudBlockBlob) blob).getName());
}
Log.e("ListImages: ", "size" + blobNames.size());
return blobNames.toArray(new String[blobNames.size()]);
} catch (Exception ex){
ex.printStackTrace();
}
return blobNames.toArray(new String[blobNames.size()]);
}
上有什麼問題的任何想法?有問題的容器不是空的;我可以登錄container
和blobs
。
請和謝謝你!
其他的答案SO線程的https:/ /stackoverflow.com/questions/31578118/java-azure-storage-error-enumerating-the-result可能有幫助,這似乎與你的相似。 –
我會研究它,謝謝! – yuenhy