DataLakeFileSystemClient listPath, NumberFormatException when using String

AUDIER Maxime 0 Reputation points
2023-03-07T13:24:41.86+00:00

Hello,

I am new to this and trying to list all files in a container recursively.

ListPathsOptions options = new ListPathsOptions();
options.setRecursive(true);
for (PathItem pathItem :fileSystemClient.listPaths(options, null)){ ... }

Doing so result in this error :
java.lang.NumberFormatException: For input string: "Thu, 14 Oct 2021 17:22:10 GMT"

I have tried to manually go through each directory and found the possible cause :

String dir = "my-directory-name/01/2021/10/14/17";
DataLakeDirectoryClient directory = fileSystemClient.getDirectoryClient(dir);

This code will generate the same error.

It seems like '2021/10/14/17' is interpreted as a date causing the method to fail.

The 'yyyy/mm/dd/hh' representation is by design so I cannot change the names easily for now,
it may be possible in the future or if the error cannot be resolved with other methods.

Edit / Update :
Got access to the container and did some test, the issue happen even if the 'blob object' is at the root.
The input string math the creation date of the blob object.

String dir = "test-directory";
DataLakeDirectoryClient directory = fileSystemClient.getDirectoryClient(dir);
for (PathItem pathItem : directory.listPaths()) {//Error happen here
	System.out.println(pathItem.getName());
}

I tried to use https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-directory-file-acl-java code (List directory contents) -> Same error

Thank you in advance for your help.

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,340 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AUDIER Maxime 0 Reputation points
    2023-03-23T07:21:27.9633333+00:00

    Hello,
    I have test the code without success (using a timeout of 1minutes).

    Exception in thread "main" java.lang.NumberFormatException: For input string: "Thu, 09 Mar 2023 15:18:38 GMT"
    	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
    	at java.base/java.lang.Long.parseLong(Long.java:707)
    
    

    I am not sure if you saw the edit to the original post, but I have found out that the date in the error match the creation date of the file (blob object) that should be printed.

    I got access to the container and now working with a simple directory with file inside to test
    User's image

    0 comments No comments