Skip to content

Commit c083016

Browse files
authored
remove StringUtils of lang3 (#104)
* remove StringUtils of lang3 * change version to v8.2.3 and release --------- Co-authored-by: alantong(佟明达) <[email protected]>
1 parent 0f2ac71 commit c083016

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qcloud.cos</groupId>
88
<artifactId>hadoop-cos</artifactId>
9-
<version>8.2.2</version>
9+
<version>8.2.3</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Apache Hadoop Tencent Cloud COS Support</name>

src/main/java/org/apache/hadoop/fs/CosFileSystem.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void initialize(URI uri, Configuration originalConf) throws IOException {
127127

128128
// judge normal impl first, skip the class nodef error when only use normal bucket
129129
if (this.actualImplFS instanceof CosNFileSystem) {
130-
this.nativeStore.isPosixBucket(true);
130+
this.nativeStore.setPosixBucket(true);
131131
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
132132
.withPosixBucket(isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
133133
} else if (this.actualImplFS instanceof CHDFSHadoopFileSystemAdapter) {
@@ -145,7 +145,7 @@ public void initialize(URI uri, Configuration originalConf) throws IOException {
145145
}
146146
} else { // normal cos hadoop file system implements
147147
this.actualImplFS = getActualFileSystemByClassName("org.apache.hadoop.fs.CosNFileSystem");
148-
this.nativeStore.isPosixBucket(false);
148+
this.nativeStore.setPosixBucket(false);
149149
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
150150
.withPosixBucket(this.isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
151151
}

src/main/java/org/apache/hadoop/fs/CosNUtils.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.apache.hadoop.fs;
22

33
import com.qcloud.cos.auth.COSCredentialsProvider;
4-
import org.apache.commons.lang3.StringUtils;
54
import com.google.common.base.Preconditions;
65
import org.apache.hadoop.conf.Configuration;
76
import org.apache.hadoop.fs.auth.*;
@@ -279,8 +278,9 @@ public static void buildAndSaveAsymKeyPair(String pubKeyPath, String priKeyPath)
279278
}
280279

281280
public static Configuration propagateBucketOptions(Configuration source, String bucket) {
282-
Preconditions.checkArgument(StringUtils.isNotEmpty(bucket),
283-
"bucket is null or empty");
281+
if (null == bucket || 0 == bucket.length()) {
282+
Preconditions.checkArgument(false, "bucket is null or empty");
283+
}
284284
final String bucketPrefix = FS_COSN_BUCKET_PREFIX + bucket +'.';
285285
LOG.debug("propagating entries under {}", bucketPrefix);
286286
final Configuration dest = new Configuration(source);
@@ -301,11 +301,9 @@ public static Configuration propagateBucketOptions(Configuration source, String
301301
// propagate the value, building a new origin field.
302302
// to track overwrites, the generic key is overwritten even if
303303
// already matches the new one.
304-
String origin = "[" + StringUtils.join(
305-
source.getPropertySources(key), ", ") +"]";
306304
final String generic = FS_COSN_PREFIX + stripped;
307-
LOG.debug("Updating {} from {}", generic, origin);
308-
dest.set(generic, value, key + " via " + origin);
305+
LOG.debug("Updating {} from origin", generic);
306+
dest.set(generic, value, key);
309307
}
310308
}
311309
return dest;

src/main/java/org/apache/hadoop/fs/CosNativeFileSystemStore.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ private void preClose() {
14931493
}
14941494

14951495
@Override
1496-
public void isPosixBucket(boolean isPosixBucket) {
1496+
public void setPosixBucket(boolean isPosixBucket) {
14971497
this.isPosixBucket = isPosixBucket;
14981498
}
14991499

@@ -1545,6 +1545,11 @@ public CosNPartListing listParts(String key, String uploadId) throws IOException
15451545
return new CosNPartListing(partSummaries);
15461546
}
15471547

1548+
@Override
1549+
public boolean isPosixBucket() {
1550+
return this.isPosixBucket;
1551+
}
1552+
15481553
private PartETag isPartExist(CosNPartListing partListing, int partNum, long partSize) {
15491554
PartETag ret = null;
15501555
if (null == partListing) {

src/main/java/org/apache/hadoop/fs/NativeFileSystemStore.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ CosNPartialListing list(String prefix, int maxListingLength,
140140
* if you use the CosNFileSystem gateway mode,
141141
* must set native store to posix process
142142
*/
143-
void isPosixBucket(boolean isPosixBucket);
143+
void setPosixBucket(boolean isPosixBucket);
144+
145+
boolean isPosixBucket();
144146

145147
RangerCredentialsClient getRangerCredentialsClient();
146148

0 commit comments

Comments
 (0)