Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hdds.utils.db.managed.ManagedDBOptions;
import org.eclipse.jetty.util.StringUtil;
import org.rocksdb.ColumnFamilyDescriptor;
import org.rocksdb.Env;
import org.rocksdb.OptionsUtil;
Expand Down Expand Up @@ -55,11 +55,11 @@ public static File getConfigLocation() {

// Make testing easy.
// If there is No Env. defined, let us try to read the JVM property
if (StringUtil.isBlank(path)) {
if (StringUtils.isBlank(path)) {
path = System.getProperty(CONFIG_DIR);
}

if (StringUtil.isBlank(path)) {
if (StringUtils.isBlank(path)) {
LOG.debug("Unable to find the configuration directory. "
+ "Please make sure that " + CONFIG_DIR + " is setup correctly.");
return null;
Expand Down Expand Up @@ -118,7 +118,7 @@ public static ManagedDBOptions readFromFile(String dbFileName,
ManagedDBOptions options = null;
File configLocation = getConfigLocation();
if (configLocation != null &&
StringUtil.isNotBlank(configLocation.toString())) {
StringUtils.isNotBlank(configLocation.toString())) {
Path optionsFile = Paths.get(configLocation.toString(),
getOptionsFileNameFromDB(dbFileName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hdds.HddsConfigKeys;
import org.apache.hadoop.hdds.StringUtils;
import org.apache.hadoop.hdds.conf.ConfigurationSource;
import org.apache.hadoop.hdds.conf.StorageUnit;
import org.apache.hadoop.hdds.utils.db.managed.ManagedColumnFamilyOptions;
Expand All @@ -51,7 +51,6 @@
import org.apache.hadoop.hdds.utils.db.managed.ManagedRocksDB;
import org.apache.hadoop.hdds.utils.db.managed.ManagedStatistics;
import org.apache.hadoop.hdds.utils.db.managed.ManagedWriteOptions;
import org.eclipse.jetty.util.StringUtil;
import org.rocksdb.ColumnFamilyDescriptor;
import org.rocksdb.InfoLogLevel;
import org.rocksdb.StatsLevel;
Expand All @@ -69,7 +68,7 @@ public final class DBStoreBuilder {
LoggerFactory.getLogger(ManagedRocksDB.ORIGINAL_CLASS);

public static final String DEFAULT_COLUMN_FAMILY_NAME =
StringUtils.bytes2String(DEFAULT_COLUMN_FAMILY);
org.apache.hadoop.hdds.StringUtils.bytes2String(DEFAULT_COLUMN_FAMILY);

// DB PKIProfile used by ROCKDB instances.
public static final DBProfile HDDS_DEFAULT_DB_PROFILE = DBProfile.DISK;
Expand Down Expand Up @@ -202,7 +201,7 @@ private void setDBOptionsProps(ManagedDBOptions dbOptions) {
* @return DBStore
*/
public RDBStore build() throws IOException {
if (StringUtil.isBlank(dbname) || (dbPath == null)) {
if (StringUtils.isBlank(dbname) || (dbPath == null)) {
LOG.error("Required Parameter missing.");
throw new IOException("Required parameter is missing. Please make sure "
+ "Path and DB name is provided.");
Expand Down Expand Up @@ -421,7 +420,7 @@ private ManagedDBOptions getDBOptionsFromFile(

List<ColumnFamilyDescriptor> columnFamilyDescriptors = new ArrayList<>();

if (StringUtil.isNotBlank(dbname)) {
if (StringUtils.isNotBlank(dbname)) {
for (TableConfig tc : tableConfigs) {
columnFamilyDescriptors.add(tc.getDescriptor());
}
Expand Down Expand Up @@ -450,7 +449,7 @@ private File getDBFile() throws IOException {
throw new IOException("A Path to for DB file is needed.");
}

if (StringUtil.isBlank(dbname)) {
if (StringUtils.isBlank(dbname)) {
LOG.error("DBName is a required.");
throw new IOException("A valid DB name is required.");
}
Expand Down
4 changes: 0 additions & 4 deletions hadoop-ozone/ozone-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
import org.apache.hadoop.util.Time;
import org.apache.ozone.compaction.log.CompactionLogEntry;
import org.apache.ratis.util.ExitUtils;
import org.eclipse.jetty.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -569,7 +568,7 @@ public String getOzoneKey(String volume, String bucket, String key) {
.append(OM_KEY_PREFIX).append(volume);
// TODO : Throw if the Bucket is null?
builder.append(OM_KEY_PREFIX).append(bucket);
if (StringUtil.isNotBlank(key)) {
if (StringUtils.isNotBlank(key)) {
builder.append(OM_KEY_PREFIX);
if (!key.equals(OM_KEY_PREFIX)) {
builder.append(key);
Expand Down Expand Up @@ -845,7 +844,7 @@ public List<OmBucketInfo> listBuckets(final String volumeName,

String startKey;
boolean skipStartKey = false;
if (StringUtil.isNotBlank(startBucket)) {
if (StringUtils.isNotBlank(startBucket)) {
// if the user has specified a start key, we need to seek to that key
// and avoid that key in the response set.
startKey = getBucketKey(volumeName, startBucket);
Expand All @@ -860,7 +859,7 @@ public List<OmBucketInfo> listBuckets(final String volumeName,
}

String seekPrefix;
if (StringUtil.isNotBlank(bucketPrefix)) {
if (StringUtils.isNotBlank(bucketPrefix)) {
seekPrefix = getBucketKey(volumeName, bucketPrefix);
} else {
seekPrefix = getVolumeKey(volumeName + OM_KEY_PREFIX);
Expand Down Expand Up @@ -1012,18 +1011,18 @@ public ListKeysResult listKeys(String volumeName, String bucketName,

String seekKey;
boolean skipStartKey = false;
if (StringUtil.isNotBlank(startKey)) {
if (StringUtils.isNotBlank(startKey)) {
// Seek to the specified key.
seekKey = getOzoneKey(volumeName, bucketName, startKey);
skipStartKey = true;
} else {
// This allows us to seek directly to the first key with the right prefix.
seekKey = getOzoneKey(volumeName, bucketName,
StringUtil.isNotBlank(keyPrefix) ? keyPrefix : OM_KEY_PREFIX);
StringUtils.isNotBlank(keyPrefix) ? keyPrefix : OM_KEY_PREFIX);
}

String seekPrefix;
if (StringUtil.isNotBlank(keyPrefix)) {
if (StringUtils.isNotBlank(keyPrefix)) {
seekPrefix = getOzoneKey(volumeName, bucketName, keyPrefix);
} else {
seekPrefix = getBucketKey(volumeName, bucketName) + OM_KEY_PREFIX;
Expand Down Expand Up @@ -1162,20 +1161,20 @@ public ListSnapshotResponse listSnapshot(
}

String prefix;
if (StringUtil.isNotBlank(snapshotPrefix)) {
if (StringUtils.isNotBlank(snapshotPrefix)) {
prefix = getOzoneKey(volumeName, bucketName, snapshotPrefix);
} else {
prefix = getBucketKey(volumeName, bucketName + OM_KEY_PREFIX);
}

String seek;
if (StringUtil.isNotBlank(prevSnapshot)) {
if (StringUtils.isNotBlank(prevSnapshot)) {
// Seek to the specified snapshot.
seek = getOzoneKey(volumeName, bucketName, prevSnapshot);
} else {
// This allows us to seek directly to the first key with the right prefix.
seek = getOzoneKey(volumeName, bucketName,
StringUtil.isNotBlank(snapshotPrefix) ? snapshotPrefix : OM_KEY_PREFIX);
StringUtils.isNotBlank(snapshotPrefix) ? snapshotPrefix : OM_KEY_PREFIX);
}

List<SnapshotInfo> snapshotInfos = Lists.newArrayList();
Expand Down Expand Up @@ -1208,7 +1207,7 @@ public ListSnapshotResponse listSnapshot(
public List<OmVolumeArgs> listVolumes(String userName,
String prefix, String startKey, int maxKeys) throws IOException {

if (StringUtil.isBlank(userName)) {
if (StringUtils.isBlank(userName)) {
// null userName represents listing all volumes in cluster.
return listAllVolumes(prefix, startKey, maxKeys);
}
Expand Down Expand Up @@ -1518,9 +1517,9 @@ public List<OmMultipartUpload> getMultipartUploadKeys(
String prefixKey =
OmMultipartUpload.getDbKey(volumeName, bucketName, prefix);

if (StringUtil.isNotBlank(keyMarker)) {
if (StringUtils.isNotBlank(keyMarker)) {
prefix = keyMarker;
if (StringUtil.isNotBlank(uploadIdMarker)) {
if (StringUtils.isNotBlank(uploadIdMarker)) {
prefix = prefix + OM_KEY_PREFIX + uploadIdMarker;
}
}
Expand Down
4 changes: 0 additions & 4 deletions hadoop-ozone/recon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>guice-bridge</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.inject.Singleton;
import org.apache.commons.compress.utils.Lists;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.utils.db.DBStore;
import org.apache.hadoop.hdds.utils.db.DBStoreBuilder;
Expand All @@ -45,7 +46,6 @@
import org.apache.hadoop.ozone.om.helpers.OmVolumeArgs;
import org.apache.hadoop.ozone.recon.ReconUtils;
import org.apache.hadoop.ozone.recon.api.types.KeyEntityInfoProtoWrapper;
import org.eclipse.jetty.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -241,7 +241,7 @@ public List<OmBucketInfo> listBucketsUnderVolume(final String volumeName,

String startKey;
boolean skipStartKey = false;
if (StringUtil.isNotBlank(startBucket)) {
if (StringUtils.isNotBlank(startBucket)) {
startKey = getBucketKey(volumeName, startBucket);
skipStartKey = true;
} else {
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,13 @@
<excludedSourceRoot>${project.build.directory}/generated-sources/protobuf/java</excludedSourceRoot>
</excludedSourceRoots>
</restrictImports>
<restrictImports>
<includeTestCode>true</includeTestCode>
<reason>Use similar class from Apache Commons Lang</reason>
<bannedImports>
<bannedImport>org.eclipse.jetty.util.StringUtil</bannedImport>
</bannedImports>
</restrictImports>
</rules>
</configuration>
</execution>
Expand Down