test_class.file: dubbo-filter/dubbo-filter-validation/src/test/java/com/alibaba/dubbo/validation/support/jvalidation/JValidatorTest.java
test_class.identifier: JValidatorTest
test_case.body: @Test(expected = ConstraintViolationException.class)
      public void testItWhenItViolatedConstraint() throws Exception {
          URL url = URL.valueOf("test://test:11/com.alibaba.dubbo.validation.support.jvalidation.mock.JValidatorTestTarget");
          JValidator jValidator = new JValidator(url);
          jValidator.validate("someMethod2", new Class<?>[]{ValidationParameter.class}, new Object[]{new ValidationParameter()});
      }
test_case.class_method_signature: JValidatorTest.testItWhenItViolatedConstraint()
test_case.full_signature: @Test(expected = ConstraintViolationException.class) public void testItWhenItViolatedConstraint()
test_case.identifier: testItWhenItViolatedConstraint
test_case.invocations: valueOf validate
test_case.modifiers: @Test(expected = ConstraintViolationException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testItWhenItViolatedConstraint()
focal_class.declarator: logger = LoggerFactory.getLogger(JValidator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(JValidator.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: clazz
focal_class.modifier: private final
focal_class.original_string: private final Class<?> clazz;
focal_class.type: Class<?>
focal_class.var_name: clazz
focal_class.declarator: validator
focal_class.modifier: private final
focal_class.original_string: private final javax.validation.Validator validator;
focal_class.type: javax.validation.Validator
focal_class.var_name: validator
focal_class.file: dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/support/jvalidation/JValidator.java
focal_class.identifier: JValidator
focal_class.interfaces: implements Validator
focal_class.class_method_signature: JValidator.JValidator(URL url)
focal_class.full_signature: @SuppressWarnings({"unchecked", "rawtypes"}) public  JValidator(URL url)
focal_class.identifier: JValidator
focal_class.modifiers: @SuppressWarnings({"unchecked", "rawtypes"}) public
focal_class.parameters: (URL url)
focal_class.signature:  JValidator(URL url)
focal_class.class_method_signature: JValidator.isPrimitives(Class<?> cls)
focal_class.full_signature: private static boolean isPrimitives(Class<?> cls)
focal_class.identifier: isPrimitives
focal_class.modifiers: private static
focal_class.parameters: (Class<?> cls)
focal_class.return: boolean
focal_class.signature: boolean isPrimitives(Class<?> cls)
focal_class.class_method_signature: JValidator.isPrimitive(Class<?> cls)
focal_class.full_signature: private static boolean isPrimitive(Class<?> cls)
focal_class.identifier: isPrimitive
focal_class.modifiers: private static
focal_class.parameters: (Class<?> cls)
focal_class.return: boolean
focal_class.signature: boolean isPrimitive(Class<?> cls)
focal_class.class_method_signature: JValidator.getMethodParameterBean(Class<?> clazz, Method method, Object[] args)
focal_class.full_signature: private static Object getMethodParameterBean(Class<?> clazz, Method method, Object[] args)
focal_class.identifier: getMethodParameterBean
focal_class.modifiers: private static
focal_class.parameters: (Class<?> clazz, Method method, Object[] args)
focal_class.return: Object
focal_class.signature: Object getMethodParameterBean(Class<?> clazz, Method method, Object[] args)
focal_class.class_method_signature: JValidator.generateMethodParameterClassName(Class<?> clazz, Method method)
focal_class.full_signature: private static String generateMethodParameterClassName(Class<?> clazz, Method method)
focal_class.identifier: generateMethodParameterClassName
focal_class.modifiers: private static
focal_class.parameters: (Class<?> clazz, Method method)
focal_class.return: String
focal_class.signature: String generateMethodParameterClassName(Class<?> clazz, Method method)
focal_class.class_method_signature: JValidator.hasConstraintParameter(Method method)
focal_class.full_signature: private static boolean hasConstraintParameter(Method method)
focal_class.identifier: hasConstraintParameter
focal_class.modifiers: private static
focal_class.parameters: (Method method)
focal_class.return: boolean
focal_class.signature: boolean hasConstraintParameter(Method method)
focal_class.class_method_signature: JValidator.toUpperMethoName(String methodName)
focal_class.full_signature: private static String toUpperMethoName(String methodName)
focal_class.identifier: toUpperMethoName
focal_class.modifiers: private static
focal_class.parameters: (String methodName)
focal_class.return: String
focal_class.signature: String toUpperMethoName(String methodName)
focal_class.class_method_signature: JValidator.createMemberValue(ConstPool cp, CtClass type, Object value)
focal_class.full_signature: private static MemberValue createMemberValue(ConstPool cp, CtClass type, Object value)
focal_class.identifier: createMemberValue
focal_class.modifiers: private static
focal_class.parameters: (ConstPool cp, CtClass type, Object value)
focal_class.return: MemberValue
focal_class.signature: MemberValue createMemberValue(ConstPool cp, CtClass type, Object value)
focal_class.class_method_signature: JValidator.validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_class.full_signature: @Override public void validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_class.identifier: validate
focal_class.modifiers: @Override public
focal_class.parameters: (String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_class.return: void
focal_class.signature: void validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_class.class_method_signature: JValidator.validate(Set<ConstraintViolation<?>> violations, Object arg, Class<?>... groups)
focal_class.full_signature: private void validate(Set<ConstraintViolation<?>> violations, Object arg, Class<?>... groups)
focal_class.identifier: validate
focal_class.modifiers: private
focal_class.parameters: (Set<ConstraintViolation<?>> violations, Object arg, Class<?>... groups)
focal_class.return: void
focal_class.signature: void validate(Set<ConstraintViolation<?>> violations, Object arg, Class<?>... groups)
focal_method.body: @Override
      public void validate(String methodName, Class<?>[] parameterTypes, Object[] arguments) throws Exception {
          List<Class<?>> groups = new ArrayList<Class<?>>();
          String methodClassName = clazz.getName() + "$" + toUpperMethoName(methodName);
          Class<?> methodClass = null;
          try {
              methodClass = Class.forName(methodClassName, false, Thread.currentThread().getContextClassLoader());
              groups.add(methodClass);
          } catch (ClassNotFoundException e) {
          }
          Set<ConstraintViolation<?>> violations = new HashSet<ConstraintViolation<?>>();
          Method method = clazz.getMethod(methodName, parameterTypes);
          Class<?>[] methodClasses = null;
          if (method.isAnnotationPresent(MethodValidated.class)){
              methodClasses = method.getAnnotation(MethodValidated.class).value();
              groups.addAll(Arrays.asList(methodClasses));
          }
          // add into default group
          groups.add(0, Default.class);
          groups.add(1, clazz);
  
          // convert list to array
          Class<?>[] classgroups = groups.toArray(new Class[0]);
  
          Object parameterBean = getMethodParameterBean(clazz, method, arguments);
          if (parameterBean != null) {
              violations.addAll(validator.validate(parameterBean, classgroups ));
          }
  
          for (Object arg : arguments) {
              validate(violations, arg, classgroups);
          }
  
          if (!violations.isEmpty()) {
              logger.error("Failed to validate service: " + clazz.getName() + ", method: " + methodName + ", cause: " + violations);
              throw new ConstraintViolationException("Failed to validate service: " + clazz.getName() + ", method: " + methodName + ", cause: " + violations, violations);
          }
      }
focal_method.class_method_signature: JValidator.validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_method.full_signature: @Override public void validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_method.identifier: validate
focal_method.invocations: getName toUpperMethoName forName getContextClassLoader currentThread add getMethod isAnnotationPresent value getAnnotation addAll asList add add toArray getMethodParameterBean addAll validate validate isEmpty error getName getName
focal_method.modifiers: @Override public
focal_method.parameters: (String methodName, Class<?>[] parameterTypes, Object[] arguments)
focal_method.return: void
focal_method.signature: void validate(String methodName, Class<?>[] parameterTypes, Object[] arguments)