Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correct v2 listing of more than 1000 objects #580

Merged
merged 1 commit into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/main/java/io/minio/MinioClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@ private synchronized void populate() {
}

String continuationToken = null;
if (this.listBucketResult != null && delimiter != null) {
if (this.listBucketResult != null) {
continuationToken = listBucketResult.nextContinuationToken();
}

Expand Down
37 changes: 36 additions & 1 deletion functional/FunctionalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,43 @@ public static void listObject_test4() throws Exception {
}

/**
* Test: listObjects(bucketName, final String prefix, final boolean recursive, final boolean useVersion1).
* Test: recursive: listObjects(bucketName, final String prefix, final boolean recursive).
*/
public static void listObject_test5() throws Exception {
int i;
int objCount = 1050;

System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix"
+ ", final boolean recursive)");
String[] objectNames = new String[objCount];

String baseFilename = createFile(1);
for (i = 0; i < objCount; i++) {
objectNames[i] = baseFilename + "-" + i;
client.putObject(bucketName, objectNames[i], baseFilename);
}
Files.delete(Paths.get(baseFilename));

i = 0;
for (Result<?> r : client.listObjects(bucketName, "minio", true)) {
ignore(i++, r.get());
}

// Check the number of uploaded objects
if (i != objCount) {
throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: "
+ objCount + ", found: " + i);
}

for (i = 0; i < objCount; i++) {
client.removeObject(bucketName, objectNames[i]);
}
}

/**
* Test: listObjects(bucketName, final String prefix, final boolean recursive, final boolean useVersion1).
*/
public static void listObject_test6() throws Exception {
int i;
System.out.println("Test: listObjects(final String bucketName, final String prefix, final boolean recursive,"
+ " final boolean useVersion1)");
Expand Down Expand Up @@ -1544,6 +1578,7 @@ public static void runTests() throws Exception {
listObject_test3();
listObject_test4();
listObject_test5();
listObject_test6();

removeObject_test1();
removeObject_test2();
Expand Down