martin-g commented on code in PR #3376:
URL: https://github.com/apache/avro/pull/3376#discussion_r2084459467


##########
lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java:
##########
@@ -128,31 +150,43 @@ private boolean trustAllPackages() {
     return (trustedPackages.size() == 1 && "*".equals(trustedPackages.get(0)));
   }
 
-  private void checkSecurity(Class clazz) throws ClassNotFoundException {
-    if (trustAllPackages() || clazz.isPrimitive()) {
+  private void checkSecurity(String className) throws ClassNotFoundException {
+    if (trustAllPackages() || PRIMITIVES.contains(className)) {
       return;
     }
 
+    for (String trustedClass : getTrustedClasses()) {
+      if (className.equals(trustedClass)) {
+        return;
+      }
+    }
+
     boolean found = false;

Review Comment:
   nit: This flag is not really needed. Above you use `return`. You could do 
the same for trustedPackages too.



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