You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/12/11 00:54:48 UTC
[GitHub] [accumulo] EdColeman opened a new pull request #2384: Fix IDE suggested string usage issues.
EdColeman opened a new pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384
Grouping and limiting changes by code inspection type for easier review.
All changes made by accepting IDE suggestion. Corrects the following:
- replaced redundant call of String.format with out.printf
- removed redundant toString calls
- removed unnecessary conversion to String
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman merged pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman merged pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
ctubbsii commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r769674060
##########
File path: test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
##########
@@ -124,7 +124,7 @@ private static String getTestClassName() {
Optional<String> callerClassName =
StackWalker.getInstance(RETAIN_CLASS_REFERENCE).walk(findCallerITClass).map(Class::getName);
// use the calling class name, or default to a unique name if IT class can't be found
- return callerClassName.orElse(String.format("UnknownITClass-{}-{}", System.currentTimeMillis(),
+ return callerClassName.orElse(String.format("UnknownITClass-%d-%s", System.currentTimeMillis(),
Review comment:
Should both of these be `%d`?
```suggestion
return callerClassName.orElse(String.format("UnknownITClass-%d-%d", System.currentTimeMillis(),
```
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
##########
@@ -129,12 +129,12 @@ private static void write(PrintStream out, int indent, String fmt, Object... arg
for (int i = 0; i < indent; i++) {
out.print(" ");
}
- out.println(String.format(fmt, args));
+ out.printf(fmt, args);
Review comment:
In this instance, it might actually make sense to change `fmt` to `fmt + %n` rather than update each caller separately. The idea here is to minimize the potential for error and to ensure consistency by doing the work in fewer places:
```suggestion
out.printf(fmt + "%n", args);
```
Of course, changing this would mean reverting the changes to the other lines in this file.
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -58,101 +58,103 @@ public static void main(String[] args) throws Exception {
}
}
}
- out(0, "State: " + stats.state.name());
- out(0, "Goal State: " + stats.goalState.name());
+ out(0, "State: %s%n", stats.state.name());
+ out(0, "Goal State: %s%n", stats.goalState.name());
if (stats.serversShuttingDown != null && !stats.serversShuttingDown.isEmpty()) {
- out(0, "Servers to shutdown");
+ out(0, "Servers to shutdown%n");
for (String server : stats.serversShuttingDown) {
- out(1, "%s", server);
+ out(1, "%s%n", server);
}
}
- out(0, "Unassigned tablets: %d", stats.unassignedTablets);
+ out(0, "Unassigned tablets: %d%n", stats.unassignedTablets);
if (stats.badTServers != null && !stats.badTServers.isEmpty()) {
- out(0, "Bad servers");
+ out(0, "Bad servers%n");
for (Entry<String,Byte> entry : stats.badTServers.entrySet()) {
- out(1, "%s: %d", entry.getKey(), (int) entry.getValue());
+ out(1, "%s: %d%n", entry.getKey(), (int) entry.getValue());
}
}
- out(0, "Dead tablet servers count: %s", stats.deadTabletServers.size());
+ out(0, "Dead tablet servers count: %s%n", stats.deadTabletServers.size());
for (DeadServer dead : stats.deadTabletServers) {
- out(1, "Dead tablet server: %s", dead.server);
- out(2, "Last report: %s", new SimpleDateFormat().format(new Date(dead.lastStatus)));
- out(2, "Cause: %s", dead.status);
+ out(1, "Dead tablet server: %s%n", dead.server);
+ out(2, "Last report: %s%n", new SimpleDateFormat().format(new Date(dead.lastStatus)));
+ out(2, "Cause: %s%n", dead.status);
}
- out(0, "Bulk imports: %s", stats.bulkImports.size());
+ out(0, "Bulk imports: %s%n", stats.bulkImports.size());
for (BulkImportStatus bulk : stats.bulkImports) {
- out(1, "Import directory: %s", bulk.filename);
- out(2, "Bulk state %s", bulk.state);
- out(2, "Bulk start %s", bulk.startTime);
+ out(1, "Import directory: %s%n", bulk.filename);
+ out(2, "Bulk state %s%n", bulk.state);
+ out(2, "Bulk start %s%n", bulk.startTime);
}
if (stats.tableMap != null && !stats.tableMap.isEmpty()) {
- out(0, "Tables");
+ out(0, "Tables%n");
for (Entry<String,TableInfo> entry : stats.tableMap.entrySet()) {
TableInfo v = entry.getValue();
- out(1, "%s", entry.getKey());
- out(2, "Records: %d", v.recs);
- out(2, "Records in Memory: %d", v.recsInMemory);
- out(2, "Tablets: %d", v.tablets);
- out(2, "Online Tablets: %d", v.onlineTablets);
- out(2, "Ingest Rate: %.2f", v.ingestRate);
- out(2, "Query Rate: %.2f", v.queryRate);
+ out(1, "%s%n", entry.getKey());
+ out(2, "Records: %d%n", v.recs);
+ out(2, "Records in Memory: %d%n", v.recsInMemory);
+ out(2, "Tablets: %d%n", v.tablets);
+ out(2, "Online Tablets: %d%n", v.onlineTablets);
+ out(2, "Ingest Rate: %.2f%n", v.ingestRate);
+ out(2, "Query Rate: %.2f%n", v.queryRate);
}
}
if (stats.tServerInfo != null && !stats.tServerInfo.isEmpty()) {
- out(0, "Tablet Servers");
+ out(0, "Tablet Servers%n");
long now = System.currentTimeMillis();
for (TabletServerStatus server : stats.tServerInfo) {
TableInfo summary = TableInfoUtil.summarizeTableStats(server);
- out(1, "Name: %s", server.name);
- out(2, "Ingest: %.2f", summary.ingestRate);
- out(2, "Last Contact: %s", server.lastContact);
- out(2, "OS Load Average: %.2f", server.osLoad);
- out(2, "Queries: %.2f", summary.queryRate);
- out(2, "Time Difference: %.1f", ((now - server.lastContact) / 1000.));
- out(2, "Total Records: %d", summary.recs);
- out(2, "Lookups: %d", server.lookups);
+ out(1, "Name: %s%n", server.name);
+ out(2, "Ingest: %.2f%n", summary.ingestRate);
+ out(2, "Last Contact: %s%n", server.lastContact);
+ out(2, "OS Load Average: %.2f%n", server.osLoad);
+ out(2, "Queries: %.2f%n", summary.queryRate);
+ out(2, "Time Difference: %.1f%n", ((now - server.lastContact) / 1000.));
+ out(2, "Total Records: %d%n", summary.recs);
+ out(2, "Lookups: %d%n", server.lookups);
if (server.holdTime > 0) {
- out(2, "Hold Time: %d", server.holdTime);
+ out(2, "Hold Time: %d%n", server.holdTime);
}
if (server.tableMap != null && !server.tableMap.isEmpty()) {
- out(2, "Tables");
+ out(2, "Tables%n");
for (Entry<String,TableInfo> status : server.tableMap.entrySet()) {
TableInfo info = status.getValue();
- out(3, "Table: %s", status.getKey());
- out(4, "Tablets: %d", info.onlineTablets);
- out(4, "Records: %d", info.recs);
- out(4, "Records in Memory: %d", info.recsInMemory);
- out(4, "Ingest: %.2f", info.ingestRate);
- out(4, "Queries: %.2f", info.queryRate);
- out(4, "Major Compacting: %d", info.majors == null ? 0 : info.majors.running);
- out(4, "Queued for Major Compaction: %d", info.majors == null ? 0 : info.majors.queued);
- out(4, "Minor Compacting: %d", info.minors == null ? 0 : info.minors.running);
- out(4, "Queued for Minor Compaction: %d", info.minors == null ? 0 : info.minors.queued);
+ out(3, "Table: %s%n", status.getKey());
+ out(4, "Tablets: %d%n", info.onlineTablets);
+ out(4, "Records: %d%n", info.recs);
+ out(4, "Records in Memory: %d%n", info.recsInMemory);
+ out(4, "Ingest: %.2f%n", info.ingestRate);
+ out(4, "Queries: %.2f%n", info.queryRate);
+ out(4, "Major Compacting: %d%n", info.majors == null ? 0 : info.majors.running);
+ out(4, "Queued for Major Compaction: %d%n",
+ info.majors == null ? 0 : info.majors.queued);
+ out(4, "Minor Compacting: %d%n", info.minors == null ? 0 : info.minors.running);
+ out(4, "Queued for Minor Compaction: %d%n",
+ info.minors == null ? 0 : info.minors.queued);
}
}
- out(2, "Recoveries: %d", server.logSorts.size());
+ out(2, "Recoveries: %d%n", server.logSorts.size());
for (RecoveryStatus sort : server.logSorts) {
- out(3, "File: %s", sort.name);
- out(3, "Progress: %.2f%%", sort.progress * 100);
- out(3, "Time running: %s", sort.runtime / 1000.);
+ out(3, "File: %s%n", sort.name);
+ out(3, "Progress: %.2f%%%n", sort.progress * 100);
+ out(3, "Time running: %s%n", sort.runtime / 1000.);
}
- out(3, "Bulk imports: %s", stats.bulkImports.size());
+ out(3, "Bulk imports: %s%n", stats.bulkImports.size());
for (BulkImportStatus bulk : stats.bulkImports) {
- out(4, "Import file: %s", bulk.filename);
- out(5, "Bulk state %s", bulk.state);
- out(5, "Bulk start %s", bulk.startTime);
+ out(4, "Import file: %s%n", bulk.filename);
+ out(5, "Bulk state %s%n", bulk.state);
+ out(5, "Bulk start %s%n", bulk.startTime);
}
}
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf(fmtString, args);
Review comment:
I think this makes more sense, so the rest of the file doesn't need to change.
```suggestion
System.out.printf(fmtString + "%n", args);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768226438
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -148,11 +148,11 @@ public static void main(String[] args) throws Exception {
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf((fmtString) + "%n", args);
Review comment:
Updated with proper newlines added in 76fa72c862
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r767843408
##########
File path: test/src/main/java/org/apache/accumulo/test/functional/YieldingIterator.java
##########
@@ -95,8 +95,8 @@ public void next() throws IOException {
*/
@Override
public Value getTopValue() {
- String value = Integer.toString(yieldNexts.get()) + ',' + Integer.toString(yieldSeeks.get())
- + ',' + Integer.toString(rebuilds.get());
+ String value =
+ Integer.toString(yieldNexts.get()) + ',' + yieldSeeks.get() + ',' + rebuilds.get();
Review comment:
Fixed in 4df7b130fc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#issuecomment-993614598
@ctubbsii I believe that this latest commit addresses all of your comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768226438
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -148,11 +148,11 @@ public static void main(String[] args) throws Exception {
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf((fmtString) + "%n", args);
Review comment:
Update with proper newlines added in #76fa72c862
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] DomGarguilo commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
DomGarguilo commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r769943327
##########
File path: test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
##########
@@ -124,7 +124,7 @@ private static String getTestClassName() {
Optional<String> callerClassName =
StackWalker.getInstance(RETAIN_CLASS_REFERENCE).walk(findCallerITClass).map(Class::getName);
// use the calling class name, or default to a unique name if IT class can't be found
- return callerClassName.orElse(String.format("UnknownITClass-{}-{}", System.currentTimeMillis(),
+ return callerClassName.orElse(String.format("UnknownITClass-%d-%s", System.currentTimeMillis(),
Review comment:
I saw this too but it does work either way since `%s` accepts any type even though we are expecting a long. Ran some tests in jshell to verify this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
ctubbsii commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r769918010
##########
File path: test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
##########
@@ -124,7 +124,7 @@ private static String getTestClassName() {
Optional<String> callerClassName =
StackWalker.getInstance(RETAIN_CLASS_REFERENCE).walk(findCallerITClass).map(Class::getName);
// use the calling class name, or default to a unique name if IT class can't be found
- return callerClassName.orElse(String.format("UnknownITClass-{}-{}", System.currentTimeMillis(),
+ return callerClassName.orElse(String.format("UnknownITClass-%d-%s", System.currentTimeMillis(),
Review comment:
@EdColeman Just pinging you for this one, because I'm not sure if you saw it. My guess is that it probably works fine either way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768093562
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -148,11 +148,11 @@ public static void main(String[] args) throws Exception {
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf((fmtString) + "%n", args);
Review comment:
I just accepted the IDE suggested changes - looking at your suggestion, I can't find where adding the %n is necessary to add to the calling fmt string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] ctubbsii commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
ctubbsii commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768013884
##########
File path: core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java
##########
@@ -94,20 +93,20 @@ public static void outputShellVariables(Map<String,String> config, PrintStream o
}
if (config.containsKey("compaction.coordinator")) {
- out.println(String.format(PROPERTY_FORMAT, "COORDINATOR_HOSTS",
- config.get("compaction.coordinator")));
+ out.printf((PROPERTY_FORMAT) + "%n", "COORDINATOR_HOSTS",
Review comment:
```suggestion
out.printf(PROPERTY_FORMAT + "%n", "COORDINATOR_HOSTS",
```
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
##########
@@ -129,7 +129,7 @@ private static void write(PrintStream out, int indent, String fmt, Object... arg
for (int i = 0; i < indent; i++) {
out.print(" ");
}
- out.println(String.format(fmt, args));
+ out.printf((fmt) + "%n", args);
Review comment:
```suggestion
out.printf(fmt + "%n", args);
```
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
##########
@@ -83,8 +83,8 @@ public int run(String[] args) throws Exception {
for (Entry<String,Long> entry : totalBlocks.entrySet()) {
final String host = entry.getKey();
final Long blocksForHost = entry.getValue();
- System.out.println(String.format("%15s %5.1f %8d", host,
- (localBlocks.get(host) * 100.) / blocksForHost, blocksForHost));
+ System.out.printf("%15s %5.1f %8d%n", host,
+ (localBlocks.get(host) * 100.) / blocksForHost, blocksForHost);
Review comment:
```suggestion
localBlocks.get(host) * 100. / blocksForHost, blocksForHost);
```
##########
File path: minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
##########
@@ -288,22 +288,22 @@ private static void setMemoryOnConfig(MiniAccumuloConfig config, String memorySt
private static void printInfo(MiniAccumuloCluster accumulo, int shutdownPort) {
System.out.println("Mini Accumulo Cluster\n");
- System.out.println(String.format(FORMAT_STRING, "Directory:",
- accumulo.getConfig().getDir().getAbsoluteFile()));
- System.out.println(String.format(FORMAT_STRING, "Logs:",
- accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile()));
- System.out.println(
- String.format(FORMAT_STRING, "Instance Name:", accumulo.getConfig().getInstanceName()));
- System.out.println(
- String.format(FORMAT_STRING, "Root Password:", accumulo.getConfig().getRootPassword()));
- System.out.println(String.format(FORMAT_STRING, "ZooKeeper:", accumulo.getZooKeepers()));
+ System.out.printf((FORMAT_STRING) + "%n", "Directory:",
+ accumulo.getConfig().getDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Logs:",
+ accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Instance Name:",
+ accumulo.getConfig().getInstanceName());
+ System.out.printf((FORMAT_STRING) + "%n", "Root Password:",
+ accumulo.getConfig().getRootPassword());
+ System.out.printf((FORMAT_STRING) + "%n", "ZooKeeper:", accumulo.getZooKeepers());
for (Pair<ServerType,Integer> pair : accumulo.getDebugPorts()) {
- System.out.println(String.format(FORMAT_STRING, pair.getFirst().prettyPrint() + " JDWP Host:",
- "localhost:" + pair.getSecond()));
+ System.out.printf((FORMAT_STRING) + "%n", pair.getFirst().prettyPrint() + " JDWP Host:",
Review comment:
```suggestion
System.out.printf(FORMAT_STRING + "%n", pair.getFirst().prettyPrint() + " JDWP Host:",
```
##########
File path: core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java
##########
@@ -94,20 +93,20 @@ public static void outputShellVariables(Map<String,String> config, PrintStream o
}
if (config.containsKey("compaction.coordinator")) {
- out.println(String.format(PROPERTY_FORMAT, "COORDINATOR_HOSTS",
- config.get("compaction.coordinator")));
+ out.printf((PROPERTY_FORMAT) + "%n", "COORDINATOR_HOSTS",
+ config.get("compaction.coordinator"));
}
if (config.containsKey("compaction.compactor.queue")) {
- out.println(String.format(PROPERTY_FORMAT, "COMPACTION_QUEUES",
- config.get("compaction.compactor.queue")));
+ out.printf((PROPERTY_FORMAT) + "%n", "COMPACTION_QUEUES",
+ config.get("compaction.compactor.queue"));
}
String queues = config.get("compaction.compactor.queue");
if (StringUtils.isNotEmpty(queues)) {
String[] q = queues.split(" ");
for (int i = 0; i < q.length; i++) {
if (config.containsKey("compaction.compactor." + q[i])) {
- out.println(String.format(PROPERTY_FORMAT, "COMPACTOR_HOSTS_" + q[i],
- config.get("compaction.compactor." + q[i])));
+ out.printf((PROPERTY_FORMAT) + "%n", "COMPACTOR_HOSTS_" + q[i],
Review comment:
```suggestion
out.printf(PROPERTY_FORMAT + "%n", "COMPACTOR_HOSTS_" + q[i],
```
##########
File path: core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java
##########
@@ -94,20 +93,20 @@ public static void outputShellVariables(Map<String,String> config, PrintStream o
}
if (config.containsKey("compaction.coordinator")) {
- out.println(String.format(PROPERTY_FORMAT, "COORDINATOR_HOSTS",
- config.get("compaction.coordinator")));
+ out.printf((PROPERTY_FORMAT) + "%n", "COORDINATOR_HOSTS",
+ config.get("compaction.coordinator"));
}
if (config.containsKey("compaction.compactor.queue")) {
- out.println(String.format(PROPERTY_FORMAT, "COMPACTION_QUEUES",
- config.get("compaction.compactor.queue")));
+ out.printf((PROPERTY_FORMAT) + "%n", "COMPACTION_QUEUES",
Review comment:
```suggestion
out.printf(PROPERTY_FORMAT + "%n", "COMPACTION_QUEUES",
```
##########
File path: core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java
##########
@@ -83,8 +83,7 @@ private static void flatten(String parentKey, String key, Object value,
public static void outputShellVariables(Map<String,String> config, PrintStream out) {
for (String section : SECTIONS) {
if (config.containsKey(section)) {
- out.println(
- String.format(PROPERTY_FORMAT, section.toUpperCase() + "_HOSTS", config.get(section)));
+ out.printf((PROPERTY_FORMAT) + "%n", section.toUpperCase() + "_HOSTS", config.get(section));
Review comment:
```suggestion
out.printf(PROPERTY_FORMAT + "%n", section.toUpperCase() + "_HOSTS", config.get(section));
```
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -148,11 +148,11 @@ public static void main(String[] args) throws Exception {
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf((fmtString) + "%n", args);
Review comment:
```suggestion
System.out.printf(fmtString + "%n", args);
```
##########
File path: minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
##########
@@ -288,22 +288,22 @@ private static void setMemoryOnConfig(MiniAccumuloConfig config, String memorySt
private static void printInfo(MiniAccumuloCluster accumulo, int shutdownPort) {
System.out.println("Mini Accumulo Cluster\n");
- System.out.println(String.format(FORMAT_STRING, "Directory:",
- accumulo.getConfig().getDir().getAbsoluteFile()));
- System.out.println(String.format(FORMAT_STRING, "Logs:",
- accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile()));
- System.out.println(
- String.format(FORMAT_STRING, "Instance Name:", accumulo.getConfig().getInstanceName()));
- System.out.println(
- String.format(FORMAT_STRING, "Root Password:", accumulo.getConfig().getRootPassword()));
- System.out.println(String.format(FORMAT_STRING, "ZooKeeper:", accumulo.getZooKeepers()));
+ System.out.printf((FORMAT_STRING) + "%n", "Directory:",
+ accumulo.getConfig().getDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Logs:",
+ accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Instance Name:",
+ accumulo.getConfig().getInstanceName());
+ System.out.printf((FORMAT_STRING) + "%n", "Root Password:",
+ accumulo.getConfig().getRootPassword());
+ System.out.printf((FORMAT_STRING) + "%n", "ZooKeeper:", accumulo.getZooKeepers());
Review comment:
```suggestion
System.out.printf(FORMAT_STRING + "%n", "Directory:",
accumulo.getConfig().getDir().getAbsoluteFile());
System.out.printf(FORMAT_STRING + "%n", "Logs:",
accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile());
System.out.printf(FORMAT_STRING + "%n", "Instance Name:",
accumulo.getConfig().getInstanceName());
System.out.printf(FORMAT_STRING + "%n", "Root Password:",
accumulo.getConfig().getRootPassword());
System.out.printf(FORMAT_STRING + "%n", "ZooKeeper:", accumulo.getZooKeepers());
```
##########
File path: minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloRunner.java
##########
@@ -288,22 +288,22 @@ private static void setMemoryOnConfig(MiniAccumuloConfig config, String memorySt
private static void printInfo(MiniAccumuloCluster accumulo, int shutdownPort) {
System.out.println("Mini Accumulo Cluster\n");
- System.out.println(String.format(FORMAT_STRING, "Directory:",
- accumulo.getConfig().getDir().getAbsoluteFile()));
- System.out.println(String.format(FORMAT_STRING, "Logs:",
- accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile()));
- System.out.println(
- String.format(FORMAT_STRING, "Instance Name:", accumulo.getConfig().getInstanceName()));
- System.out.println(
- String.format(FORMAT_STRING, "Root Password:", accumulo.getConfig().getRootPassword()));
- System.out.println(String.format(FORMAT_STRING, "ZooKeeper:", accumulo.getZooKeepers()));
+ System.out.printf((FORMAT_STRING) + "%n", "Directory:",
+ accumulo.getConfig().getDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Logs:",
+ accumulo.getConfig().getImpl().getLogDir().getAbsoluteFile());
+ System.out.printf((FORMAT_STRING) + "%n", "Instance Name:",
+ accumulo.getConfig().getInstanceName());
+ System.out.printf((FORMAT_STRING) + "%n", "Root Password:",
+ accumulo.getConfig().getRootPassword());
+ System.out.printf((FORMAT_STRING) + "%n", "ZooKeeper:", accumulo.getZooKeepers());
for (Pair<ServerType,Integer> pair : accumulo.getDebugPorts()) {
- System.out.println(String.format(FORMAT_STRING, pair.getFirst().prettyPrint() + " JDWP Host:",
- "localhost:" + pair.getSecond()));
+ System.out.printf((FORMAT_STRING) + "%n", pair.getFirst().prettyPrint() + " JDWP Host:",
+ "localhost:" + pair.getSecond());
}
- System.out.println(String.format(FORMAT_STRING, "Shutdown Port:", shutdownPort));
+ System.out.printf((FORMAT_STRING) + "%n", "Shutdown Port:", shutdownPort);
Review comment:
```suggestion
System.out.printf(FORMAT_STRING + "%n", "Shutdown Port:", shutdownPort);
```
##########
File path: test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
##########
@@ -95,8 +95,7 @@ public static void main(String[] args) throws Exception {
// populate
for (int i = 0; i < opts.count; i++) {
Mutation m = new Mutation(new Text(String.format("%06d", i)));
- m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"),
- new Value("junk"));
+ m.put(new Text("col" + ((i % 3) + 1)), new Text("qual"), new Value("junk"));
Review comment:
I think there's a CharSequence version of this:
```suggestion
m.put("col" + ((i % 3) + 1), "qual", "junk");
```
##########
File path: test/src/main/java/org/apache/accumulo/test/functional/TabletIT.java
##########
@@ -85,8 +85,7 @@ public void createTableTest(AccumuloClient accumuloClient, String tableName, boo
// populate
for (int i = 0; i < N; i++) {
Mutation m = new Mutation(new Text(String.format("%05d", i)));
- m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"),
- new Value("junk"));
+ m.put(new Text("col" + ((i % 3) + 1)), new Text("qual"), new Value("junk"));
Review comment:
```suggestion
m.put("col" + ((i % 3) + 1), "qual", "junk");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r770066358
##########
File path: test/src/main/java/org/apache/accumulo/harness/SharedMiniClusterBase.java
##########
@@ -124,7 +124,7 @@ private static String getTestClassName() {
Optional<String> callerClassName =
StackWalker.getInstance(RETAIN_CLASS_REFERENCE).walk(findCallerITClass).map(Class::getName);
// use the calling class name, or default to a unique name if IT class can't be found
- return callerClassName.orElse(String.format("UnknownITClass-{}-{}", System.currentTimeMillis(),
+ return callerClassName.orElse(String.format("UnknownITClass-%d-%s", System.currentTimeMillis(),
Review comment:
I did miss it - corrected in #2390.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768226991
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
##########
@@ -129,7 +129,7 @@ private static void write(PrintStream out, int indent, String fmt, Object... arg
for (int i = 0; i < indent; i++) {
out.print(" ");
}
- out.println(String.format(fmt, args));
+ out.printf((fmt) + "%n", args);
Review comment:
Updated with proper newlines added in #76fa72c862
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] DomGarguilo commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
DomGarguilo commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r767816143
##########
File path: test/src/main/java/org/apache/accumulo/test/functional/YieldingIterator.java
##########
@@ -95,8 +95,8 @@ public void next() throws IOException {
*/
@Override
public Value getTopValue() {
- String value = Integer.toString(yieldNexts.get()) + ',' + Integer.toString(yieldSeeks.get())
- + ',' + Integer.toString(rebuilds.get());
+ String value =
+ Integer.toString(yieldNexts.get()) + ',' + yieldSeeks.get() + ',' + rebuilds.get();
Review comment:
```suggestion
yieldNexts.get() + "," + yieldSeeks.get() + "," + rebuilds.get();
```
Could do this if we wanted to avoid using the first `Integer.toString` as well. Either way, LGTM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768093455
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
##########
@@ -129,7 +129,7 @@ private static void write(PrintStream out, int indent, String fmt, Object... arg
for (int i = 0; i < indent; i++) {
out.print(" ");
}
- out.println(String.format(fmt, args));
+ out.printf((fmt) + "%n", args);
Review comment:
I just accepted the IDE suggested changes - looking at your suggestion, I can't find where adding the %n is necessary to add to the calling fmt string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768227425
##########
File path: core/src/main/java/org/apache/accumulo/core/conf/cluster/ClusterConfigParser.java
##########
@@ -83,8 +83,7 @@ private static void flatten(String parentKey, String key, Object value,
public static void outputShellVariables(Map<String,String> config, PrintStream out) {
for (String section : SECTIONS) {
if (config.containsKey(section)) {
- out.println(
- String.format(PROPERTY_FORMAT, section.toUpperCase() + "_HOSTS", config.get(section)));
+ out.printf((PROPERTY_FORMAT) + "%n", section.toUpperCase() + "_HOSTS", config.get(section));
Review comment:
Not sure why, but I missed this and following comments - will address in next PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768226438
##########
File path: test/src/main/java/org/apache/accumulo/test/GetManagerStats.java
##########
@@ -148,11 +148,11 @@ public static void main(String[] args) throws Exception {
}
}
- private static void out(int indent, String string, Object... args) {
+ private static void out(int indent, String fmtString, Object... args) {
for (int i = 0; i < indent; i++) {
System.out.print(" ");
}
- System.out.println(String.format(string, args));
+ System.out.printf((fmtString) + "%n", args);
Review comment:
Updated with proper newlines added in #76fa72c862
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [accumulo] EdColeman commented on a change in pull request #2384: Fix IDE suggested string usage issues.
Posted by GitBox <gi...@apache.org>.
EdColeman commented on a change in pull request #2384:
URL: https://github.com/apache/accumulo/pull/2384#discussion_r768226991
##########
File path: server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
##########
@@ -129,7 +129,7 @@ private static void write(PrintStream out, int indent, String fmt, Object... arg
for (int i = 0; i < indent; i++) {
out.print(" ");
}
- out.println(String.format(fmt, args));
+ out.printf((fmt) + "%n", args);
Review comment:
Updated with proper newlines added in 76fa72c862
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org