From 5f5485ca4c8356a00f3d20289ee23ae2924c8571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Paksy?= Date: Wed, 8 Jan 2025 13:11:16 +0100 Subject: [PATCH] HBASE-29026 Replace deprecated calls in JSP files --- .../hbase-webapps/master/procedures.jsp | 30 ++--- .../resources/hbase-webapps/master/quotas.jsp | 1 - .../resources/hbase-webapps/master/rits.jsp | 4 +- .../hbase-webapps/master/rsgroup.jsp | 4 +- .../hbase-webapps/master/snapshot.jsp | 6 +- .../hbase-webapps/master/snapshotsStats.jsp | 18 +-- .../resources/hbase-webapps/master/table.jsp | 112 +++++++++++------- .../hbase-webapps/master/tablesDetailed.jsp | 6 +- .../resources/hbase-webapps/master/zk.jsp | 2 +- .../hbase-webapps/regionserver/region.jsp | 6 +- 10 files changed, 97 insertions(+), 92 deletions(-) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp b/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp index c25c5c3886ba..0bc744150edc 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/procedures.jsp @@ -18,32 +18,20 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" + import="static org.apache.commons.text.StringEscapeUtils.escapeXml10" import="java.util.Collections" import="java.util.Comparator" - import="java.util.ArrayList" import="java.util.Date" import="java.util.List" - import="java.util.Set" import="org.apache.hadoop.hbase.master.HMaster" import="org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv" import="org.apache.hadoop.hbase.procedure2.LockedResource" import="org.apache.hadoop.hbase.procedure2.Procedure" import="org.apache.hadoop.hbase.procedure2.ProcedureExecutor" - import="org.apache.hadoop.hbase.procedure2.util.StringUtils" - import="org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix" %> -<%@ page import="org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure" %> -<%@ page import="org.apache.hadoop.hbase.master.assignment.TransitRegionStateProcedure" %> -<%@ page import="org.apache.hadoop.hbase.master.assignment.OpenRegionProcedure" %> -<%@ page import="org.apache.hadoop.hbase.master.assignment.CloseRegionProcedure" %> -<%@ page import="org.apache.hadoop.hbase.metrics.OperationMetrics" %> <%@ page import="java.util.Map" %> -<%@ page import="java.util.HashMap" %> -<%@ page import="org.apache.hadoop.hbase.master.MetricsAssignmentManagerSource" %> <%@ page import="org.apache.hadoop.hbase.master.MetricsAssignmentManager" %> <%@ page import="org.apache.hadoop.hbase.procedure2.ProcedureMetrics" %> -<%@ page import="org.apache.hadoop.hbase.metrics.Snapshot" %> <%@ page import="org.apache.hadoop.hbase.metrics.Histogram" %> <%@ page import="java.util.TreeMap" %> <%@ page import="org.apache.hadoop.hbase.metrics.impl.HistogramImpl" %> @@ -90,7 +78,7 @@

Procedure Time Statistics

-

We list proceduces completed successfully of the following types only: ServerCrashProcedure, TransitRegionStateProcedure, +

We list procedures completed successfully of the following types only: ServerCrashProcedure, TransitRegionStateProcedure, OpenRegionProcedure, CloseRegionProcedure.

@@ -164,13 +152,13 @@ - - - + + + - - + + <% } %> <% @@ -204,7 +192,7 @@ case EXCLUSIVE: %>

Lock type: EXCLUSIVE

-

Owner procedure: <%= escapeXml(lockedResource.getExclusiveLockOwnerProcedure().toStringDetails()) %>

+

Owner procedure: <%= escapeXml10(lockedResource.getExclusiveLockOwnerProcedure().toStringDetails()) %>

