Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.hadoop.ozone.s3.commontypes;

import jakarta.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;

/**
* A converter to encode string if needed.
Expand All @@ -41,12 +40,12 @@ public String getName() {
}

/**
* Create a EncodingTypeObject Object, if the parameter name is null.
* Create a EncodingTypeObject Object, if the parameter name is not null.
* @return If name is null return null else return a EncodingTypeObject object
*/
@Nullable public static EncodingTypeObject createNullable(
@Nullable String name, @Nullable String encodingType) {
if (StringUtils.isEmpty(name)) {
if (name == null) {
return null;
}
return new EncodingTypeObject(name, encodingType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public void testEncodeResult() throws Exception {
.marshal(EncodingTypeObject.createNullable("a b c/", null)));
assertEquals("a+b+c/", getAdapter()
.marshal(EncodingTypeObject.createNullable("a+b+c/", null)));

assertEquals("", getAdapter()
.marshal(EncodingTypeObject.createNullable("", null)));
assertEquals("", getAdapter()
.marshal(EncodingTypeObject.createNullable("", ENCODING_TYPE)));
}

private XmlAdapter<String, EncodingTypeObject> getAdapter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public void listRoot() throws OS3Exception, IOException {
endpoint.queryParamsForTest().set(QueryParams.PREFIX, "");
ListObjectResponse getBucketResponse = (ListObjectResponse) endpoint.get("b1").getEntity();

assertNotNull(getBucketResponse.getPrefix());
assertEquals("", getBucketResponse.getPrefix().getName());

assertEquals(1, getBucketResponse.getCommonPrefixes().size());
assertEquals("dir1/",
getBucketResponse.getCommonPrefixes().get(0).getPrefix().getName());
Expand Down