FrankChen021 commented on code in PR #13192:
URL: https://github.com/apache/druid/pull/13192#discussion_r991758310
##########
extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/InlineDescriptorProtobufBytesDecoder.java:
##########
@@ -58,64 +53,22 @@ public String getDescriptorString()
return descriptorString;
}
- @JsonProperty
- public String getProtoMessageType()
- {
- return protoMessageType;
- }
-
- @VisibleForTesting
- void initDescriptor()
- {
- if (this.descriptor == null) {
- this.descriptor = getDescriptor(descriptorString);
- }
- }
-
@Override
- public DynamicMessage parse(ByteBuffer bytes)
+ protected DynamicSchema generateDynamicSchema()
{
- try {
- DynamicMessage message = DynamicMessage.parseFrom(descriptor,
ByteString.copyFrom(bytes));
- return message;
- }
- catch (Exception e) {
- throw new ParseException(null, e, "Fail to decode protobuf message!");
- }
- }
-
- private Descriptors.Descriptor getDescriptor(String descriptorString)
- {
- DynamicSchema dynamicSchema;
try {
byte[] decodedDesc = StringUtils.decodeBase64String(descriptorString);
- dynamicSchema = DynamicSchema.parseFrom(decodedDesc);
+ return DynamicSchema.parseFrom(decodedDesc);
+ }
+ catch (IllegalArgumentException e) {
+ throw new IAE("Descriptor string was did not have valid Base64
encoding.");
Review Comment:
```suggestion
throw new IAE("Descriptor string does not have valid Base64
encoding.");
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]