<% break; case SHARED: @@ -223,7 +211,7 @@
<%= proc.getProcId() %> <%= proc.hasParent() ? proc.getParentProcId() : "" %><%= escapeXml(proc.getState().toString() + (proc.isBypass() ? "(Bypass)" : "")) %><%= proc.hasOwner() ? escapeXml(proc.getOwner()) : "" %><%= escapeXml(proc.getProcName()) %><%= escapeXml10(proc.getState().toString() + (proc.isBypass() ? "(Bypass)" : "")) %><%= proc.hasOwner() ? escapeXml10(proc.getOwner()) : "" %><%= escapeXml10(proc.getProcName()) %> <%= new Date(proc.getSubmittedTime()) %> <%= new Date(proc.getLastUpdate()) %><%= escapeXml(proc.isFailed() ? proc.getException().unwrapRemoteIOException().getMessage() : "") %><%= escapeXml(proc.toString()) %><%= escapeXml10(proc.isFailed() ? proc.getException().unwrapRemoteIOException().getMessage() : "") %><%= escapeXml10(proc.toString()) %>
<% for (Procedure proc : procedures) { %> - + <% } %>
<%= escapeXml(proc.toStringDetails()) %><%= escapeXml10(proc.toStringDetails()) %>
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp b/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp index 52a92552432c..1c5bfb6647b6 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp @@ -21,7 +21,6 @@ import="java.util.concurrent.TimeUnit" import="java.util.ArrayList" import="java.util.List" - import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.master.HMaster" import="org.apache.hadoop.hbase.quotas.MasterQuotaManager" import="org.apache.hadoop.hbase.quotas.QuotaRetriever" diff --git a/hbase-server/src/main/resources/hbase-webapps/master/rits.jsp b/hbase-server/src/main/resources/hbase-webapps/master/rits.jsp index 802a66b58906..3b5129eb0e17 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/rits.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/rits.jsp @@ -18,7 +18,7 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" + import="static org.apache.commons.text.StringEscapeUtils.escapeXml10" import="java.util.Collections" import="java.util.Comparator" import="java.util.ArrayList" @@ -107,7 +107,7 @@ <% } else { %> <%= procedure.getProcId() %> - <%= escapeXml(procedure.getState().toString() + (procedure.isBypass() ? "(Bypassed)" : "")) %> + <%= escapeXml10(procedure.getState().toString() + (procedure.isBypass() ? "(Bypassed)" : "")) %> <% } %> <% RegionState rs = regionStateNode.toRegionState(); %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp index 02fc1bfc39e8..c86c9902ea1b 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/rsgroup.jsp @@ -24,8 +24,6 @@ import="java.util.List" import="java.util.Map" import="java.util.function.Function" - import="java.util.regex.Pattern" - import="java.util.stream.Stream" import="java.util.stream.Collectors" import="org.apache.hadoop.hbase.ServerName" import="org.apache.hadoop.hbase.TableName" @@ -169,7 +167,7 @@ totalRequestsPerSecond += sl.getRequestCountPerSecond(); lastContact = (System.currentTimeMillis() - sl.getReportTimestamp())/1000; } - long startcode = serverName.getStartcode(); + long startcode = serverName.getStartCode(); int infoPort = master.getRegionServerInfoPort(serverName); String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";%> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp b/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp index e85cab95d7e5..ebe06de84f31 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp @@ -134,14 +134,14 @@
<%= stats.getStoreFilesCount() %> HFiles (<%= stats.getArchivedStoreFilesCount() %> in archive), - total size <%= StringUtils.humanReadableInt(stats.getStoreFilesSize()) %> + total size <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getStoreFilesSize(), "", 1) %> (<%= stats.getSharedStoreFilePercentage() %>% - <%= StringUtils.humanReadableInt(stats.getSharedStoreFilesSize()) %> shared with the source + <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getSharedStoreFilesSize(), "", 1) %> shared with the source table)
<%= stats.getLogsCount() %> Logs, total size - <%= StringUtils.humanReadableInt(stats.getLogsSize()) %> + <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getLogsSize(), "", 1) %>
<% if (stats.isSnapshotCorrupted()) { %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/snapshotsStats.jsp b/hbase-server/src/main/resources/hbase-webapps/master/snapshotsStats.jsp index 6202d7409b5c..f1b3a6fa34da 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/snapshotsStats.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/snapshotsStats.jsp @@ -99,18 +99,18 @@ <%= SnapshotDescriptionUtils.isExpiredSnapshot(snapshotDesc.getTtl(), snapshotDesc.getCreationTime(), System.currentTimeMillis()) ? "Yes" : "No" %> - <%= StringUtils.humanReadableInt(stats.getSharedStoreFilesSize()) %> - <%= StringUtils.humanReadableInt(stats.getMobStoreFilesSize()) %> - <%= StringUtils.humanReadableInt(stats.getArchivedStoreFileSize()) %> - (<%= StringUtils.humanReadableInt(stats.getNonSharedArchivedStoreFilesSize()) %>) + <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getSharedStoreFilesSize(), "", 1) %> + <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getMobStoreFilesSize(), "", 1) %> + <%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getArchivedStoreFileSize(), "", 1) %> + (<%= StringUtils.TraditionalBinaryPrefix.long2String(stats.getNonSharedArchivedStoreFilesSize(), "", 1) %>) <% } %>

<%= snapshots.size() %> snapshot(s) in set.

-

Total Storefile Size: <%= StringUtils.humanReadableInt(totalSize) %>

-

