ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

DSL code causing NullPointerException #320

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a @Typed Grails controller with a closure property:

    static accessControl = {
        // Alternatively, several actions can be specified.
        role(name: 'Editor', only:['createNews','editWikiPage','markupWikiPage', 'saveWikiPage', 'createWikiPage', 'postComment'] )
        role(name: 'Administrator', action: 'rollbackWikiVersion' )
    }

This is read by the Shiro plugin, but on startup I'm getting a 
NullPointerException:

2010-11-25 12:30:55,580 
[ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR 
plugins.DefaultGrailsPluginManager  - Error configuring dynamic methods for 
plugin [shiro:1.1.1]: null
java.lang.NullPointerException
    at org.grails.ContentController$_clinit_$1.doCall(ContentController.groovy:27)
    at org.grails.ContentController$_clinit_$1.doCall(ContentController.groovy)
    at ShiroGrailsPlugin.processController(ShiroGrailsPlugin.groovy:568)
    at ShiroGrailsPlugin$_closure3_closure22.doCall(ShiroGrailsPlugin.groovy:224)
    at ShiroGrailsPlugin$_closure3.doCall(ShiroGrailsPlugin.groovy:223)
    at java.lang.Thread.run(Thread.java:680)

Line 27 of ContentController is the first role() method call. The Shiro plugin 
code that reads the closure is:

            // Process the closure, building a map of actions to permissions and a map of actions to roles.
            def b = new AccessControlBuilder(clazz)
            c.delegate = b
            c.call()

where line 568 is that c.call(). This was working before the controller was 
typed.

Original issue reported on code.google.com by p.ledbr...@gmail.com on 25 Nov 2010 at 1:17

GoogleCodeExporter commented 8 years ago
Just execute 'grails run-app' with the attached Grails project. You'll need 
Grails 1.3.5 and the gpp plugin installed.

Original comment by p.ledbr...@gmail.com on 12 Dec 2010 at 10:57

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by alex.tka...@gmail.com on 2 Jan 2011 at 8:34