HandlerMethodParameter defensively handles interface annotation arrays
Issue: SPR-17629
This commit is contained in:
parent
dc2535516c
commit
1faeeaea14
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -481,7 +481,9 @@ public class HandlerMethod {
|
||||||
if (anns == null) {
|
if (anns == null) {
|
||||||
anns = super.getParameterAnnotations();
|
anns = super.getParameterAnnotations();
|
||||||
for (Annotation[][] ifcAnns : getInterfaceParameterAnnotations()) {
|
for (Annotation[][] ifcAnns : getInterfaceParameterAnnotations()) {
|
||||||
Annotation[] paramAnns = ifcAnns[getParameterIndex()];
|
int index = getParameterIndex();
|
||||||
|
if (index < ifcAnns.length) {
|
||||||
|
Annotation[] paramAnns = ifcAnns[index];
|
||||||
if (paramAnns.length > 0) {
|
if (paramAnns.length > 0) {
|
||||||
List<Annotation> merged = new ArrayList<>(anns.length + paramAnns.length);
|
List<Annotation> merged = new ArrayList<>(anns.length + paramAnns.length);
|
||||||
merged.addAll(Arrays.asList(anns));
|
merged.addAll(Arrays.asList(anns));
|
||||||
|
@ -500,6 +502,7 @@ public class HandlerMethod {
|
||||||
anns = merged.toArray(new Annotation[0]);
|
anns = merged.toArray(new Annotation[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.combinedAnnotations = anns;
|
this.combinedAnnotations = anns;
|
||||||
}
|
}
|
||||||
return anns;
|
return anns;
|
||||||
|
|
Loading…
Reference in New Issue