Grails项目中的Groovy代码在值集合find()迭代期间抛出MissingPropertyException。它不会每次都发生,只是有时候我没有找到发生MissingPropertyException的情况。
以下是枚举类:
public enum SurveyStateTransitions {
TRANSITION_ONE(SurveyState.UNDEFINED, [SurveyState.ACQUISITION, SurveyState.PROCESSING] as Set),
TRANSITION_TWO(SurveyState.ACQUISITION, [SurveyState.PROCESSING, SurveyState.ARCHIVED] as Set),
private SurveyState current
private Set<SurveyState> transitions
SurveyStateTransitions(SurveyState current, Set<SurveyState> transitions) {
this.current = current
this.transitions = transitions
}
public static Set<SurveyState> getTransitions(SurveyState current) {
values().find { it.current == current }.transitions
}
}
以下是实际抛出异常的行:
values().find { it.current == current }.transitions
整个堆栈跟踪:
[2015-12-09 11:26:51,762] ERROR errors.GrailsExceptionResolver MissingPropertyException occurred when processing request: [GET] /marpinion_portal/survey/detail/122
No such property: current for class: de.everywhere.marpinion.portal.survey.SurveyState. Stacktrace follows:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <mpc:surveyAccess>: Error executing tag <mps:butt
ons>: No such property: current for class: de.everywhere.marpinion.portal.survey.SurveyState
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <mpc:surveyAccess>: Error executing tag <mps:buttons>: No such property:
current for class: de.everywhere.marpinion.portal.survey.SurveyState
at gsp_marpinion_portal_surveydetail_gsp$_run_closure2.doCall(gsp_marpinion_portal_surveydetail_gsp.groovy:248)
at gsp_marpinion_portal_surveydetail_gsp.run(gsp_marpinion_portal_surveydetail_gsp.groovy:251)
... 8 more
Caused by: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <mps:buttons>: No such property: current for class: de.everywhere.marpin
ion.portal.survey.SurveyState
at gsp_marpinion_portal_surveydetail_gsp$_run_closure2_closure10.doCall(gsp_marpinion_portal_surveydetail_gsp.groovy:245)
at de.everywhere.marpinion.portal.CrudTagLib$_closure30.doCall(CrudTagLib.groovy:656)
... 10 more
Caused by: groovy.lang.MissingPropertyException: No such property: current for class: de.everywhere.marpinion.portal.survey.SurveyState
at de.everywhere.marpinion.portal.survey.SurveyStateTransitions$_getTransitions_closure1.doCall(SurveyStateTransitions.groovy:33)
at de.everywhere.marpinion.portal.survey.SurveyStateTransitions.getTransitions(SurveyStateTransitions.groovy:33)
at de.everywhere.marpinion.portal.SurveyTagLib$_closure8.doCall(SurveyTagLib.groovy:78)
... 12 more
[2015-12-09 11:26:53,042] WARN resource.ResourceTagLib A request was made to render resources for disposition [body] but there are no resources scheduled for that
感谢您的帮助。