Consistent use of ClassUtils.toClassArray (and related polishing)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -330,7 +330,7 @@ public abstract class AbstractMessageSource extends MessageSourceSupport impleme
|
||||
resolvedArgs.add(arg);
|
||||
}
|
||||
}
|
||||
return resolvedArgs.toArray(new Object[resolvedArgs.size()]);
|
||||
return resolvedArgs.toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.springframework.validation.beanvalidation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -34,6 +34,7 @@ import org.springframework.beans.NotReadablePropertyException;
|
||||
import org.springframework.context.MessageSourceResolvable;
|
||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.FieldError;
|
||||
@@ -115,7 +116,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
}
|
||||
}
|
||||
processConstraintViolations(
|
||||
this.targetValidator.validate(target, groups.toArray(new Class<?>[groups.size()])), errors);
|
||||
this.targetValidator.validate(target, ClassUtils.toClassArray(groups)), errors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +216,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
* @see org.springframework.validation.DefaultBindingErrorProcessor#getArgumentsForBindError
|
||||
*/
|
||||
protected Object[] getArgumentsForConstraint(String objectName, String field, ConstraintDescriptor<?> descriptor) {
|
||||
List<Object> arguments = new LinkedList<Object>();
|
||||
List<Object> arguments = new ArrayList<Object>();
|
||||
arguments.add(getResolvableField(objectName, field));
|
||||
// Using a TreeMap for alphabetical ordering of attribute names
|
||||
Map<String, Object> attributesToExpose = new TreeMap<String, Object>();
|
||||
@@ -230,7 +231,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
}
|
||||
}
|
||||
arguments.addAll(attributesToExpose.values());
|
||||
return arguments.toArray(new Object[arguments.size()]);
|
||||
return arguments.toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user