Polber commented on code in PR #30625:
URL: https://github.com/apache/beam/pull/30625#discussion_r1530776385


##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaReadSchemaTransformConfiguration.java:
##########
@@ -59,20 +63,25 @@ public void validate() {
     final String confluentSchemaRegSubject = 
this.getConfluentSchemaRegistrySubject();
 
     if (confluentSchemaRegUrl != null) {
-      assert confluentSchemaRegSubject != null
-          : "To read from Kafka, a schema must be provided directly or though 
Confluent "
-              + "Schema Registry. Make sure you are providing one of these 
parameters.";
+      checkArgument(
+          confluentSchemaRegSubject != null,
+          "To read from Kafka, a schema must be provided directly or though 
Confluent "
+              + "Schema Registry. Make sure you are providing one of these 
parameters.");
     } else if (dataFormat != null && dataFormat.equals("RAW")) {
-      assert inputSchema == null : "To read from Kafka in RAW format, you 
can't provide a schema.";
+      checkArgument(
+          inputSchema == null, "To read from Kafka in RAW format, you can't 
provide a schema.");
     } else if (dataFormat != null && dataFormat.equals("JSON")) {
-      assert inputSchema != null : "To read from Kafka in JSON format, you 
must provide a schema.";
+      checkArgument(
+          inputSchema != null, "To read from Kafka in JSON format, you must 
provide a schema.");
     } else if (dataFormat != null && dataFormat.equals("PROTO")) {
-      assert messageName != null
-          : "To read from Kafka in PROTO format, messageName must be 
provided.";
-      assert fileDescriptorPath != null || inputSchema != null
-          : "To read from Kafka in PROTO format, fileDescriptorPath or schema 
must be provided.";
+      checkArgument(
+          messageName != null, "To read from Kafka in PROTO format, 
messageName must be provided.");
+      checkArgument(
+          fileDescriptorPath != null || inputSchema != null,
+          "To read from Kafka in PROTO format, fileDescriptorPath or schema 
must be provided.");
     } else {
-      assert inputSchema != null : "To read from Kafka in AVRO format, you 
must provide a schema.";
+      checkArgument(
+          inputSchema != null, "To read from Kafka in AVRO format, you must 
provide a schema.");

Review Comment:
   Good point. Let me refactor that and push before emrging



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to