You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2019/11/29 00:21:31 UTC

[GitHub] [incubator-gobblin] zxcware commented on a change in pull request #2833: [GOBBLIN-987] Reject unrecognized Enum symbols in JsonRecordAvroSchemaToAvroConverter

zxcware commented on a change in pull request #2833: [GOBBLIN-987] Reject unrecognized Enum symbols in JsonRecordAvroSchemaToAvroConverter
URL: https://github.com/apache/incubator-gobblin/pull/2833#discussion_r351947678
 
 

 ##########
 File path: gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonElementConversionWithAvroSchemaFactory.java
 ##########
 @@ -165,7 +166,10 @@ public EnumConverter(String fieldName, boolean nullable, String sourceType, Sche
 
     @Override
     Object convertField(JsonElement value) {
-      return new GenericData.EnumSymbol(this.schema, value.getAsString());
+      String valueString = value.getAsString();
+      Validate.isTrue(this.enumSet.contains(valueString),
 
 Review comment:
   most of our check is done with guava `Preconditions`. Replace `Validate.isTrue` with `Preconditions` to be consistent and avoid introducing a new dependency?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services