HBASE-26928 Fix several indentation problems (#4323)

Signed-off-by: Xiaolin Ha <haxiaolin@apache.org>
This commit is contained in:
Duo Zhang 2022-04-06 15:09:00 +08:00 committed by GitHub
parent ae3718be0f
commit e68c61dd54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 53 deletions

View File

@ -497,10 +497,10 @@ public final class Encryption {
* @return a key for the given subject * @return a key for the given subject
* @throws IOException if the key is not found * @throws IOException if the key is not found
*/ */
public static Key getSecretKeyForSubject(String subject, Configuration conf) public static Key getSecretKeyForSubject(String subject, Configuration conf) throws IOException {
throws IOException {
KeyProvider provider = getKeyProvider(conf); KeyProvider provider = getKeyProvider(conf);
if (provider != null) try { if (provider != null) {
try {
Key[] keys = provider.getKeys(new String[] { subject }); Key[] keys = provider.getKeys(new String[] { subject });
if (keys != null && keys.length > 0) { if (keys != null && keys.length > 0) {
return keys[0]; return keys[0];
@ -508,6 +508,7 @@ public final class Encryption {
} catch (Exception e) { } catch (Exception e) {
throw new IOException(e); throw new IOException(e);
} }
}
throw new IOException("No key found for subject '" + subject + "'"); throw new IOException("No key found for subject '" + subject + "'");
} }

View File

@ -290,14 +290,10 @@ public class TestCoprocessorEndpointTracing {
final ConcurrentMap<byte[], EchoResponseProto> results = new ConcurrentHashMap<>(); final ConcurrentMap<byte[], EchoResponseProto> results = new ConcurrentHashMap<>();
TraceUtil.trace(() -> { TraceUtil.trace(() -> {
try { try {
table.coprocessorService(TestProtobufRpcProto.class, null, null, table.coprocessorService(TestProtobufRpcProto.class, null, null, t -> {
t -> {
t.echo(controller, request, callback); t.echo(controller, request, callback);
return callback.get(); return callback.get();
}, }, (region, row, result) -> results.put(region, result));
(region, row, result) -> {
results.put(region, result);
});
} catch (Throwable t) { } catch (Throwable t) {
throw new RuntimeException(t); throw new RuntimeException(t);
} }

View File

@ -223,11 +223,13 @@ public class RowResource extends ResourceBase {
int i = 0; int i = 0;
for (CellModel cell: row.getCells()) { for (CellModel cell: row.getCells()) {
byte[] col = cell.getColumn(); byte[] col = cell.getColumn();
if (col == null) try { if (col == null) {
try {
col = rowspec.getColumns()[i++]; col = rowspec.getColumns()[i++];
} catch (ArrayIndexOutOfBoundsException e) { } catch (ArrayIndexOutOfBoundsException e) {
col = null; col = null;
} }
}
if (col == null) { if (col == null) {
servlet.getMetrics().incrementFailedPutRequests(1); servlet.getMetrics().incrementFailedPutRequests(1);
return Response.status(Response.Status.BAD_REQUEST) return Response.status(Response.Status.BAD_REQUEST)
@ -263,13 +265,15 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1); servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table", ioe); LOG.debug("Exception received while closing the table", ioe);
} }
} }
} }
}
// This currently supports only update of one row at a time. // This currently supports only update of one row at a time.
Response updateBinary(final byte[] message, final HttpHeaders headers, Response updateBinary(final byte[] message, final HttpHeaders headers,
@ -334,13 +338,15 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1); servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table", ioe); LOG.debug("Exception received while closing the table", ioe);
} }
} }
} }
}
@PUT @PUT
@Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF, @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
@ -399,10 +405,11 @@ public class RowResource extends ResourceBase {
.build(); .build();
} }
Delete delete = null; Delete delete = null;
if (rowspec.hasTimestamp()) if (rowspec.hasTimestamp()) {
delete = new Delete(rowspec.getRow(), rowspec.getTimestamp()); delete = new Delete(rowspec.getRow(), rowspec.getTimestamp());
else } else {
delete = new Delete(rowspec.getRow()); delete = new Delete(rowspec.getRow());
}
for (byte[] column: rowspec.getColumns()) { for (byte[] column: rowspec.getColumns()) {
byte[][] split = CellUtil.parseColumn(column); byte[][] split = CellUtil.parseColumn(column);
@ -440,12 +447,14 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedDeleteRequests(1); servlet.getMetrics().incrementFailedDeleteRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table", ioe); LOG.debug("Exception received while closing the table", ioe);
} }
} }
}
return Response.ok().build(); return Response.ok().build();
} }
@ -557,13 +566,15 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedPutRequests(1); servlet.getMetrics().incrementFailedPutRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table", ioe); LOG.debug("Exception received while closing the table", ioe);
} }
} }
} }
}
/** /**
* Validates the input request parameters, parses columns from CellSetModel, * Validates the input request parameters, parses columns from CellSetModel,
@ -687,13 +698,15 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedDeleteRequests(1); servlet.getMetrics().incrementFailedDeleteRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table", ioe); LOG.debug("Exception received while closing the table", ioe);
} }
} }
} }
}
/** /**
* Validates the input request parameters, parses columns from CellSetModel, * Validates the input request parameters, parses columns from CellSetModel,
@ -781,13 +794,15 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedAppendRequests(1); servlet.getMetrics().incrementFailedAppendRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table" + table.getName(), ioe); LOG.debug("Exception received while closing the table" + table.getName(), ioe);
} }
} }
} }
}
/** /**
* Validates the input request parameters, parses columns from CellSetModel, * Validates the input request parameters, parses columns from CellSetModel,
@ -878,11 +893,13 @@ public class RowResource extends ResourceBase {
servlet.getMetrics().incrementFailedIncrementRequests(1); servlet.getMetrics().incrementFailedIncrementRequests(1);
return processException(e); return processException(e);
} finally { } finally {
if (table != null) try { if (table != null) {
try {
table.close(); table.close();
} catch (IOException ioe) { } catch (IOException ioe) {
LOG.debug("Exception received while closing the table " + table.getName(), ioe); LOG.debug("Exception received while closing the table " + table.getName(), ioe);
} }
} }
} }
}
} }

View File

@ -141,9 +141,9 @@ public class TestRefreshRecoveredReplication extends TestReplicationBase {
Replication replication = (Replication)otherServer.getReplicationSourceService(); Replication replication = (Replication)otherServer.getReplicationSourceService();
UTIL1.waitFor(60000, () -> !replication.getReplicationManager().getOldSources().isEmpty()); UTIL1.waitFor(60000, () -> !replication.getReplicationManager().getOldSources().isEmpty());
// Wait on only one server being up. // Wait on only one server being up.
UTIL1.waitFor(60000, () ->
// Have to go back to source here because getLiveRegionServerThreads makes new array each time // Have to go back to source here because getLiveRegionServerThreads makes new array each time
UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1); UTIL1.waitFor(60000,
() -> UTIL1.getMiniHBaseCluster().getLiveRegionServerThreads().size() == NUM_SLAVES1 - 1);
UTIL1.waitTableAvailable(tablename); UTIL1.waitTableAvailable(tablename);
LOG.info("Available {}", tablename); LOG.info("Available {}", tablename);