Quantcast

NPE in spring-security-core 1.0.1 -> 1.2.1 upgrade

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

NPE in spring-security-core 1.0.1 -> 1.2.1 upgrade

jlust
I've hit a very weird problem, but unfortunately nothing I've tried helps. I've cleaned the project and its inline plugins a thousand times, deleted the ./grails/1.3.7/projects/... directories, even starting a new project copying over my artifacts, but it keeps coming back.

A NullPointerException is thrown at

> at org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils.isAjax(SpringSecurityUtils.java:299)

Checking the source code, I noticed that this is caused by the fact that

> ReflectionUtils.getConfigProperty("ajaxHeader");

returns null. So I started experimenting a little bit in the Bootstrap.groovy, and digging through the source code of the Spring Security Core plugin.

ReflectionUtils.getConfigProperty(name) looks like this:

> def value = SpringSecurityUtils.securityConfig
> for (String part in name.split('\\.')) {
> value = value."$part"
> }
> value
>

So I tried calling both this method, and a copy of its body in Bootstrap.groovy:

> def value = SpringSecurityUtils.securityConfig
> for (String part in "ajaxHeader".split('\\.')) {
> value = value."$part"
> }
> println value
> println ReflectionUtils.getConfigProperty("ajaxHeader")
>

The result was this:

> X-Requested-With
> null
>

So, calling the copy of the method body gave me the correct result, while calling the static method itself returned null. What is happening here? What could be causing this?

Jurgen
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: NPE in spring-security-core 1.0.1 -> 1.2.1 upgrade

jlust
Hi, I was eventually able to find the source of the problem myself, so I thought I'd share it:

In custom plugin I used in this project, I had an immutable Groovy class, i.e. annotated with @Immutable. As I had already reported on the Grails JIRA (http://jira.grails.org/browse/GRAILS-7205), this causes problems at compilation time. Apparently it also breaks something in the Spring Security Core plugin.

After replacing this immutable Groovy class with a Java equivalent, the problem is gone.

Jurgen

2011/5/16 Jurgen Lust <[hidden email]>
I've hit a very weird problem, but unfortunately nothing I've tried helps. I've cleaned the project and its inline plugins a thousand times, deleted the ./grails/1.3.7/projects/... directories, even starting a new project copying over my artifacts, but it keeps coming back.

A NullPointerException is thrown at

> at org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils.isAjax(SpringSecurityUtils.java:299)

Checking the source code, I noticed that this is caused by the fact that

> ReflectionUtils.getConfigProperty("ajaxHeader");

returns null. So I started experimenting a little bit in the Bootstrap.groovy, and digging through the source code of the Spring Security Core plugin.

ReflectionUtils.getConfigProperty(name) looks like this:

> def value = SpringSecurityUtils.securityConfig
> for (String part in name.split('\\.')) {
>       value = value."$part"
> }
> value
>

So I tried calling both this method, and a copy of its body in Bootstrap.groovy:

> def value = SpringSecurityUtils.securityConfig
> for (String part in "ajaxHeader".split('\\.')) {
>       value = value."$part"
> }
> println value
> println ReflectionUtils.getConfigProperty("ajaxHeader")
>

The result was this:

> X-Requested-With
> null
>

So, calling the copy of the method body gave me the correct result, while calling the static method itself returned null. What is happening here? What could be causing this?

Jurgen



--
Jurgen Lust
Master Software Craftsman
http://www.beeworks.be
+32-497-508911

Loading...