Skip to content

Commit

Permalink
remove StringUtils of lang3 (#104)
Browse files Browse the repository at this point in the history
* remove StringUtils of lang3

* change version to v8.2.3 and release

---------

Co-authored-by: alantong(佟明达) <[email protected]>
  • Loading branch information
vintmd and vintmd authored Feb 2, 2023
1 parent 0f2ac71 commit c083016
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.qcloud.cos</groupId>
<artifactId>hadoop-cos</artifactId>
<version>8.2.2</version>
<version>8.2.3</version>
<packaging>jar</packaging>

<name>Apache Hadoop Tencent Cloud COS Support</name>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/apache/hadoop/fs/CosFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void initialize(URI uri, Configuration originalConf) throws IOException {

// judge normal impl first, skip the class nodef error when only use normal bucket
if (this.actualImplFS instanceof CosNFileSystem) {
this.nativeStore.isPosixBucket(true);
this.nativeStore.setPosixBucket(true);
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
.withPosixBucket(isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
} else if (this.actualImplFS instanceof CHDFSHadoopFileSystemAdapter) {
Expand All @@ -145,7 +145,7 @@ public void initialize(URI uri, Configuration originalConf) throws IOException {
}
} else { // normal cos hadoop file system implements
this.actualImplFS = getActualFileSystemByClassName("org.apache.hadoop.fs.CosNFileSystem");
this.nativeStore.isPosixBucket(false);
this.nativeStore.setPosixBucket(false);
((CosNFileSystem) this.actualImplFS).withStore(this.nativeStore).withBucket(bucket)
.withPosixBucket(this.isPosixFSStore).withRangerCredentialsClient(rangerCredentialsClient);
}
Expand Down
12 changes: 5 additions & 7 deletions src/main/java/org/apache/hadoop/fs/CosNUtils.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.apache.hadoop.fs;

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

public static Configuration propagateBucketOptions(Configuration source, String bucket) {
Preconditions.checkArgument(StringUtils.isNotEmpty(bucket),
"bucket is null or empty");
if (null == bucket || 0 == bucket.length()) {
Preconditions.checkArgument(false, "bucket is null or empty");
}
final String bucketPrefix = FS_COSN_BUCKET_PREFIX + bucket +'.';
LOG.debug("propagating entries under {}", bucketPrefix);
final Configuration dest = new Configuration(source);
Expand All @@ -301,11 +301,9 @@ public static Configuration propagateBucketOptions(Configuration source, String
// propagate the value, building a new origin field.
// to track overwrites, the generic key is overwritten even if
// already matches the new one.
String origin = "[" + StringUtils.join(
source.getPropertySources(key), ", ") +"]";
final String generic = FS_COSN_PREFIX + stripped;
LOG.debug("Updating {} from {}", generic, origin);
dest.set(generic, value, key + " via " + origin);
LOG.debug("Updating {} from origin", generic);
dest.set(generic, value, key);
}
}
return dest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ private void preClose() {
}

@Override
public void isPosixBucket(boolean isPosixBucket) {
public void setPosixBucket(boolean isPosixBucket) {
this.isPosixBucket = isPosixBucket;
}

Expand Down Expand Up @@ -1545,6 +1545,11 @@ public CosNPartListing listParts(String key, String uploadId) throws IOException
return new CosNPartListing(partSummaries);
}

@Override
public boolean isPosixBucket() {
return this.isPosixBucket;
}

private PartETag isPartExist(CosNPartListing partListing, int partNum, long partSize) {
PartETag ret = null;
if (null == partListing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ CosNPartialListing list(String prefix, int maxListingLength,
* if you use the CosNFileSystem gateway mode,
* must set native store to posix process
*/
void isPosixBucket(boolean isPosixBucket);
void setPosixBucket(boolean isPosixBucket);

boolean isPosixBucket();

RangerCredentialsClient getRangerCredentialsClient();

Expand Down

0 comments on commit c083016

Please sign in to comment.