Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
java.lang.NumberFormatException:对于输入字符串:"&引用;在spring-beans4.3.6中_Java_Spring_Spring Boot_Annotations_Hibernate Validator - Fatal编程技术网

java.lang.NumberFormatException:对于输入字符串:"&引用;在spring-beans4.3.6中

java.lang.NumberFormatException:对于输入字符串:"&引用;在spring-beans4.3.6中,java,spring,spring-boot,annotations,hibernate-validator,Java,Spring,Spring Boot,Annotations,Hibernate Validator,从spring boot 1.4.2.RELEASE升级到1.5.1.RELEASE(新的spring-beans4.3.6.RELEASE附带)后,我的测试开始失败,出现以下错误: java.lang.NumberFormatException:用于输入字符串:“” 在我的代码中,我有自定义注释(在hibrenate-validator5.4.0.Final上),它是为ElementType.TYPE_使用和ElementType.TYPE_参数定义的,以便能够在集合上迭代 Set<@E

从spring boot 1.4.2.RELEASE升级到1.5.1.RELEASE(新的spring-beans4.3.6.RELEASE附带)后,我的测试开始失败,出现以下错误:

java.lang.NumberFormatException:用于输入字符串:“”

在我的代码中,我有自定义注释(在hibrenate-validator5.4.0.Final上),它是为ElementType.TYPE_使用和ElementType.TYPE_参数定义的,以便能够在集合上迭代

Set<@ElementSize(min = MIN_LENGTH, max = MAX_ID_LENGTH) String> ids
调试代码显示“key”保存集合中的空值“” 如果试图将其解析为整数,则会失败

这是spring中的一个bug还是一个改进,我需要修改我的代码来实现它

临时解决办法:


经过进一步调查,如果我们将hibernate validator的较低版本升级到5.2.4.Final,一切正常,我们可以将spring boot升级到1.5.1。

发布时请注意格式设置。在点击帖子之前,使用预览检查帖子是否合适。这次我对你的问题进行了编辑,使其更具可读性,但请以后自己修改。
Set<String> ids = new HashSet<>();
ids.add("");
else if (value instanceof Set) {
// Apply index to Iterator in case of a Set.    
Set<Object> set = (Set<Object>) value;
int index = **Integer.parseInt(key);**
if (index < 0 || index >= set.size()) {
    throw new InvalidPropertyException(getRootClass(),
              this.nestedPath + propertyName,
            "Cannot get element with index " + index + " 
             from Set of size " + set.size() + ", accessed 
             using property path '" + propertyName + "'");
}