Closed michaelkain closed 4 years ago
2020-09-11 11:43:08.139 ERROR 1 --- [http-nio-9904-exec-10] o.s.n.s.c.GlobalExceptionHandler : Unexpected error in the rest service.
java.lang.IllegalArgumentException: Failed to evaluate expression 'hasRole('ADMIN') or (hasAnyRole('EXPERT', 'USER') and @datasetSecurityService.hasRightOnAtLeastOneDataset(#datasetIds, 'CAN_DOWNLOAD'))'
at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:30)
at org.springframework.security.access.expression.method.ExpressionBasedPreInvocationAdvice.before(ExpressionBasedPreInvocationAdvice.java:59)
at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:72)
at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:40)
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:63)
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.shanoir.ng.dataset.controler.DatasetApiController$$EnhancerBySpringCGLIB$$8569ce68.massiveDownloadByDatasetIds(
2020-09-11 11:43:08.141 ERROR 1 --- [http-nio-9904-exec-10] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Failed to evaluate expression 'hasRole('ADMIN') or (hasAnyRole('EXPERT', 'USER') and @datasetSecurityService.hasRightOnAtLeastOneDataset(#datasetIds, 'CAN_DOWNLOAD'))'] with root cause
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.ArrayList<?>] to type [org.shanoir.ng.dataset.model.Dataset]
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:313)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195)
at org.springframework.core.convert.support.CollectionToCollectionConverter.convert(CollectionToCollectionConverter.java:87)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:36)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:192)
at org.springframework.expression.spel.support.StandardTypeConverter.convertValue(StandardTypeConverter.java:72)
at org.springframework.expression.spel.support.ReflectionHelper.convertArguments(ReflectionHelper.java:267)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:107)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:347)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:170)
at org.springframework.expression.spel.ast.OpAnd.getBooleanValue(OpAnd.java:56)
at org.springframework.expression.spel.ast.OpAnd.getValueInternal(OpAnd.java:51)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:170)
at org.springframework.expression.spel.ast.OpOr.getBooleanValue(OpOr.java:55)
at org.springframework.expression.spel.ast.OpOr.getValueInternal(OpOr.java:50)
at org.springframework.expression.spel.ast.OpOr.getValueInternal(OpOr.java:36)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:26)
at org.springframework.security.access.expression.method.ExpressionBasedPreInvocationAdvice.before(ExpressionBasedPreInvocationAdvice.java:59)
at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:72)
at org.springframework.security.access.prepost.PreInvocationAuthorizationAdviceVoter.vote(PreInvocationAuthorizationAdviceVoter.java:40)
at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:63)
at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:233)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.shanoir.ng.dataset.controler.DatasetApiController$$EnhancerBySpringCGLIB$$8569ce68.massiveDownloadByDatasetIds(
2020-09-11 11:43:08.143 ERROR 1 --- [http-nio-9904-exec-10] o.s.n.s.c.GlobalExceptionHandler : Unexpected error in the rest service.
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:260) at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:197) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:130) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:726) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:394) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254) at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:349) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)
I'm on it.
Hi Jean-Come, this issue unfortunately still remains in qualif. I can not download more than one dataset. By the way, sorry for not having seen this before, but please send the id list inside a post request. The limit of URL length is 250 chars, if I remember correctly, and this limit is reached very fast. Please fix this with highest priority to bring to work the qualif, and take your time to test. Please verify, that the created file name, with 50 datasets does not become to long too (I never tested this). With kind regards, Michael
I can download one datasets, this works.
I'll have a look at it this afternoon. For the post request, I should have thought about it myself, and for the file you are once again right, i'm putting all the IDs in it, I think it'll be too long quite fast.
For the bug in itself, can you check that the log/error is the same on the qualif than before? I tested it locally with a simple user and it worked well.
2020-09-14 10:10:08.407 WARN 1 --- [http-nio-9904-exec-8] o.s.n.s.c.GlobalExceptionHandler : Error in the rest service.
org.shanoir.ng.shared.exception.RestServiceException: null
at org.shanoir.ng.dataset.controler.DatasetApiController.massiveDownload(DatasetApiController.java:389)
at org.shanoir.ng.dataset.controler.DatasetApiController.massiveDownloadByDatasetIds(DatasetApiController.java:332)
at org.shanoir.ng.dataset.controler.DatasetApiController$$FastClassBySpringCGLIB$$c20c6b6b.invoke(
2020-09-14 10:10:08.414 ERROR 1 --- [http-nio-9904-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is {"code":422,"message":"Error while copying files.","details":{"cause":null,"stackTrace":[{"methodName":"copy","fileName":"UnixCopyFile.java","lineNumber":551,"className":"sun.nio.fs.UnixCopyFile","nativeMethod":false},{"methodName":"copy","fileName":"UnixFileSystemProvider.java","lineNumber":253,"className":"sun.nio.fs.UnixFileSystemProvider","nativeMethod":false},{"methodName":"copy","fileName":"Files.java","lineNumber":1274,"className":"java.nio.file.Files","nativeMethod":false},{"methodName":"copyNiftiFilesForURLs","fileName":"DatasetApiController.java","lineNumber":437,"className":"org.shanoir.ng.dataset.controler.DatasetApiController","nativeMethod":false},{"methodName":"massiveDownload","fileName":"DatasetApiController.java","lineNumber":378,"className":"org.shanoir.ng.dataset.controler.DatasetApiController","nativeMethod":false},{"methodName":"massiveDownloadByDatasetIds","fileName":"DatasetApiController.java","lineNumber":332,"className":"org.shanoir.ng.dataset.controler.DatasetApiController","nativeMethod":false},{"methodName":"invoke","fileName":"
org.shanoir.ng.shared.exception.RestServiceException: null
at org.shanoir.ng.dataset.controler.DatasetApiController.massiveDownload(DatasetApiController.java:389)
at org.shanoir.ng.dataset.controler.DatasetApiController.massiveDownloadByDatasetIds(DatasetApiController.java:332)
at org.shanoir.ng.dataset.controler.DatasetApiController$$FastClassBySpringCGLIB$$c20c6b6b.invoke(
2020-09-14 10:10:08.417 ERROR 1 --- [http-nio-9904-exec-8] o.s.n.s.c.GlobalExceptionHandler : Unexpected error in the rest service.
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:260) at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:197) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:130) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:726) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:394) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:311) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254) at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:349) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)
The behaviour is strange: most of the cases where I tried to download two files or more resulted in an error, but I found one example that worked... I think in any case having commas in an URL is not the best idea. Good luck with your presentation!
Yes, I thought I changed it (putting, "_" instead) but apparently no. Thanks, I'll clean this up this afternoon :) !
Chrome is blocking the "," in a download file, I'm changing this as I thought I already did. I'm alse changing the way we send IDs for URL limit pb.
I tested to download with firefox, I could not reproduce the problem, I could download all I wanted.
I used Firefox only where I had the problems, to see what happens if "," is replaced