Skip to content

Commit

Permalink
[refactor] simplify String operations and add JDK version into README (
Browse files Browse the repository at this point in the history
  • Loading branch information
legendtkl authored Mar 21, 2023
1 parent 556443f commit c024de9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Paimon tracks issues in GitHub and prefers to receive contributions as pull requ
<b style="color:red">Please make sure you are subscribed to the mailing list you are posting to!</b> If you are not subscribed to the mailing list, your message will either be rejected (dev@ list) or you won't receive the response (user@ list).

## Building
JDK 8 is required for building the project.

- Run the `mvn clean package -DskipTests` command to build the project.
- Run the `mvn spotless:apply` to format the project (both Java and Scala).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void main(String[] args) throws Exception {

String queriesValue = line.getOptionValue(QUERIES.getOpt());
List<Query> queries = Query.load(location);
if (!"all".equals(queriesValue.toLowerCase())) {
if (!"all".equalsIgnoreCase(queriesValue)) {
List<String> wantedQueries =
Arrays.stream(queriesValue.split(","))
.map(String::trim)
Expand All @@ -80,7 +80,7 @@ public static void main(String[] args) throws Exception {

String sinksValue = line.getOptionValue(SINKS.getOpt());
List<Sink> sinks = Sink.load(location);
if (!"all".equals(sinksValue.toLowerCase())) {
if (!"all".equalsIgnoreCase(sinksValue)) {
List<String> wantedSinks =
Arrays.stream(sinksValue.split(","))
.map(String::trim)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,7 @@ public String getCmdLine(String procfsDir) {
fReader =
new InputStreamReader(
new FileInputStream(
new File(
new File(procfsDir, pid.toString()),
PROCFS_CMDLINE_FILE)),
new File(new File(procfsDir, pid), PROCFS_CMDLINE_FILE)),
Charset.forName("UTF-8"));
} catch (FileNotFoundException f) {
// The process vanished in the interim!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private static String format(@Nullable String template, @Nullable Object... args
if (placeholderStart == -1) {
break;
}
builder.append(template.substring(templateStart, placeholderStart));
builder.append(template, templateStart, placeholderStart);
builder.append(args[i++]);
templateStart = placeholderStart + 2;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public static String replace(
increase *= max < 0 ? 16 : max > 64 ? 64 : max;
final StringBuilder buf = new StringBuilder(text.length() + increase);
while (end != INDEX_NOT_FOUND) {
buf.append(text.substring(start, end)).append(replacement);
buf.append(text, start, end).append(replacement);
start = end + replLength;
if (--max == 0) {
break;
Expand Down

0 comments on commit c024de9

Please sign in to comment.