Total Shared Storefile Size: <%= StringUtils.humanReadableInt(totalSharedSize.get()) %>, - Total Mob Storefile Size: <%= StringUtils.humanReadableInt(totalMobSize.get()) %>, - Total Archived Storefile Size: <%= StringUtils.humanReadableInt(totalArchivedSize.get()) %> - (<%= StringUtils.humanReadableInt(totalUnsharedArchivedSize) %>)

+

Total Storefile Size: <%= StringUtils.TraditionalBinaryPrefix.long2String(totalSize, "", 1) %>

+

Total Shared Storefile Size: <%= StringUtils.TraditionalBinaryPrefix.long2String(totalSharedSize.get(), "", 1) %>, + Total Mob Storefile Size: <%= StringUtils.TraditionalBinaryPrefix.long2String(totalMobSize.get(), "", 1) %>, + Total Archived Storefile Size: <%= StringUtils.TraditionalBinaryPrefix.long2String(totalArchivedSize.get(), "", 1) %> + (<%= StringUtils.TraditionalBinaryPrefix.long2String(totalUnsharedArchivedSize, "", 1) %>)

Shared Storefile Size is the Storefile size shared between snapshots and active tables. Mob Storefile Size is the Mob Storefile size shared between snapshots and active tables. Archived Storefile Size is the Storefile size in Archive. diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp index c4c0e6204504..0091b078e3c7 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -18,7 +18,7 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" + import="static org.apache.commons.text.StringEscapeUtils.escapeXml10" import="java.net.URLEncoder" import="java.util.ArrayList" import="java.util.HashMap" @@ -30,7 +30,7 @@ import="java.util.Optional" import="java.util.TreeMap" import="java.util.concurrent.TimeUnit" - import="org.apache.commons.lang3.StringEscapeUtils" + import="org.apache.commons.text.StringEscapeUtils" import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.HConstants" import="org.apache.hadoop.hbase.HRegionLocation" @@ -71,6 +71,7 @@ <%@ page import="org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.Quotas" %> <%@ page import="org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceQuota" %> <%@ page import="java.util.stream.Collectors" %> +<%@ page import="java.nio.charset.StandardCharsets" %> <%! /** * @return An empty region load stamped with the passed in regionInfo @@ -104,27 +105,57 @@ } /** - * Render an tag contents server name which the given region deploys. - * Links to the server rs-status page. - * not deployed instead if can not find the deploy message. - * @return an tag contents server name links to server rs-status page. + * Returns the socket address (host and port delimited with a colon - for example: server-01:16030) of the region server wrapped in an Optional. + * When ServerName is null, it returns an empty Optional. + * + * @param master not null HMaster instance used to get the region server info port. + * @param serverName not null ServerName instance, for figuring our the host name. + * + * @return the socket address of the region server in an Optional or empty Optional. */ - private static String buildRegionDeployedServerTag(RegionInfo regionInfo, HMaster master, - Map regionsToServer) { - ServerName serverName = regionsToServer.get(regionInfo); - + private static Optional buildRegionServerSocketAddress(HMaster master, ServerName serverName) { if (serverName == null) { - return "not deployed"; + return Optional.empty(); } + // The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely. String hostName = serverName.getHostname(); - String hostNameEncoded = URLEncoder.encode(hostName); - // This port might be wrong if RS actually ended up using something else. - int serverInfoPort = master.getRegionServerInfoPort(serverName); - String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + "/rs-status"; + String hostNameEncoded = URLEncoder.encode(hostName, StandardCharsets.UTF_8); + int serverInforPort = master.getRegionServerInfoPort(serverName); + return Optional.of(hostNameEncoded + ":" + serverInforPort); + } + + /** + * Creates a tag contents server socket address (host:port) and links to the server rs-status page. + * Returns the default value parameter instead if serverName is null. + * @return an tag contents server socket address links to server rs-status page. + */ + private static String buildRegionServerTag(HMaster master, ServerName serverName, String defaultValue) { + return buildRegionServerSocketAddress(master, serverName) + .map(socketAddress -> { + String urlRegionServer = "//" + socketAddress + "/rs-status"; + return "" + StringEscapeUtils.escapeHtml4(socketAddress) + ""; + }) + .orElse(defaultValue); + } + + /** + * Render an tag contents server name which the given region deploys. + * Links to the server rs-status page. + * not deployed instead if can not find the deploy message. + * @return an tag contents server name links to server rs-status page. + */ + private static String buildRegionDeployedServerTag(HMaster master, ServerName serverName) { + return buildRegionServerTag(master, serverName, "not deployed"); + } - return "" + StringEscapeUtils.escapeHtml4(hostName) - + ":" + serverInfoPort + ""; + /** + * Creates a tag contents server socket address (host:port) and links to the server rs-status page. + * Empty > instead if serverName is null. + * @return an tag contents server socket address links to server rs-status page. + */ + private static String buildRegionServerTag(HMaster master, ServerName serverName) { + return buildRegionServerTag(master, serverName, ""); } /** @@ -132,7 +163,7 @@ */ private static String moreRegionsToRender(int numRegionsRendered, int numRegions, String fqtn) { if (numRegions > numRegionsRendered) { - String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn) + "&numRegions=all"; + String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn, StandardCharsets.UTF_8) + "&numRegions=all"; return "This table has " + numRegions + " regions in total, in order to improve the page load time, only " @@ -334,7 +365,6 @@ ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; for (int i = 0; i < 1; i++) { //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; String readReq = "N/A"; String writeReq = "N/A"; String fileSizeUncompressed = ZEROMB; @@ -344,8 +374,6 @@ if (metaLocation != null) { ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - // The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely. - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); if (sl != null) { Map map = sl.getRegionMetrics(); if (map.containsKey(meta.getRegionName())) { @@ -370,16 +398,16 @@ } %> - <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= escapeXml10(meta.getRegionNameAsString()) %> + <%= buildRegionServerTag(master, metaLocation) %> <%= readReq%> <%= writeReq%> <%= fileSizeUncompressed%> <%= fileSize%> <%= fileCount%> <%= memSize%> - <%= escapeXml(Bytes.toString(meta.getStartKey())) %> - <%= escapeXml(Bytes.toString(meta.getEndKey())) %> + <%= escapeXml10(Bytes.toString(meta.getStartKey())) %> + <%= escapeXml10(Bytes.toString(meta.getEndKey())) %> <%= meta.getReplicaId() %> <% } %> @@ -409,13 +437,11 @@ ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; for (int i = 0; i < 1; i++) { //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; float locality = 0.0f; float localityForSsd = 0.0f; if (metaLocation != null) { ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); if (sl != null) { Map map = sl.getRegionMetrics(); if (map.containsKey(meta.getRegionName())) { @@ -427,8 +453,8 @@ } %> - <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= escapeXml10(meta.getRegionNameAsString()) %> + <%= buildRegionServerTag(master, metaLocation) %> <%= locality%> <%= localityForSsd%> @@ -461,14 +487,12 @@ ServerName metaLocation = rsn != null ? rsn.getRegionLocation() : null; for (int i = 0; i < 1; i++) { //If metaLocation is null, default value below would be displayed in UI. - String hostAndPort = ""; long compactingCells = 0; long compactedCells = 0; String compactionProgress = ""; if (metaLocation != null) { ServerMetrics sl = master.getServerManager().getLoad(metaLocation); - hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation); if (sl != null) { Map map = sl.getRegionMetrics(); if (map.containsKey(meta.getRegionName())) { @@ -484,8 +508,8 @@ } %> - <%= escapeXml(meta.getRegionNameAsString()) %> - <%= StringEscapeUtils.escapeHtml4(hostAndPort) %> + <%= escapeXml10(meta.getRegionNameAsString()) %> + <%= buildRegionServerTag(master, metaLocation) %> <%= String.format("%,1d", compactingCells)%> <%= String.format("%,1d", compactedCells)%> <%= String.format("%,1d", compactingCells - compactedCells)%> @@ -1020,16 +1044,16 @@ numRegionsRendered++; %> - <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + <%= escapeXml10(Bytes.toStringBinary(regionInfo.getRegionName())) %> + <%= buildRegionDeployedServerTag(master, regionsToServer.get(regionInfo)) %> <%= readReq%> <%= writeReq%> <%= regionSizeUncompressed%> <%= regionSize%> <%= fileCount%> <%= memSize%> - <%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%> - <%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%> + <%= escapeXml10(Bytes.toStringBinary(regionInfo.getStartKey()))%> + <%= escapeXml10(Bytes.toStringBinary(regionInfo.getEndKey()))%> <%= state%> <%= regionInfo.getReplicaId() %> @@ -1054,11 +1078,9 @@ numRegionsRendered = 0; for (Map.Entry hriEntry : entryList) { RegionInfo regionInfo = hriEntry.getKey(); - ServerName addr = regionsToServer.get(regionInfo); RegionMetrics load = hriEntry.getValue(); float locality = 0.0f; float localityForSsd = 0.0f; - String state = "N/A"; if (load != null) { locality = load.getDataLocality(); localityForSsd = load.getDataLocalityForSsd(); @@ -1068,8 +1090,8 @@ numRegionsRendered++; %> - <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + <%= escapeXml10(Bytes.toStringBinary(regionInfo.getRegionName())) %> + <%= buildRegionDeployedServerTag(master, regionsToServer.get(regionInfo)) %> <%= locality%> <%= localityForSsd%> @@ -1114,8 +1136,8 @@ numRegionsRendered++; %> - <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + <%= escapeXml10(Bytes.toStringBinary(regionInfo.getRegionName())) %> + <%= buildRegionDeployedServerTag(master, regionsToServer.get(regionInfo)) %> <%= String.format("%,1d", compactingCells)%> <%= String.format("%,1d", compactedCells)%> <%= String.format("%,1d", compactingCells - compactedCells)%> @@ -1146,11 +1168,11 @@ <% for (Map.Entry rdEntry : regDistribution.entrySet()) { ServerName addr = rdEntry.getKey(); - String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + String url = "//" + URLEncoder.encode(addr.getHostname(), StandardCharsets.UTF_8) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status"; %> - <%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + <%= StringEscapeUtils.escapeHtml4(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) %> <%= rdEntry.getValue()%> <%= primaryRegDistribution.get(addr) == null ? 0 : primaryRegDistribution.get(addr)%> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/tablesDetailed.jsp b/hbase-server/src/main/resources/hbase-webapps/master/tablesDetailed.jsp index 7e0d623e6867..3384724414a5 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/tablesDetailed.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/tablesDetailed.jsp @@ -18,11 +18,9 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" - import="java.io.IOException" + import="static org.apache.commons.text.StringEscapeUtils.escapeXml10" import="java.util.ArrayList" import="java.util.List" - import="java.util.Map" %> <%@ page import="org.apache.hadoop.hbase.client.TableDescriptor" %> <%@ page import="org.apache.hadoop.hbase.master.HMaster" %> @@ -56,7 +54,7 @@ <% for (TableDescriptor htDesc : tables) { %> - <%= escapeXml( + <%= escapeXml10( htDesc.getTableName().getNameAsString()) %> <%= htDesc.toString() %> diff --git a/hbase-server/src/main/resources/hbase-webapps/master/zk.jsp b/hbase-server/src/main/resources/hbase-webapps/master/zk.jsp index c6ae44fc86d4..2da9cd28a641 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/zk.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/zk.jsp @@ -18,7 +18,7 @@ */ --%> <%@ page contentType="text/html;charset=UTF-8" - import="org.apache.commons.lang3.StringEscapeUtils" + import="org.apache.commons.text.StringEscapeUtils" import="org.apache.hadoop.hbase.master.HMaster" import="org.apache.hadoop.hbase.zookeeper.ZKDump" import="org.apache.hadoop.hbase.zookeeper.ZKWatcher" diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp index c6084f74e904..a251d335b798 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp @@ -25,7 +25,6 @@ import="org.apache.hadoop.fs.FileSystem" import="org.apache.hadoop.fs.FileStatus" import="org.apache.hadoop.fs.Path" - import="org.apache.hadoop.hbase.HConstants" import="org.apache.hadoop.hbase.client.RegionInfo" import="org.apache.hadoop.hbase.client.RegionInfoDisplay" import="org.apache.hadoop.hbase.mob.MobUtils" @@ -35,6 +34,7 @@ import="org.apache.hadoop.hbase.regionserver.HRegion" import="org.apache.hadoop.hbase.regionserver.HStore" %> +<%@ page import="java.nio.charset.StandardCharsets" %> <% String regionName = request.getParameter("name"); HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); @@ -95,7 +95,7 @@ count ++; %> <%= sf.getPath() %> - <%= (int) (fs.getLength(sf.getPath()) / 1024 / 1024) %> + <%= (int) (fs.getFileStatus(sf.getPath()).getLen() / 1024 / 1024) %> <%= new Date(sf.getModificationTimestamp()) %> <%= String.format("%,1d", sf.getFileInfo().getHFileInfo().getLenOfBiggestCell()) %> <%= sf.getFileInfo().getHFileInfo().getKeyOfBiggestCell() %> @@ -130,7 +130,7 @@ mobCnt ++; FileStatus status = rs.getFileSystem().getFileStatus(mobPath); String mobPathStr = mobPath.toString(); - String encodedStr = URLEncoder.encode(mobPathStr, HConstants.UTF8_ENCODING); %> + String encodedStr = URLEncoder.encode(mobPathStr, StandardCharsets.UTF_8); %> <%= mobPathStr%>