Description
I was working on a modified version of ExceptionHandlingConfigurerTests.groovy shown below:
/* * Copyright 2002-2013 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. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.security.config.annotation.web.configurers import javax.servlet.http.HttpServletResponse import org.springframework.context.annotation.Configuration import org.springframework.http.MediaType import org.springframework.mock.web.MockFilterChain import org.springframework.mock.web.MockHttpServletRequest import org.springframework.mock.web.MockHttpServletResponse import org.springframework.security.config.annotation.AnyObjectPostProcessor import org.springframework.security.config.annotation.BaseSpringSpec import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter import org.springframework.security.web.access.ExceptionTranslationFilter /** * * @author Rob Winch */ class ExceptionHandlingConfigurerTests extends BaseSpringSpec { def "exception ObjectPostProcessor"() { setup: "initialize the AUTH_FILTER as a mock" AnyObjectPostProcessor opp = Mock() when: HttpSecurity http = new HttpSecurity(opp, authenticationBldr, [:]) http .exceptionHandling() .and() .build() then: "ExceptionTranslationFilter is registered with LifecycleManager" 1 * opp.postProcess(_ as ExceptionTranslationFilter) >> {ExceptionTranslationFilter o -> o} } def "SEC-2199: defaultEntryPoint for httpBasic and formLogin"(String acceptHeader, int httpStatus) { setup: loadConfig(HttpBasicAndFormLoginEntryPointsConfig) when: println "when" request.addHeader("Accept", acceptHeader) println "run filter" springSecurityFilterChain.doFilter(request,response,chain) println "response $response.status" then: println acceptHeader println response.status println httpStatus response.status == httpStatus println "asserted!" where: acceptHeader | httpStatus MediaType.ALL_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.APPLICATION_XHTML_XML_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.IMAGE_GIF_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.IMAGE_JPEG_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.IMAGE_PNG_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.TEXT_HTML_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.TEXT_PLAIN_VALUE | HttpServletResponse.SC_MOVED_TEMPORARILY MediaType.APPLICATION_ATOM_XML_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.APPLICATION_FORM_URLENCODED_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.APPLICATION_JSON_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.APPLICATION_OCTET_STREAM_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.APPLICATION_XML_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.MULTIPART_FORM_DATA_VALUE | HttpServletResponse.SC_UNAUTHORIZED MediaType.TEXT_XML_VALUE | HttpServletResponse.SC_UNAUTHORIZED } def "test"() { setup: String acceptHeader = MediaType.TEXT_XML_VALUE loadConfig(HttpBasicAndFormLoginEntryPointsConfig) when: request.addHeader("Accept", acceptHeader) springSecurityFilterChain.doFilter(request,response,chain) then: response.status == HttpServletResponse.SC_UNAUTHORIZED } @EnableWebSecurity @Configuration static class HttpBasicAndFormLoginEntryPointsConfig extends WebSecurityConfigurerAdapter { @Override protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER") } @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeUrls() .anyRequest().authenticated() .and() .httpBasic() .and() .formLogin() } } }
And got the following error
!ENTRY org.eclipse.jface.text 4 0 2013-07-18 16:02:15.946
!MESSAGE Unexpected runtime error while computing a text hover
!STACK 0
java.lang.IllegalArgumentException
at org.eclipse.jdt.core.Signature.getReturnType(Signature.java:1766)
at org.eclipse.jdt.core.Signature.getReturnType(Signature.java:1783)
at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabelComposer.appendMethodLabel(JavaElementLabelComposer.java:364)
at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabelComposer.appendElementLabel(JavaElementLabelComposer.java:270)
at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks.getElementLabel(JavaElementLinks.java:559)
at org.eclipse.jdt.internal.ui.viewsupport.JavaElementLinks.getElementLabel(JavaElementLinks.java:541)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getInfoText(JavadocHover.java:679)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:612)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:565)
at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:557)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:129)
at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:85)
at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)