You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/04/06 07:19:47 UTC
[hbase] branch branch-2.4 updated: HBASE-26928 Fix several indentation problems (#4323)
This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 789c37e6cee HBASE-26928 Fix several indentation problems (#4323)
789c37e6cee is described below
commit 789c37e6ceebd3da8c3fb61baef0bd4fa4387ef2
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Wed Apr 6 15:09:00 2022 +0800
HBASE-26928 Fix several indentation problems (#4323)
Signed-off-by: Xiaolin Ha <ha...@apache.org>
(cherry picked from commit e68c61dd54c3f85ef5d7611956d75c0c29c9cdbb)
---
.../apache/hadoop/hbase/io/crypto/Encryption.java | 17 +++--
.../org/apache/hadoop/hbase/rest/RowResource.java | 85 +++++++++++++---------
.../TestRefreshRecoveredReplication.java | 6 +-
3 files changed, 63 insertions(+), 45 deletions(-)
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java
index 6cb0b073e0f..781369edd80 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/crypto/Encryption.java
@@ -497,16 +497,17 @@ public final class Encryption {
* @return a key for the given subject
* @throws IOException if the key is not found
*/
- public static Key getSecretKeyForSubject(String subject, Configuration conf)
- throws IOException {
+ public static Key getSecretKeyForSubject(String subject, Configuration conf) throws IOException {
KeyProvider provider = getKeyProvider(conf);
- if (provider != null) try {
- Key[] keys = provider.getKeys(new String[] { subject });
- if (keys != null && keys.length > 0) {
- return keys[0];
+ if (provider != null) {
+ try {
+ Key[] keys = provider.getKeys(new String[] { subject });
+ if (keys != null && keys.length > 0) {
+ return keys[0];
+ }
+ } catch (Exception e) {
+ throw new IOException(e);
}
- } catch (Exception e) {
- throw new IOException(e);
}
throw new IOException("No key found for subject '" + subject + "'");
}
diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
index aabcff6784c..fd5818a07a1 100644
--- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
+++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
@@ -224,10 +224,12 @@ public class RowResource extends ResourceBase {
int i = 0;
for (CellModel cell: row.getCells()) {
byte[] col = cell.getColumn();
- if (col == null) try {
- col = rowspec.getColumns()[i++];
- } catch (ArrayIndexOutOfBoundsException e) {
- col = null;
+ if (col == null) {
+ try {
+ col = rowspec.getColumns()[i++];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ col = null;
+ }
}
if (col == null) {
servlet.getMetrics().incrementFailedPutRequests(1);
@@ -264,10 +266,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table", ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table", ioe);
+ }
}
}
}
@@ -335,10 +339,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table", ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table", ioe);
+ }
}
}
}
@@ -400,10 +406,11 @@ public class RowResource extends ResourceBase {
.build();
}
Delete delete = null;
- if (rowspec.hasTimestamp())
+ if (rowspec.hasTimestamp()) {
delete = new Delete(rowspec.getRow(), rowspec.getTimestamp());
- else
+ } else {
delete = new Delete(rowspec.getRow());
+ }
for (byte[] column: rowspec.getColumns()) {
byte[][] split = CellUtil.parseColumn(column);
@@ -441,10 +448,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedDeleteRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table", ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table", ioe);
+ }
}
}
return Response.ok().build();
@@ -558,10 +567,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table", ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table", ioe);
+ }
}
}
}
@@ -688,10 +699,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedDeleteRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table", ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table", ioe);
+ }
}
}
}
@@ -782,10 +795,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedAppendRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table" + table.getName(), ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table" + table.getName(), ioe);
+ }
}
}
}
@@ -879,10 +894,12 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedIncrementRequests(1);
return processException(e);
} finally {
- if (table != null) try {
- table.close();
- } catch (IOException ioe) {
- LOG.debug("Exception received while closing the table " + table.getName(), ioe);
+ if (table != null) {
+ try {
+ table.close();
+ } catch (IOException ioe) {
+ LOG.debug("Exception received while closing the table " + table.getName(), ioe);
+ }
}
}
}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRefreshRecoveredReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRefreshRecoveredReplication.java
index cf4f7106f06..db671bcc7da 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRefreshRecoveredReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRefreshRecoveredReplication.java
@@ -141,9 +141,9 @@ public class TestRefreshRecoveredReplication extends TestReplicationBase {
Replication replication = (Replication)otherServer.getReplicationSourceService();
UTIL1.waitFor(60000, () -> !replication.getReplicationManager().getOldSources().isEmpty());
// Wait on only one server being up.
- UTIL1.waitFor(60000, () ->
- // Have to go back to source here because getLiveRegionServerThreads makes new array each time
- UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1);
+ // Have to go back to source here because getLiveRegionServerThreads makes new array each time
+ UTIL1.waitFor(60000,
+ () -> UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1);
UTIL1.waitTableAvailable(tablename);
LOG.info("Available {}", tablename);