nastra commented on code in PR #17125:
URL: https://github.com/apache/iceberg/pull/17125#discussion_r3765978993


##########
core/src/main/java/org/apache/iceberg/avro/AvroEncoderUtil.java:
##########
@@ -73,9 +74,8 @@ public static <T> T decode(byte[] data) throws IOException {
       byte header1 = dataInput.readByte();
       Preconditions.checkState(
           header0 == MAGIC_BYTES[0] && header1 == MAGIC_BYTES[1],
-          "Unrecognized header bytes: 0x%02X 0x%02X",
-          header0,
-          header1);
+          "%s",
+          String.format(Locale.ROOT, "Unrecognized header bytes: 0x%02X 
0x%02X", header0, header1));

Review Comment:
   In this case we might want to slightly change this to 
   ```
   if (header0 != MAGIC_BYTES[0] || header1 != MAGIC_BYTES[1]) {
     throw new IllegalStateException(
         String.format(Locale.ROOT, "Unrecognized header bytes: 0x%02X 0x%02X", 
header0, header1));
   }
   ```
   
   as otherwise we're building the error msg on every successful decode



-- 
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]

Reply via email to