You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/08/10 13:11:51 UTC

[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10434: fix validate violations is swallowed by ValidationException for issue#10415

AlbumenJ commented on code in PR #10434:
URL: https://github.com/apache/dubbo/pull/10434#discussion_r942432813


##########
dubbo-filter/dubbo-filter-validation/src/main/java/org/apache/dubbo/validation/support/jvalidation/JValidator.java:
##########
@@ -275,30 +275,30 @@ public void validate(String methodName, Class<?>[] parameterTypes, Object[] argu
             groups.add(1, clazz);
 
             // convert list to array
-            Class<?>[] classgroups = groups.toArray(new Class[groups.size()]);
+            Class<?>[] classGroups = groups.toArray(new Class[groups.size()]);
 
             Object parameterBean = getMethodParameterBean(clazz, method, arguments);
             if (parameterBean != null) {
-                violations.addAll(validator.validate(parameterBean, classgroups ));
+                violations.addAll(validator.validate(parameterBean, classGroups));
             }
 
             for (Object arg : arguments) {
-                validate(violations, arg, classgroups);
-            }
-
-            if (!violations.isEmpty()) {
-                logger.info("Failed to validate service: " + clazz.getName() + ", method: " + methodName + ", cause: " + violations);
-                throw new ConstraintViolationException("Failed to validate service: " + clazz.getName() + ", method: " + methodName + ", cause: " + violations, violations);
+                validate(violations, arg, classGroups);
             }
         } catch (ValidationException e) {
             // only use exception's message to avoid potential serialization issue
             throw new ValidationException(e.getMessage());

Review Comment:
   `javax.validation.ConstraintViolationException` might have potential serialization issue. Should be converted.



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org