From 089e97638c6c6a190cd3083d8c76efb11fc6e7d2 Mon Sep 17 00:00:00 2001 From: Istvan Toth Date: Thu, 30 May 2024 19:23:36 +0200 Subject: [PATCH] HBASE-28628 Use Base64.getUrlEncoder().withoutPadding() in REST tests (#5952) Signed-off-by: Ankit Singhal (cherry picked from commit a16f45811ec54ce3ede229579177151675781862) --- .../java/org/apache/hadoop/hbase/rest/RowResourceBase.java | 4 ++-- .../org/apache/hadoop/hbase/rest/TestGetAndPutResource.java | 4 ++-- .../org/apache/hadoop/hbase/rest/TestMultiRowResource.java | 4 ++-- .../test/java/org/apache/hadoop/hbase/rest/TestTableScan.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java index 1e563512b62d..4d5fe8ea64ac 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/RowResourceBase.java @@ -493,7 +493,7 @@ protected static Response deleteValue(String table, String row, String column) protected static Response deleteValueB64(String table, String row, String column, boolean useQueryString) throws IOException { StringBuilder path = new StringBuilder(); - Base64.Encoder encoder = Base64.getUrlEncoder(); + Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); path.append('/'); path.append(table); path.append('/'); @@ -538,7 +538,7 @@ protected static Response deleteRow(String table, String row) throws IOException protected static Response deleteRowB64(String table, String row, boolean useQueryString) throws IOException { StringBuilder path = new StringBuilder(); - Base64.Encoder encoder = Base64.getUrlEncoder(); + Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); path.append('/'); path.append(table); path.append('/'); diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGetAndPutResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGetAndPutResource.java index d14c45e0532b..b20baea9df8c 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGetAndPutResource.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGetAndPutResource.java @@ -367,7 +367,7 @@ public void testUrlB64EncodedKeyQueryParam() throws IOException, JAXBException { setupValue1(); StringBuilder path = new StringBuilder(); - Base64.Encoder encoder = Base64.getUrlEncoder(); + Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); path.append('/'); path.append(TABLE); path.append('/'); @@ -387,7 +387,7 @@ public void testUrlB64EncodedKeyHeader() throws IOException, JAXBException { setupValue1(); StringBuilder path = new StringBuilder(); - Base64.Encoder encoder = Base64.getUrlEncoder(); + Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); path.append('/'); path.append(TABLE); path.append('/'); diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java index ee8976ddfcf4..a603021bf0b3 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java @@ -76,7 +76,7 @@ public class TestMultiRowResource { private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); private static final HBaseRESTTestingUtility REST_TEST_UTIL = new HBaseRESTTestingUtility(); - private static final Encoder base64UrlEncoder = java.util.Base64.getUrlEncoder(); + private static final Encoder base64UrlEncoder = java.util.Base64.getUrlEncoder().withoutPadding(); private static Client client; private static Configuration conf; @@ -187,7 +187,7 @@ public void testMultiCellGetJSONB64() throws IOException { client.post(row_6_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_2), extraHdr); StringBuilder path = new StringBuilder(); - Base64.Encoder encoder = Base64.getUrlEncoder(); + Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding(); path.append("/"); path.append(TABLE); path.append("/multiget/?row="); diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java index a4cbc8d5f2bd..56afb68537b9 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java @@ -94,7 +94,7 @@ public class TestTableScan { private static Configuration conf; private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - private static final Encoder base64UrlEncoder = java.util.Base64.getUrlEncoder(); + private static final Encoder base64UrlEncoder = java.util.Base64.getUrlEncoder().withoutPadding(); private static final HBaseRESTTestingUtility REST_TEST_UTIL = new HBaseRESTTestingUtility(); @BeforeClass