Skip to content

Commit 6a7ef33

Browse files
authored
[Java] Fix expensive OneOfType precondition messages by making them lazy (#36063)
1 parent d2fdabb commit 6a7ef33

File tree

1 file changed

+2
-2
lines changed
  • sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ public Value toInputType(Row base) {
155155
for (int i = 0; i < base.getFieldCount(); ++i) {
156156
Object value = base.getValue(i);
157157
if (value != null) {
158-
checkArgument(caseType == null, "More than one field set in union " + this);
158+
checkArgument(caseType == null, "More than one field set in union %s", this);
159159
caseType = enumerationType.valueOf(oneOfSchema.getField(i).getName());
160160
oneOfValue = value;
161161
}
162162
}
163-
checkNotNull(oneOfValue, "No value set in union" + this);
163+
checkNotNull(oneOfValue, "No value set in union %s", this);
164164
return createValue(caseType, oneOfValue);
165165
}
166166

0 commit comments

Comments
 (0)