Skip to content

Commit

Permalink
HBASE-26928 Fix several indentation problems (#4323)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaolin Ha <[email protected]>
  • Loading branch information
Apache9 authored Apr 6, 2022
1 parent ae3718b commit e68c61d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,16 +497,17 @@ public static void decrypt(OutputStream out, InputStream in, int outLen,
* @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 + "'");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,10 @@ public void traceSyncTableEndpointCallAndCallback() throws Exception {
final ConcurrentMap<byte[], EchoResponseProto> results = new ConcurrentHashMap<>();
TraceUtil.trace(() -> {
try {
table.coprocessorService(TestProtobufRpcProto.class, null, null,
t -> {
t.echo(controller, request, callback);
return callback.get();
},
(region, row, result) -> {
results.put(region, result);
});
table.coprocessorService(TestProtobufRpcProto.class, null, null, t -> {
t.echo(controller, request, callback);
return callback.get();
}, (region, row, result) -> results.put(region, result));
} catch (Throwable t) {
throw new RuntimeException(t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,12 @@ Response update(final CellSetModel model, final boolean replace) {
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);
Expand Down Expand Up @@ -263,10 +265,12 @@ Response update(final CellSetModel model, final boolean replace) {
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);
}
}
}
}
Expand Down Expand Up @@ -334,10 +338,12 @@ Response updateBinary(final byte[] message, final HttpHeaders headers,
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);
}
}
}
}
Expand Down Expand Up @@ -399,10 +405,11 @@ public Response delete(final @Context UriInfo uriInfo) {
.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);
Expand Down Expand Up @@ -440,10 +447,12 @@ public Response delete(final @Context UriInfo uriInfo) {
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();
Expand Down Expand Up @@ -557,10 +566,12 @@ Response checkAndPut(final CellSetModel model) {
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);
}
}
}
}
Expand Down Expand Up @@ -687,10 +698,12 @@ Response checkAndDelete(final CellSetModel model) {
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);
}
}
}
}
Expand Down Expand Up @@ -781,10 +794,12 @@ Response append(final CellSetModel model) {
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);
}
}
}
}
Expand Down Expand Up @@ -878,10 +893,12 @@ Response increment(final CellSetModel model) {
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);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public void testReplicationRefreshSource() throws Exception {
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);

Expand Down

0 comments on commit e68c61d

Please sign in to comment.