github-advanced-security[bot] commented on code in PR #3440:
URL: https://github.com/apache/avro/pull/3440#discussion_r2244826865
##########
lang/java/avro/src/test/java/org/apache/avro/reflect/TestAvroEncode.java:
##########
@@ -127,14 +127,15 @@
public static class R1Encoding extends CustomEncoding<R1> {
{
- schema = Schema.createRecord("R1", null, null, false,
- Arrays.asList(new Schema.Field("value",
Schema.create(Schema.Type.STRING), null, null)));
+ schema = Schema.createRecord("R1", null,
"org.apache.avro.reflect.TestAvroEncode", false,
+ Arrays.asList(new Schema.Field("value",
Schema.create(Schema.Type.INT), null, null)));
}
@Override
protected void write(Object datum, Encoder out) throws IOException {
if (datum instanceof R1) {
- out.writeString(((R1) datum).getValue());
+ var value = ((R1) datum).getValue();
+ out.writeInt(Integer.parseInt(value));
Review Comment:
## Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more
details](https://github.com/apache/avro/security/code-scanning/3340)
--
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]