Skip to content

Commit 4817991

Browse files
committed
more fixes
1 parent 5e2e4fa commit 4817991

8 files changed

Lines changed: 23 additions & 18 deletions

File tree

examples/java/src/main/java/org/apache/beam/examples/complete/datatokenization/utils/SchemasUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public static String getGcsFileAsString(String filePath) {
140140
result = FileSystems.match(filePath);
141141
checkArgument(
142142
result.status() == MatchResult.Status.OK && !result.metadata().isEmpty(),
143-
"Failed to match any files with the pattern: " + filePath);
143+
"Failed to match any files with the pattern: %s", filePath);
144144

145145
List<ResourceId> rId =
146146
result.metadata().stream()

runners/direct-java/src/main/java/org/apache/beam/runners/direct/SplittableProcessElementsEvaluatorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class SplittableProcessElementsEvaluatorFactory<
6565
public DoFnLifecycleManager load(final AppliedPTransform<?, ?, ?> application) {
6666
checkArgument(
6767
ProcessElements.class.isInstance(application.getTransform()),
68-
"No know extraction of the fn from " + application);
68+
"No know extraction of the fn from %s", application);
6969
final ProcessElements<
7070
InputT, OutputT, RestrictionT, PositionT, WatermarkEstimatorStateT>
7171
transform =

runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/GroupAlsoByWindowParDoFnFactory.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public ParDoFn create(
101101
SerializableUtils.deserializeFromByteArray(serializedCombineFn, "serialized combine fn");
102102
checkArgument(
103103
combineFnObj instanceof AppliedCombineFn,
104-
"unexpected kind of AppliedCombineFn: " + combineFnObj.getClass().getName());
104+
"unexpected kind of AppliedCombineFn: %s",
105+
combineFnObj.getClass().getName());
105106
combineFn = (AppliedCombineFn<?, ?, ?, ?>) combineFnObj;
106107
}
107108

@@ -110,14 +111,14 @@ public ParDoFn create(
110111
Coder<?> inputCoder = CloudObjects.coderFromCloudObject(CloudObject.fromSpec(inputCoderObject));
111112
checkArgument(
112113
inputCoder instanceof WindowedValueCoder,
113-
"Expected WindowedValueCoder for inputCoder, got: " + inputCoder.getClass().getName());
114+
"Expected WindowedValueCoder for inputCoder, got: %s", inputCoder.getClass().getName());
114115
@SuppressWarnings("unchecked")
115116
WindowedValueCoder<?> windowedValueCoder = (WindowedValueCoder<?>) inputCoder;
116117

117118
Coder<?> elemCoder = windowedValueCoder.getValueCoder();
118119
checkArgument(
119120
elemCoder instanceof KvCoder,
120-
"Expected KvCoder for inputCoder, got: " + elemCoder.getClass().getName());
121+
"Expected KvCoder for inputCoder, got: %s", elemCoder.getClass().getName());
121122
@SuppressWarnings("unchecked")
122123
KvCoder<?, ?> kvCoder = (KvCoder<?, ?>) elemCoder;
123124

runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/InMemoryReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public InMemoryReader(
6767
checkArgument(this.startIndex >= 0, "negative start index: %s", startIndex);
6868
checkArgument(
6969
this.endIndex >= this.startIndex,
70-
"end index before start: [" + this.startIndex + ", " + this.endIndex + ")");
70+
"end index before start: [%s, %s)", this.startIndex, this.endIndex);
7171
this.coder = coder;
7272
}
7373

sdks/java/core/src/main/java/org/apache/beam/sdk/io/TFRecordReadSchemaTransformConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public void validate() {
6363
if (errorHandling != null) {
6464
checkArgument(
6565
!Strings.isNullOrEmpty(errorHandling.getOutput()),
66-
invalidConfigMessage + "Output must not be empty if error handling specified.");
66+
"%sOutput must not be empty if error handling specified.",
67+
invalidConfigMessage);
6768
}
6869
}
6970

sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ public Schema(List<Field> fields, Options options) {
325325
for (Field field : this.fields) {
326326
Preconditions.checkArgument(
327327
fieldIndicesMutable.get(field.getName()) == null,
328-
"Duplicate field " + field.getName() + " added to schema");
328+
"Duplicate field %s added to schema",
329+
field.getName());
329330
encodingPositions.put(field.getName(), index);
330331
fieldIndicesMutable.put(field.getName(), index++);
331332
}

sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOWriteTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
check/*
22
* Licensed to the Apache Software Foundation (ASF) under one
33
* or more contributor license agreements. See the NOTICE file
44
* distributed with this work for additional information
@@ -540,7 +540,7 @@ private void verifySideInputs() {
540540
assertThat(
541541
fakeDatasetService.getAllRows("project-id", "dataset-id", "userid-" + entry.getKey()),
542542
containsInAnyOrder(Iterables.toArray(entry.getValue(), TableRow.class)));
543-
checkLineageSinkMetric(pipelineResult, "project-id.dataset-id.userid-%s" + entry.getKey());
543+
checkLineageSinkMetric(pipelineResult, "project-id.dataset-id.userid-" + entry.getKey());
544544
}
545545
}
546546

sdks/java/io/hadoop-format/src/main/java/org/apache/beam/sdk/io/hadoop/format/HadoopFormatIO.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,8 @@ private void validateConfiguration(Configuration configuration) {
555555
if (configuration.get("mapreduce.job.inputformat.class").endsWith("DBInputFormat")) {
556556
checkArgument(
557557
configuration.get(DBConfiguration.INPUT_ORDER_BY_PROPERTY) != null,
558-
"Configuration must contain \""
559-
+ DBConfiguration.INPUT_ORDER_BY_PROPERTY
560-
+ "\" when using DBInputFormat");
558+
"Configuration must contain \"%s\" when using DBInputFormat",
559+
DBConfiguration.INPUT_ORDER_BY_PROPERTY));
561560
}
562561
}
563562

@@ -1062,7 +1061,7 @@ public SerializableSplit() {}
10621061

10631062
public SerializableSplit(InputSplit split) {
10641063
checkArgument(
1065-
split instanceof Writable, String.format("Split is not of type Writable: %s", split));
1064+
split instanceof Writable, "Split is not of type Writable: %s", split);
10661065
this.inputSplit = split;
10671066
}
10681067

@@ -1684,14 +1683,17 @@ private void validateConfiguration(Configuration conf) {
16841683
checkArgument(conf != null, "Configuration can not be null");
16851684
checkArgument(
16861685
conf.get(OUTPUT_FORMAT_CLASS_ATTR) != null,
1687-
"Configuration must contain \"" + OUTPUT_FORMAT_CLASS_ATTR + "\"");
1686+
"Configuration must contain \"%s\"",
1687+
OUTPUT_FORMAT_CLASS_ATTR);
16881688
checkArgument(
16891689
conf.get(OUTPUT_KEY_CLASS) != null,
1690-
"Configuration must contain \"" + OUTPUT_KEY_CLASS + "\"");
1690+
"Configuration must contain \"%s\"",
1691+
OUTPUT_KEY_CLASS);
16911692
checkArgument(
16921693
conf.get(OUTPUT_VALUE_CLASS) != null,
1693-
"Configuration must contain \"" + OUTPUT_VALUE_CLASS + "\"");
1694-
checkArgument(conf.get(JOB_ID) != null, "Configuration must contain \"" + JOB_ID + "\"");
1694+
"Configuration must contain \"%s\"",
1695+
OUTPUT_VALUE_CLASS);
1696+
checkArgument(conf.get(JOB_ID) != null, "Configuration must contain \"%s\"", JOB_ID);
16951697
}
16961698

16971699
/**

0 commit comments

Comments
 (0)