BeanFields Plugin

NullPointerException on Grails 2.0.0.M2 - Cannot get property 'class' on null object

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.0
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Since moving to Grails 2.0.0.M2 there seems to be issues with beanfields in all basic uses of beanfields 1.0-RC3. Generated with a tiny sample app (attached) which is all scaffold with a custom create/edit page that uses beanfields. Create a book and life will die. The line that NPEs is in the TabLib:

def domainArtefact = grailsApplication.getArtefact(DomainClassArtefactHandler.TYPE, attrs._BEAN.bean.class.name)

Where bean seems to be null. Didn't have this issue on Grails 2.0.0.M1, so there's something weird going on! Here's the stack trace:

Error 2011-09-08 11:31:37,013 ["http-bio-8080"-exec-6] ERROR errors.GrailsExceptionResolver - NullPointerException oc
curred when processing request: [GET] /bustedbean/book/edit/1
Cannot get property 'class' on null object. Stacktrace follows:
Line
Method
->> 28
runTask in \grails-app\views\book\edit.gsp
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by GrailsTagException: Error executing tag <bean:form>: Cannot get property 'class' on null object
->> 28 | doCall in C:/TEMP/bustedbean/grails-app/views/book/edit.gsp

  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Caused by NullPointerException: Cannot get property 'class' on null object
->> 484 | doCall in com.grailsrocks.beanfields.BeanTagLib$_closure28

  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    413 doCall in com.grailsrocks.beanfields.BeanTagLib$_closure25_closure55
    412 doCall in com.grailsrocks.beanfields.BeanTagLib$_closure25
    63 doCall in C__TEMP_bustedbean_grails_app_views_book_edit_gsp$_run_closure2
    66 run . . in C__TEMP_bustedbean_grails_app_views_book_edit_gsp
    886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
    908 run . . in ''
    ^ 662
    run in java.lang.Thread

Issue Links

Activity

Hide
Glen Smith added a comment -

Sorry about the wiki-fied stacktrace! Further to the above...

Did a little more digging and it seems that attrs._BEAN has changed in 2.0.0.M2. When I change the taglib to dump things out:

println "_BEAN is: ${attrs?._BEAN?.dump()}"
def domainArtefact = grailsApplication.getArtefact(DomainClassArtefactHandler.TYPE, attrs._BEAN.bean.class.name)

_BEAN is: <java.util.LinkedHashMap@dc44e0f1 header=null=null accessOrder=false table=[value=null, null, beanName=bookIns
tance, null, bean=null, originalPropertyPath=name, null, null] size=5 threshold=6 loadFactor=0.75 modCount=5 entrySet=[o
riginalPropertyPath=name, propertyName=name, beanName=bookInstance, bean=null, value=null] keySet=null values=null>

The beanName is right, and the propertyname, but it seems the bean and value attrs are all null! Perhaps this stuff has been refactored in Grails 2.0.0.M2?

Thanks,

Glen.

Show
Glen Smith added a comment - Sorry about the wiki-fied stacktrace! Further to the above... Did a little more digging and it seems that attrs._BEAN has changed in 2.0.0.M2. When I change the taglib to dump things out: println "_BEAN is: ${attrs?._BEAN?.dump()}" def domainArtefact = grailsApplication.getArtefact(DomainClassArtefactHandler.TYPE, attrs._BEAN.bean.class.name) _BEAN is: <java.util.LinkedHashMap@dc44e0f1 header=null=null accessOrder=false table=[value=null, null, beanName=bookIns tance, null, bean=null, originalPropertyPath=name, null, null] size=5 threshold=6 loadFactor=0.75 modCount=5 entrySet=[o riginalPropertyPath=name, propertyName=name, beanName=bookInstance, bean=null, value=null] keySet=null values=null> The beanName is right, and the propertyname, but it seems the bean and value attrs are all null! Perhaps this stuff has been refactored in Grails 2.0.0.M2? Thanks, Glen.
Hide
Marc Palmer added a comment -

This is caused by a regression in Grails 2 m2 - see GRAILS-8001

Show
Marc Palmer added a comment - This is caused by a regression in Grails 2 m2 - see GRAILS-8001
Hide
Marc Palmer added a comment -

The code in bean-fields is fine, but Grails has changed behaviour in 2m2

Show
Marc Palmer added a comment - The code in bean-fields is fine, but Grails has changed behaviour in 2m2
Hide
Lari Hotari added a comment -

GRAILS-8001 is fixed now.

Show
Lari Hotari added a comment - GRAILS-8001 is fixed now.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: