Skip to content

Commit 41bbea0

Browse files
committed
Handle null.
1 parent cbb07d8 commit 41bbea0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hub/src/main/java/cloud/katta/protocols/hub/HubStorageLocationService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import ch.cyberduck.core.Path;
88
import ch.cyberduck.core.features.Location;
99

10+
import org.apache.commons.lang3.StringUtils;
1011
import org.apache.logging.log4j.LogManager;
1112
import org.apache.logging.log4j.Logger;
1213

@@ -74,7 +75,7 @@ public static final class StorageLocation extends Name {
7475
* @param storageProfileName Description
7576
*/
7677
public StorageLocation(final String storageProfileId, final String region, final String storageProfileName) {
77-
super(String.format("%s,%s", storageProfileId, region));
78+
super(String.format("%s,%s", storageProfileId, null == region ? StringUtils.EMPTY : region));
7879
this.storageProfileId = storageProfileId;
7980
this.region = region;
8081
this.storageProfileName = storageProfileName;
@@ -108,7 +109,7 @@ public static StorageLocation fromIdentifier(final String identifier) {
108109
if(parts.length != 2) {
109110
return new StorageLocation(identifier, null, null);
110111
}
111-
return new StorageLocation(parts[0], parts[1], null);
112+
return new StorageLocation(StringUtils.isBlank(parts[0]) ? null : parts[0], StringUtils.isBlank(parts[1]) ? null : parts[1], null);
112113
}
113114
}
114115
}

0 commit comments

Comments
 (0)