This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c92032bcb HDDS-12201. Remove unused, dead code in httpfsgateway 
(#7814)
2c92032bcb is described below

commit 2c92032bcb4653ff94a20b2d2f462febd72f955c
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Mon Feb 10 12:17:17 2025 +0100

    HDDS-12201. Remove unused, dead code in httpfsgateway (#7814)
---
 .../ozone/fs/http/server/HttpFSServerWebApp.java   |  15 -
 .../org/apache/ozone/fs/http/server/JsonUtil.java  | 398 ---------------------
 .../http/server/metrics/HttpFSServerMetrics.java   |  12 -
 .../apache/ozone/hdfs/web/WebHdfsConstants.java    |  14 -
 .../java/org/apache/ozone/lib/lang/XException.java |  11 -
 .../org/apache/ozone/lib/servlet/ServerWebApp.java |  46 ---
 .../main/java/org/apache/ozone/lib/util/Check.java | 150 --------
 .../java/org/apache/ozone/lib/wsrs/ByteParam.java  |  42 ---
 .../apache/ozone/lib/wsrs/InputStreamEntity.java   |   4 -
 9 files changed, 692 deletions(-)

diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/HttpFSServerWebApp.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/HttpFSServerWebApp.java
index 6d0acc5e88..0f0f4f4254 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/HttpFSServerWebApp.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/HttpFSServerWebApp.java
@@ -74,21 +74,6 @@ public HttpFSServerWebApp() throws IOException {
     super(NAME);
   }
 
-  /**
-   * Constructor used for testing purposes.
-   */
-  public HttpFSServerWebApp(String homeDir, String configDir, String logDir,
-                               String tempDir, Configuration config) {
-    super(NAME, homeDir, configDir, logDir, tempDir, config);
-  }
-
-  /**
-   * Constructor used for testing purposes.
-   */
-  public HttpFSServerWebApp(String homeDir, Configuration config) {
-    super(NAME, homeDir, config);
-  }
-
   /**
    * Initializes the HttpFSServer server, loads configuration and required
    * services.
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/JsonUtil.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/JsonUtil.java
index 75d66e1b51..a6eb197846 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/JsonUtil.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/JsonUtil.java
@@ -19,42 +19,17 @@
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 
-import org.apache.hadoop.fs.BlockLocation;
-import org.apache.hadoop.fs.ContentSummary;
-import org.apache.hadoop.fs.FileChecksum;
 import org.apache.hadoop.fs.FsServerDefaults;
-import org.apache.hadoop.fs.MD5MD5CRC32FileChecksum;
-import org.apache.hadoop.fs.QuotaUsage;
-import org.apache.hadoop.fs.StorageType;
-import org.apache.hadoop.fs.XAttr;
-import org.apache.hadoop.fs.XAttrCodec;
-import org.apache.hadoop.fs.permission.AclEntry;
-import org.apache.hadoop.fs.permission.AclStatus;
-import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hdfs.DFSUtilClient;
-import org.apache.hadoop.hdfs.XAttrHelper;
-import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
-import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
-import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
-import org.apache.hadoop.hdfs.protocol.HdfsConstants;
-import org.apache.hadoop.hdfs.protocol.LocatedBlock;
-import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
 import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport;
-import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.security.token.TokenIdentifier;
-import org.apache.hadoop.util.StringUtils;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
 /** JSON Utilities. */
 final class JsonUtil {
-  private static final Object[] EMPTY_OBJECT_ARRAY = {};
 
   private JsonUtil() {
   }
@@ -65,32 +40,6 @@ private JsonUtil() {
   // so we just need to worry about thread-safety.
   private static final ObjectMapper MAPPER = new ObjectMapper();
 
-  /** Convert a token object to a Json string. */
-  public static String toJsonString(final Token<?
-      extends TokenIdentifier> token) throws IOException {
-    return toJsonString(Token.class, toJsonMap(token));
-  }
-
-  private static Map<String, Object> toJsonMap(
-      final Token<? extends TokenIdentifier> token) throws IOException {
-    if (token == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("urlString", token.encodeToUrlString());
-    return m;
-  }
-
-  /** Convert an exception object to a Json string. */
-  public static String toJsonString(final Exception e) {
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("exception", e.getClass().getSimpleName());
-    m.put("message", e.getMessage());
-    m.put("javaClassName", e.getClass().getName());
-    return toJsonString(RemoteException.class, m);
-  }
-
   private static String toJsonString(final Class<?> clazz, final Object value) 
{
     return toJsonString(clazz.getSimpleName(), value);
   }
@@ -106,326 +55,10 @@ public static String toJsonString(final String key, final 
Object value) {
     return null;
   }
 
-  /** Convert a FsPermission object to a string. */
-  private static String toString(final FsPermission permission) {
-    return String.format("%o", permission.toShort());
-  }
-
-  /** Convert an ExtendedBlock to a Json map. */
-  private static Map<String, Object> toJsonMap(
-      final ExtendedBlock extendedblock) {
-    if (extendedblock == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("blockPoolId", extendedblock.getBlockPoolId());
-    m.put("blockId", extendedblock.getBlockId());
-    m.put("numBytes", extendedblock.getNumBytes());
-    m.put("generationStamp", extendedblock.getGenerationStamp());
-    return m;
-  }
-
-  /** Convert a DatanodeInfo to a Json map. */
-  static Map<String, Object> toJsonMap(final DatanodeInfo datanodeinfo) {
-    if (datanodeinfo == null) {
-      return null;
-    }
-
-    // TODO: Fix storageID
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("ipAddr", datanodeinfo.getIpAddr());
-    // 'name' is equivalent to ipAddr:xferPort. Older clients (1.x, 0.23.x) 
-    // expects this instead of the two fields.
-    m.put("name", datanodeinfo.getXferAddr());
-    m.put("hostName", datanodeinfo.getHostName());
-    m.put("storageID", datanodeinfo.getDatanodeUuid());
-    m.put("xferPort", datanodeinfo.getXferPort());
-    m.put("infoPort", datanodeinfo.getInfoPort());
-    m.put("infoSecurePort", datanodeinfo.getInfoSecurePort());
-    m.put("ipcPort", datanodeinfo.getIpcPort());
-
-    m.put("capacity", datanodeinfo.getCapacity());
-    m.put("dfsUsed", datanodeinfo.getDfsUsed());
-    m.put("remaining", datanodeinfo.getRemaining());
-    m.put("blockPoolUsed", datanodeinfo.getBlockPoolUsed());
-    m.put("cacheCapacity", datanodeinfo.getCacheCapacity());
-    m.put("cacheUsed", datanodeinfo.getCacheUsed());
-    m.put("lastUpdate", datanodeinfo.getLastUpdate());
-    m.put("lastUpdateMonotonic", datanodeinfo.getLastUpdateMonotonic());
-    m.put("xceiverCount", datanodeinfo.getXceiverCount());
-    m.put("networkLocation", datanodeinfo.getNetworkLocation());
-    m.put("adminState", datanodeinfo.getAdminState().name());
-    if (datanodeinfo.getUpgradeDomain() != null) {
-      m.put("upgradeDomain", datanodeinfo.getUpgradeDomain());
-    }
-    m.put("lastBlockReportTime", datanodeinfo.getLastBlockReportTime());
-    m.put("lastBlockReportMonotonic",
-        datanodeinfo.getLastBlockReportMonotonic());
-    return m;
-  }
-
-  /** Convert a DatanodeInfo[] to a Json array. */
-  private static Object[] toJsonArray(final DatanodeInfo[] array) {
-    if (array == null) {
-      return null;
-    } else if (array.length == 0) {
-      return EMPTY_OBJECT_ARRAY;
-    } else {
-      final Object[] a = new Object[array.length];
-      for (int i = 0; i < array.length; i++) {
-        a[i] = toJsonMap(array[i]);
-      }
-      return a;
-    }
-  }
-
-  /** Convert a StorageType[] to a Json array. */
-  private static Object[] toJsonArray(final StorageType[] array) {
-    if (array == null) {
-      return null;
-    } else if (array.length == 0) {
-      return EMPTY_OBJECT_ARRAY;
-    } else {
-      final Object[] a = new Object[array.length];
-      for (int i = 0; i < array.length; i++) {
-        a[i] = array[i];
-      }
-      return a;
-    }
-  }
-
-  /** Convert a LocatedBlock to a Json map. */
-  private static Map<String, Object> toJsonMap(
-      final LocatedBlock locatedblock) throws IOException {
-    if (locatedblock == null) {
-      return null;
-    }
- 
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("blockToken", toJsonMap(locatedblock.getBlockToken()));
-    m.put("isCorrupt", locatedblock.isCorrupt());
-    m.put("startOffset", locatedblock.getStartOffset());
-    m.put("block", toJsonMap(locatedblock.getBlock()));
-    m.put("storageTypes", toJsonArray(locatedblock.getStorageTypes()));
-    m.put("locations", toJsonArray(locatedblock.getLocations()));
-    m.put("cachedLocations", toJsonArray(locatedblock.getCachedLocations()));
-    return m;
-  }
-
-  /** Convert a LocatedBlock[] to a Json array. */
-  private static Object[] toJsonArray(
-      final List<LocatedBlock> array) throws IOException {
-    if (array == null) {
-      return null;
-    } else if (array.size() == 0) {
-      return EMPTY_OBJECT_ARRAY;
-    } else {
-      final Object[] a = new Object[array.size()];
-      for (int i = 0; i < array.size(); i++) {
-        a[i] = toJsonMap(array.get(i));
-      }
-      return a;
-    }
-  }
-
-  /** Convert LocatedBlocks to a Json string. */
-  public static String toJsonString(
-      final LocatedBlocks locatedblocks) throws IOException {
-    if (locatedblocks == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("fileLength", locatedblocks.getFileLength());
-    m.put("isUnderConstruction", locatedblocks.isUnderConstruction());
-
-    m.put("locatedBlocks", toJsonArray(locatedblocks.getLocatedBlocks()));
-    m.put("lastLocatedBlock", toJsonMap(locatedblocks.getLastLocatedBlock()));
-    m.put("isLastBlockComplete", locatedblocks.isLastBlockComplete());
-    return toJsonString(LocatedBlocks.class, m);
-  }
-
-  /** Convert a ContentSummary to a Json string. */
-  public static String toJsonString(final ContentSummary contentsummary) {
-    if (contentsummary == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("length", contentsummary.getLength());
-    m.put("fileCount", contentsummary.getFileCount());
-    m.put("directoryCount", contentsummary.getDirectoryCount());
-    m.put("ecPolicy", contentsummary.getErasureCodingPolicy());
-    // For ContentSummary we don't need this since we already have
-    // separate count for file and directory.
-    m.putAll(toJsonMap(contentsummary, false));
-    m.put("snapshotLength", contentsummary.getSnapshotLength());
-    m.put("snapshotFileCount", contentsummary.getSnapshotFileCount());
-    m.put("snapshotDirectoryCount",
-        contentsummary.getSnapshotDirectoryCount());
-    m.put("snapshotSpaceConsumed", contentsummary.getSnapshotSpaceConsumed());
-    return toJsonString(ContentSummary.class, m);
-  }
-
-  /** Convert a QuotaUsage to a JSON string. */
-  public static String toJsonString(final QuotaUsage quotaUsage) {
-    if (quotaUsage == null) {
-      return null;
-    }
-    return toJsonString(QuotaUsage.class, toJsonMap(quotaUsage, true));
-  }
-
-  private static Map<String, Object> toJsonMap(
-      final QuotaUsage quotaUsage, boolean includeFileAndDirectoryCount) {
-    final Map<String, Object> m = new TreeMap<>();
-    if (includeFileAndDirectoryCount) {
-      m.put("fileAndDirectoryCount", quotaUsage.getFileAndDirectoryCount());
-    }
-    m.put("quota", quotaUsage.getQuota());
-    m.put("spaceConsumed", quotaUsage.getSpaceConsumed());
-    m.put("spaceQuota", quotaUsage.getSpaceQuota());
-    final Map<String, Map<String, Long>> typeQuota = new TreeMap<>();
-    for (StorageType t : StorageType.getTypesSupportingQuota()) {
-      long tQuota = quotaUsage.getTypeQuota(t);
-      if (tQuota != HdfsConstants.QUOTA_RESET) {
-        Map<String, Long> type = typeQuota.get(t.toString());
-        if (type == null) {
-          type = new TreeMap<>();
-          typeQuota.put(t.toString(), type);
-        }
-        type.put("quota", quotaUsage.getTypeQuota(t));
-        type.put("consumed", quotaUsage.getTypeConsumed(t));
-      }
-    }
-    m.put("typeQuota", typeQuota);
-    return m;
-  }
-
-  /** Convert a MD5MD5CRC32FileChecksum to a Json string. */
-  public static String toJsonString(final MD5MD5CRC32FileChecksum checksum) {
-    if (checksum == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("algorithm", checksum.getAlgorithmName());
-    m.put("length", checksum.getLength());
-    m.put("bytes", StringUtils.byteToHexString(checksum.getBytes()));
-    return toJsonString(FileChecksum.class, m);
-  }
-
-  /** Convert a AclStatus object to a Json string. */
-  public static String toJsonString(final AclStatus status) {
-    if (status == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("owner", status.getOwner());
-    m.put("group", status.getGroup());
-    m.put("stickyBit", status.isStickyBit());
-
-    final List<String> stringEntries = new ArrayList<>();
-    for (AclEntry entry : status.getEntries()) {
-      stringEntries.add(entry.toStringStable());
-    }
-    m.put("entries", stringEntries);
-
-    FsPermission perm = status.getPermission();
-    if (perm != null) {
-      m.put("permission", toString(perm));
-    }
-    final Map<String, Map<String, Object>> finalMap =
-        new TreeMap<String, Map<String, Object>>();
-    finalMap.put(AclStatus.class.getSimpleName(), m);
-
-    try {
-      return MAPPER.writeValueAsString(finalMap);
-    } catch (IOException ignored) {
-    }
-    return null;
-  }
-
-  private static Map<String, Object> toJsonMap(final XAttr xAttr,
-      final XAttrCodec encoding) throws IOException {
-    if (xAttr == null) {
-      return null;
-    }
- 
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("name", XAttrHelper.getPrefixedName(xAttr));
-    m.put("value", xAttr.getValue() != null ?
-        XAttrCodec.encodeValue(xAttr.getValue(), encoding) : null);
-    return m;
-  }
-  
-  private static Object[] toJsonArray(final List<XAttr> array,
-      final XAttrCodec encoding) throws IOException {
-    if (array == null) {
-      return null;
-    } else if (array.size() == 0) {
-      return EMPTY_OBJECT_ARRAY;
-    } else {
-      final Object[] a = new Object[array.size()];
-      for (int i = 0; i < array.size(); i++) {
-        a[i] = toJsonMap(array.get(i), encoding);
-      }
-      return a;
-    }
-  }
-  
-  public static String toJsonString(final List<XAttr> xAttrs,
-      final XAttrCodec encoding) throws IOException {
-    final Map<String, Object> finalMap = new TreeMap<String, Object>();
-    finalMap.put("XAttrs", toJsonArray(xAttrs, encoding));
-    return MAPPER.writeValueAsString(finalMap);
-  }
-  
-  public static String toJsonString(final List<XAttr> xAttrs)
-      throws IOException {
-    final List<String> names = new ArrayList<>(xAttrs.size());
-    for (XAttr xAttr : xAttrs) {
-      names.add(XAttrHelper.getPrefixedName(xAttr));
-    }
-    String ret = MAPPER.writeValueAsString(names);
-    final Map<String, Object> finalMap = new TreeMap<String, Object>();
-    finalMap.put("XAttrNames", ret);
-    return MAPPER.writeValueAsString(finalMap);
-  }
-
   public static String toJsonString(Object obj) throws IOException {
     return MAPPER.writeValueAsString(obj);
   }
 
-  public static String toJsonString(BlockStoragePolicy[] storagePolicies) {
-    final Map<String, Object> blockStoragePolicies = new TreeMap<>();
-    Object[] a = null;
-    if (storagePolicies != null && storagePolicies.length > 0) {
-      a = new Object[storagePolicies.length];
-      for (int i = 0; i < storagePolicies.length; i++) {
-        a[i] = toJsonMap(storagePolicies[i]);
-      }
-    }
-    blockStoragePolicies.put("BlockStoragePolicy", a);
-    return toJsonString("BlockStoragePolicies", blockStoragePolicies);
-  }
-
-  private static Object toJsonMap(BlockStoragePolicy blockStoragePolicy) {
-    final Map<String, Object> m = new TreeMap<String, Object>();
-    m.put("id", blockStoragePolicy.getId());
-    m.put("name", blockStoragePolicy.getName());
-    m.put("storageTypes", blockStoragePolicy.getStorageTypes());
-    m.put("creationFallbacks", blockStoragePolicy.getCreationFallbacks());
-    m.put("replicationFallbacks", 
blockStoragePolicy.getReplicationFallbacks());
-    m.put("copyOnCreateFile", blockStoragePolicy.isCopyOnCreateFile());
-    return m;
-  }
-
-  public static String toJsonString(BlockStoragePolicy storagePolicy) {
-    return toJsonString(BlockStoragePolicy.class, toJsonMap(storagePolicy));
-  }
-
   public static String toJsonString(FsServerDefaults serverDefaults) {
     return toJsonString(FsServerDefaults.class, toJsonMap(serverDefaults));
   }
@@ -478,35 +111,4 @@ private static Object toJsonMap(
     return m;
   }
 
-  private static Map<String, Object> toJsonMap(
-      final BlockLocation blockLocation) throws IOException {
-    if (blockLocation == null) {
-      return null;
-    }
-
-    final Map<String, Object> m = new HashMap<>();
-    m.put("length", blockLocation.getLength());
-    m.put("offset", blockLocation.getOffset());
-    m.put("corrupt", blockLocation.isCorrupt());
-    m.put("storageTypes", toJsonArray(blockLocation.getStorageTypes()));
-    m.put("cachedHosts", blockLocation.getCachedHosts());
-    m.put("hosts", blockLocation.getHosts());
-    m.put("names", blockLocation.getNames());
-    m.put("topologyPaths", blockLocation.getTopologyPaths());
-    return m;
-  }
-
-  public static String toJsonString(BlockLocation[] locations)
-      throws IOException {
-    if (locations == null) {
-      return null;
-    }
-    final Map<String, Object> m = new HashMap<>();
-    Object[] blockLocations = new Object[locations.length];
-    for (int i = 0; i < locations.length; i++) {
-      blockLocations[i] = toJsonMap(locations[i]);
-    }
-    m.put(BlockLocation.class.getSimpleName(), blockLocations);
-    return toJsonString("BlockLocations", m);
-  }
 }
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/metrics/HttpFSServerMetrics.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/metrics/HttpFSServerMetrics.java
index ffd043e8ff..8c3c8c2de4 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/metrics/HttpFSServerMetrics.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/metrics/HttpFSServerMetrics.java
@@ -149,16 +149,4 @@ public void incrOpsCheckAccess() {
   public void shutdown() {
     DefaultMetricsSystem.shutdown();
   }
-
-  public long getOpsMkdir() {
-    return opsMkdir.value();
-  }
-
-  public long getOpsListing() {
-    return opsListing.value();
-  }
-
-  public long getOpsStat() {
-    return opsStat.value();
-  }
 }
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/hdfs/web/WebHdfsConstants.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/hdfs/web/WebHdfsConstants.java
index 7256a7c04e..efd62c9b0c 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/hdfs/web/WebHdfsConstants.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/hdfs/web/WebHdfsConstants.java
@@ -18,7 +18,6 @@
 package org.apache.ozone.hdfs.web;
 
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
-import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
 import org.apache.hadoop.io.Text;
 
 /**
@@ -36,17 +35,4 @@ public final class WebHdfsConstants {
   private WebHdfsConstants() {
   }
 
-  enum PathType {
-    FILE, DIRECTORY, SYMLINK;
-
-    static PathType valueOf(HdfsFileStatus status) {
-      if (status.isDirectory()) {
-        return DIRECTORY;
-      }
-      if (status.isSymlink()) {
-        return SYMLINK;
-      }
-      return FILE;
-    }
-  }
 }
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/lang/XException.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/lang/XException.java
index f20395f96b..9ad7f7c0dd 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/lang/XException.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/lang/XException.java
@@ -60,17 +60,6 @@ private XException(ERROR error, String message, Throwable 
cause) {
     this.error = error;
   }
 
-  /**
-   * Creates an XException using another XException as cause.
-   * <p>
-   * The error code and error message are extracted from the cause.
-   *
-   * @param cause exception cause.
-   */
-  public XException(XException cause) {
-    this(cause.getError(), cause.getMessage(), cause);
-  }
-
   /**
    * Creates an XException using the specified error code. The exception
    * message is resolved using the error code template and the passed
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/servlet/ServerWebApp.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/servlet/ServerWebApp.java
index 27459e08f4..4b6b18c916 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/servlet/ServerWebApp.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/servlet/ServerWebApp.java
@@ -18,8 +18,6 @@
 
 package org.apache.ozone.lib.servlet;
 
-import com.google.common.annotations.VisibleForTesting;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 import org.apache.ozone.lib.server.Server;
 import org.apache.ozone.lib.server.ServerException;
@@ -46,35 +44,12 @@ public abstract class ServerWebApp
   private static final String TEMP_DIR = ".temp.dir";
   private static final String HTTP_HOSTNAME = ".http.hostname";
   private static final String HTTP_PORT = ".http.port";
-  public static final String SSL_ENABLED = ".ssl.enabled";
 
   private static final ThreadLocal<String> HOME_DIR_TL =
       new ThreadLocal<String>();
 
   private InetSocketAddress authority;
 
-  /**
-   * Method for testing purposes.
-   */
-  public static void setHomeDirForCurrentThread(String homeDir) {
-    HOME_DIR_TL.set(homeDir);
-  }
-
-  /**
-   * Constructor for testing purposes.
-   */
-  protected ServerWebApp(String name, String homeDir, String configDir,
-                         String logDir, String tempDir, Configuration config) {
-    super(name, homeDir, configDir, logDir, tempDir, config);
-  }
-
-  /**
-   * Constructor for testing purposes.
-   */
-  protected ServerWebApp(String name, String homeDir, Configuration config) {
-    super(name, homeDir, config);
-  }
-
   /**
    * Constructor. Subclasses must have a default constructor specifying
    * the server name.
@@ -221,25 +196,4 @@ public InetSocketAddress getAuthority() throws 
ServerException {
     }
     return authority;
   }
-
-  /**
-   * Sets an alternate hostname:port InetSocketAddress to use.
-   * <p>
-   * For testing purposes.
-   * 
-   * @param authority alterante authority.
-   */
-  @VisibleForTesting
-  public void setAuthority(InetSocketAddress authority) {
-    this.authority = authority;
-  }
-
-
-  /**
-   *
-   */
-  public boolean isSslEnabled() {
-    return Boolean.parseBoolean(
-      System.getProperty(getName() + SSL_ENABLED, "false"));
-  }
 }
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/util/Check.java 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/util/Check.java
index 46791eff8e..262b1a9424 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/util/Check.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/util/Check.java
@@ -20,10 +20,6 @@
 
 import org.apache.hadoop.hdds.annotation.InterfaceAudience;
 
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.regex.Pattern;
-
 /**
  * Utility methods to check preconditions.
  * <p>
@@ -52,25 +48,6 @@ public static <T> T notNull(T obj, String name) {
     return obj;
   }
 
-  /**
-   * Verifies a list does not have any NULL elements.
-   *
-   * @param list the list to check.
-   * @param name the name to use in the exception message.
-   *
-   * @return the list.
-   *
-   * @throws IllegalArgumentException if the list has NULL elements.
-   */
-  public static <T> List<T> notNullElements(List<T> list, String name) {
-    notNull(list, name);
-    for (int i = 0; i < list.size(); i++) {
-      notNull(list.get(i), MessageFormat
-          .format("list [{0}] element [{1}]", name, i));
-    }
-    return list;
-  }
-
   /**
    * Verifies a string is not NULL and not emtpy.
    *
@@ -91,131 +68,4 @@ public static String notEmpty(String str, String name) {
     return str;
   }
 
-  /**
-   * Verifies a string list is not NULL and not emtpy.
-   *
-   * @param list the list to check.
-   * @param name the name to use in the exception message.
-   *
-   * @return the variable.
-   *
-   * @throws IllegalArgumentException if the string list has NULL or empty
-   * elements.
-   */
-  public static List<String> notEmptyElements(List<String> list, String name) {
-    notNull(list, name);
-    for (int i = 0; i < list.size(); i++) {
-      notEmpty(list.get(i), MessageFormat
-          .format("list [{0}] element [{1}]", name, i));
-    }
-    return list;
-  }
-
-  private static final String IDENTIFIER_PATTERN_STR
-      = "[a-zA-z_][a-zA-Z0-9_\\-]*";
-
-  private static final Pattern IDENTIFIER_PATTERN
-      = Pattern.compile("^" + IDENTIFIER_PATTERN_STR + "$");
-
-  /**
-   * Verifies a value is a valid identifier,
-   * <code>[a-zA-z_][a-zA-Z0-9_\-]*</code>, up to a maximum length.
-   *
-   * @param value string to check if it is a valid identifier.
-   * @param maxLen maximun length.
-   * @param name the name to use in the exception message.
-   *
-   * @return the value.
-   *
-   * @throws IllegalArgumentException if the string is not a valid identifier.
-   */
-  public static String validIdentifier(String value, int maxLen, String name) {
-    Check.notEmpty(value, name);
-    if (value.length() > maxLen) {
-      throw new IllegalArgumentException(
-        MessageFormat.format("[{0}] = [{1}] exceeds max len [{2}]",
-            name,
-            value,
-            maxLen));
-    }
-    if (!IDENTIFIER_PATTERN.matcher(value).find()) {
-      throw new IllegalArgumentException(
-        MessageFormat.format("[{0}] = [{1}] must be '{2}'",
-            name,
-            value,
-            IDENTIFIER_PATTERN_STR));
-    }
-    return value;
-  }
-
-  /**
-   * Verifies an integer is greater than zero.
-   *
-   * @param value integer value.
-   * @param name the name to use in the exception message.
-   *
-   * @return the value.
-   *
-   * @throws IllegalArgumentException if the integer is zero or less.
-   */
-  public static int gt0(int value, String name) {
-    return (int) gt0((long) value, name);
-  }
-
-  /**
-   * Verifies an long is greater than zero.
-   *
-   * @param value long value.
-   * @param name the name to use in the exception message.
-   *
-   * @return the value.
-   *
-   * @throws IllegalArgumentException if the long is zero or less.
-   */
-  public static long gt0(long value, String name) {
-    if (value <= 0) {
-      throw new IllegalArgumentException(
-        MessageFormat
-            .format("parameter [{0}] = [{1}] must be greater than zero",
-                name,
-                value));
-    }
-    return value;
-  }
-
-  /**
-   * Verifies an integer is greater or equal to zero.
-   *
-   * @param value integer value.
-   * @param name the name to use in the exception message.
-   *
-   * @return the value.
-   *
-   * @throws IllegalArgumentException if the integer is greater or equal to
-   * zero.
-   */
-  public static int ge0(int value, String name) {
-    return (int) ge0((long) value, name);
-  }
-
-  /**
-   * Verifies an long is greater or equal to zero.
-   *
-   * @param value integer value.
-   * @param name the name to use in the exception message.
-   *
-   * @return the value.
-   *
-   * @throws IllegalArgumentException if the long is greater or equal to zero.
-   */
-  public static long ge0(long value, String name) {
-    if (value < 0) {
-      throw new IllegalArgumentException(MessageFormat.format(
-        "parameter [{0}] = [{1}] must be greater than or equals zero",
-          name,
-          value));
-    }
-    return value;
-  }
-
 }
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/ByteParam.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/ByteParam.java
deleted file mode 100644
index c8fea3dacc..0000000000
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/ByteParam.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ozone.lib.wsrs;
-
-import org.apache.hadoop.hdds.annotation.InterfaceAudience;
-
-/**
- * Byte parameter.
- */
[email protected]
-public abstract class ByteParam extends Param<Byte> {
-
-  public ByteParam(String name, Byte defaultValue) {
-    super(name, defaultValue);
-  }
-
-  @Override
-  protected Byte parse(String str) throws Exception {
-    return Byte.parseByte(str);
-  }
-
-  @Override
-  protected String getDomain() {
-    return "a byte";
-  }
-}
diff --git 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/InputStreamEntity.java
 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/InputStreamEntity.java
index 40855ca459..2497607185 100644
--- 
a/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/InputStreamEntity.java
+++ 
b/hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/lib/wsrs/InputStreamEntity.java
@@ -44,10 +44,6 @@ public InputStreamEntity(InputStream is, long offset, long 
len) {
     this.len = len;
   }
 
-  public InputStreamEntity(InputStream is) {
-    this(is, 0, -1);
-  }
-
   @Override
   public void write(OutputStream os) throws IOException {
     IOUtils.skipFully(is, offset);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to