Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration throws exception when allowedMethods contains List of methods instead of single string #24

Open
billjamesdev opened this issue Apr 5, 2018 · 1 comment

Comments

@billjamesdev
Copy link

In a Grails controller, there are two forms for the static allowedMethods.
static allowedMethods = [ 'actionName': 'POST' ] // for a single verb
or
static allowedMethods = [ 'actionName': [ 'POST', 'GET' ] ] // for allowing more than one verb against a single action

The code in Actions.java that reads those verbs currently assumes the value in the allowedMethods map will be a String, and throws a ClassCastException when you use the 2nd form above.
methods.add(RequestMethod.valueOf(allowedMethods.get(context.getAction())));
throws

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
at springfox.documentation.grails.Actions.methodOverrides(Actions.java:61)
at springfox.documentation.grails.Actions.methodOverrides(Actions.java:72)
at springfox.documentation.grails.GrailsActionAttributes.httpMethods(GrailsActionAttributes.java:63)
at springfox.documentation.grails.GrailsActionContext.(GrailsActionContext.java:47)
at springfox.documentation.grails.GrailsRequestHandlerProvider.lambda$fromGrailsAction$1(GrailsRequestHandlerProvider.java:57)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1548)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
...

@dilipkrish dilipkrish added the bug label Apr 8, 2018
@dilipkrish
Copy link
Member

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants