Comments (2)
@ibrahimrabab could you please follow up with @ARJEnkotec;
/cc @alzimmermsft
from azure-sdk-for-java.
I have worked a bit on it and have made a different project, to show what it can and can't do. I found that the .listBlobs for loop never returns anything or exits even though there are blobs in the container.
I can succesfully download a blob client item, but if i try to get the last modified parameter of that blob client i get an error: "Wrong number of arguments; expected 1, got 0".
package com.example.azureblobstoragepropertiestest;
import android.app.Activity;
import android.os.Bundle;
import android.os.Environment;
import com.azure.storage.blob.BlobServiceClientBuilder;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.models.BlobItem;
import com.azure.storage.blob.BlobClient;
import java.time.OffsetDateTime;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
public class MainActivity extends Activity {
private static final String connectStr = "XXXXX";
private static final String containerName = "XXXXX";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BlobContainerClient containerClient = new BlobServiceClientBuilder()
.connectionString(connectStr)
.buildClient()
.getBlobContainerClient(containerName);
try {
String downloadFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getPath();
BlobClient blobClientDownload = containerClient.getBlobClient("blobtest.txt");
String filePath = downloadFolder + "/" + blobClientDownload.getBlobName();
blobClientDownload.downloadToFile(filePath, true);
System.out.println("Azure blob file downloaded successfully!");
String fileContent = new String(Files.readAllBytes(Paths.get(filePath)), StandardCharsets.UTF_8);
System.out.println("File Content:\n" + fileContent);
try {
OffsetDateTime lastModifiedDownload = blobClientDownload.getProperties().getLastModified();
System.out.println("Last modified date downloaded blob: " + lastModifiedDownload);
} catch (Exception e) {
System.err.println("Get last modified of downloaded blob error: " + e.getMessage());
}
System.out.println("Blobs in the container:");
for (BlobItem blobItem : containerClient.listBlobs()) {
BlobClient blobClient = containerClient.getBlobClient(blobItem.getName());
OffsetDateTime lastModified = blobClient.getProperties().getLastModified();
System.out.println("Blob: " + blobItem.getName() + ", Last modified: " + lastModified);
}
System.out.println("No more blobs in the container");
} catch (Exception e) {
System.err.println("Azure storage error: " + e.getMessage());
}
}
}
Output log
2024-03-04 13:26:34.738 19528-19528 System.err com...zureblobstoragepropertiestest W SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
2024-03-04 13:26:34.738 19528-19528 System.err com...zureblobstoragepropertiestest W SLF4J: Defaulting to no-operation (NOP) logger implementation
2024-03-04 13:26:34.738 19528-19528 System.err com...zureblobstoragepropertiestest W SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
2024-03-04 13:26:34.752 19528-19528 epropertiestest com...zureblobstoragepropertiestest W Accessing hidden method Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;)V (max-target-o, reflection, denied)
2024-03-04 13:26:34.865 19528-19528 epropertiestest com...zureblobstoragepropertiestest W Accessing hidden method Lsun/misc/VM;->maxDirectMemory()J (unsupported, reflection, allowed)
2024-03-04 13:26:34.867 19528-19528 PlatformDependent com...zureblobstoragepropertiestest I Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
2024-03-04 13:26:34.968 19528-19528 epropertiestest com...zureblobstoragepropertiestest W type=1400 audit(0.0:3344): avc: denied { read } for name="somaxconn" dev="proc" ino=195365 scontext=u:r:untrusted_app:s0:c194,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=com.example.azureblobstoragepropertiestest
2024-03-04 13:26:34.989 19528-19528 epropertiestest com...zureblobstoragepropertiestest E No implementation found for int io.netty.internal.tcnative.Library.aprMajorVersion() (tried Java_io_netty_internal_tcnative_Library_aprMajorVersion and Java_io_netty_internal_tcnative_Library_aprMajorVersion__)
2024-03-04 13:26:35.011 19528-19528 epropertiestest com...zureblobstoragepropertiestest E No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData() (tried Java_io_netty_channel_epoll_Native_offsetofEpollData and Java_io_netty_channel_epoll_Native_offsetofEpollData__)
2024-03-04 13:26:35.015 19528-19528 epropertiestest com...zureblobstoragepropertiestest E No implementation found for int io.netty.channel.kqueue.Native.sizeofKEvent() (tried Java_io_netty_channel_kqueue_Native_sizeofKEvent and Java_io_netty_channel_kqueue_Native_sizeofKEvent__)
2024-03-04 13:26:35.022 19528-19528 epropertiestest com...zureblobstoragepropertiestest W Accessing hidden field Lsun/nio/ch/SelectorImpl;->selectedKeys:Ljava/util/Set; (unsupported, reflection, allowed)
2024-03-04 13:26:35.022 19528-19528 epropertiestest com...zureblobstoragepropertiestest W Accessing hidden field Lsun/nio/ch/SelectorImpl;->publicSelectedKeys:Ljava/util/Set; (unsupported, reflection, allowed)
2024-03-04 13:26:35.029 19528-19528 TrafficStats com...zureblobstoragepropertiestest D tagSocket(130) with statsTag=0xffffffff, statsUid=-1
2024-03-04 13:26:35.031 19528-19528 Compatibil...geReporter com...zureblobstoragepropertiestest D Compat change id reported: 170188668; UID 10194; state: ENABLED
2024-03-04 13:26:35.033 19528-19528 MacAddressUtil com...zureblobstoragepropertiestest W Failed to find a usable hardware address from the network interfaces; using random bytes: 6b:dd:5f:a8:87:5b:5e:0c
2024-03-04 13:26:35.346 19528-19528 System.out com...zureblobstoragepropertiestest I Azure blob file downloaded successfully!
2024-03-04 13:26:35.352 19528-19528 System.out com...zureblobstoragepropertiestest I File Content:
2024-03-04 13:26:35.352 19528-19528 System.out com...zureblobstoragepropertiestest I This is a test blob uploaded to azure storage, to check if they can be downloaded.
2024-03-04 13:26:35.393 19528-19528 System.err com...zureblobstoragepropertiestest W Get last modified of downloaded blob error: Wrong number of arguments; expected 1, got 0
2024-03-04 13:26:35.393 19528-19528 System.out com...zureblobstoragepropertiestest I Blobs in the container:
2024-03-04 13:26:54.920 19528-19538 epropertiestest com...zureblobstoragepropertiestest I Background concurrent copying GC freed 160645(16MB) AllocSpace objects, 16(336KB) LOS objects, 49% free, 9573KB/18MB, paused 197us,39us total 114.732ms
2024-03-04 13:26:54.923 19528-19540 System com...zureblobstoragepropertiestest W A resource failed to call close.
2024-03-04 13:27:38.643 19528-19542 epropertiestest com...zureblobstoragepropertiestest I Explicit concurrent copying GC freed 805(67KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 9574KB/18MB, paused 61us,40us total 70.543ms
here is a snippet from the azure portal, showing that the calls do go through. Azure activity.
from azure-sdk-for-java.
Related Issues (20)
- [QUERY] OAuth Logging noise HOT 2
- [BUG] Postgresql passwordless mode does not work with Flyway and server certificate verification HOT 5
- [Kafka V2]Avro/Json/ProtoBuf support
- Add support for non-String type expandable enums
- [OpenAI] Create a sample to show how to use the external tokenizer to compute tokens in Chat Completion Streaming API
- [BUG]ReturnBarrierRequestOnceQuorumHasBeenRead
- Videos bigger than 256MB are not uploading to Blob Storage using BlobAsyncClient HOT 10
- [BUG] sessionIdleTimeout property is missing in the Spring Cloud binder HOT 2
- [FEATURE REQ] Improve documentation for max-concurrent-calls property HOT 2
- [BUG] Java SDK - Private DNS - Delete virtual link doesn't work HOT 1
- mgmt core, add hybrid serialization model(baseclass stream-style-serialization, subclass jackson)
- [BUG] spring-cloud-azure-starter-servicebus-jms - connection to Azure Service Bus lost for 10 minutes every 24h due to Expired Token (problem with token refresh?) HOT 3
- More execution time to upsert records while using spring-data-cosmos saveAll function after moving to 5.8.0 version of spring-data-cosmos. HOT 1
- [QUERY] In azure-spring-data-cosmos latest version How to enable indexMetrics? HOT 11
- I received an email βUpdate your code to use the latest Azure OpenAl Service preview API by 2 April 2024β HOT 5
- java.lang.NoClassDefFoundError: Could not initialize class com.azure.identity.implementation.IdentityClient HOT 3
- [BUG]`DataLakeFileClient.renameWithResponse` operation on Azure storage occasionally fails with `500` HOT 4
- [BUG] "No registered resource provider found for location 'eastus2' and API version '2018-01-01' for type 'storageAccounts/blobServices' HOT 5
- [Monitor Query] Add sovereign cloud support for batch metrics query API
- [QUERY] Is there a reactive alternative to `new DefaultAzureCredentialBuilder().build()` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-java.