try
{
// Retrieve storage account from connection-string.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
// Create the blob client.
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.getContainerReference("config");
// Loop through each blob item in the container.
// If the item is a blob, not a virtual directory.
for (ListBlobItem blobItem : container.listBlobs()) {
if (blobItem instanceof CloudBlob) {
// Download the item and save it to a file with the same name.
CloudBlob blob = (CloudBlob) blobItem;
if(blob.getName().equalsIgnoreCase(configFileName)) {
blob.download(new java.io.FileOutputStream(HashOutConfig.ROOT_PATH + "/" + configFileName));
return HashOutConfig.ROOT_PATH + "/" + configFileName;
}
}
}
return null;
}
catch (Throwable th)
{
// Output the stack trace.
th.printStackTrace();
Log.e(TAG,"Exception==>>>",th);
Log.e(TAG,"Error while dowloading file from blob storage"+th.getMessage().toString());
return null;
}
10-06 12:16:26.312 4491-5605/com.microsoft.hashout W/System.err: java.util.NoSuchElementException: An error occurred while enumerating the result, check the original exception for details.
10-06 12:16:26.312 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:113)
10-06 12:16:26.313 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.hashout.task.DownloadFromBlobStorage.downloadFromAzureBlobStorage(DownloadFromBlobStorage.java:68)
10-06 12:16:26.313 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.hashout.task.DownloadFromBlobStorage.doInBackground(DownloadFromBlobStorage.java:38)
10-06 12:16:26.313 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.hashout.task.DownloadFromBlobStorage.doInBackground(DownloadFromBlobStorage.java:20)
10-06 12:16:26.317 4491-5605/com.microsoft.hashout W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
10-06 12:16:26.317 4491-5605/com.microsoft.hashout W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
10-06 12:16:26.317 4491-5605/com.microsoft.hashout W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
10-06 12:16:26.318 4491-5605/com.microsoft.hashout W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
10-06 12:16:26.318 4491-5605/com.microsoft.hashout W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
10-06 12:16:26.318 4491-5605/com.microsoft.hashout W/System.err: at java.lang.Thread.run(Thread.java:818)
10-06 12:16:26.318 4491-5605/com.microsoft.hashout W/System.err: 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.
10-06 12:16:26.319 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:305)
10-06 12:16:26.319 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:175)
10-06 12:16:26.319 4491-5605/com.microsoft.hashout W/System.err: at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)
10-06 12:16:26.320 4491-5605/com.microsoft.hashout W/System.err: ... 9 more
質問は何ですか?コードの一部とエラーログをコピーしました。エラーは明らかに認証に失敗した –