Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error when displaying captcha #14

Closed
rvargas opened this Issue · 5 comments

3 participants

@rvargas

Hi

I am having an error 500 when trying to display a captcha. I am using version 0.6.6 of your plugin and grails 2.2.2

Error is:

Class
groovy.lang.MissingMethodException
Message
No signature of method: static com.megatome.grails.util.ConfigHelper.booleanValue() is applicable for argument types: (java.lang.Boolean, java.lang.Boolean) values: [true, false] Possible solutions: booleanValue(java.lang.Object)

* Get a value indicating if the ReCaptcha plugin should be enabled.
130:     */
131:    def isEnabled() {
132:        return ConfigHelper.booleanValue(getRecaptchaConfig().enabled, false)
133:    }
134:
135:    /**

26:     * Evaluates the content of the tag if ReCaptcha support is enabled. This value is set in config.
27:     */
28:    def ifEnabled = { attrs, body ->
29:        if (recaptchaService.isEnabled()) {
30:            out << body()
31:        }
32:    }

I looked into ConfigHelper.booleanValue and it seems that only needs one parameter and you are sending two. If I drop that second parameter, the captcha displays correctly.

@iamthechad iamthechad was assigned
@iamthechad iamthechad referenced this issue from a commit
@iamthechad Update readme
Refs #14
e8831a1
@iamthechad iamthechad closed this
@wwarlock

Hmm, I wrote about this problem at #10.
But that looks like very similar.
Here is my full error log from 0.6.7 plugin version and Grails 2.3.8 (if this something matter).
I haven't this bug on 0.6.5 (but only in 0.6.6 and 0.6.7).

Grails
Error 500: Internal Server Error
URI
/feedback
Class
groovy.lang.MissingMethodException
Message
No signature of method: static com.megatome.grails.util.ConfigHelper.booleanValue() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], false] Possible solutions: booleanValue(java.lang.Object)
Around line 530 of grails-app/views/feedback/index.gsp
Around line 530 of AbstractFilter.java
Around line 530 of GrailsAnonymousAuthenticationFilter.java
Around line 530 of RequestHolderAuthenticationFilter.java
Around line 530 of MutableLogoutFilter.java
Around line 25 of grails-app/views/feedback/index.gsp
22:            </recaptcha:ifEnabled>
23:
24:            <g:submitButton name="${message(code: "contacts.send")}" class="searchbutton" style="width: 150px;"/>
25:        </g:form>
26:
27:    </div>
28:
Around line 22 of grails-app/views/feedback/index.gsp
19:            <label><g:message code="contacts.captcha"/>:</label>
20:            <recaptcha:ifEnabled>
21:                <recaptcha:recaptcha theme="white"/>
22:            </recaptcha:ifEnabled>
23:
24:            <g:submitButton name="${message(code: "contacts.send")}" class="searchbutton" style="width: 150px;"/>
25:        </g:form>
Around line 132 of grails-app/services/com/megatome/grails/RecaptchaService.groovy
129:     * Get a value indicating if the ReCaptcha plugin should be enabled.
130:     */
131:    def isEnabled() {
132:        return ConfigHelper.booleanValue(getRecaptchaConfig().enabled, false)
133:    }
134:
135:    /**
Around line 29 of grails-app/taglib/com/megatome/grails/RecaptchaTagLib.groovy
26:     * Evaluates the content of the tag if ReCaptcha support is enabled. This value is set in config.
27:     */
28:    def ifEnabled = { attrs, body ->
29:        if (recaptchaService.isEnabled()) {
30:            out << body()
31:        }
32:    }
Around line 198 of PageFragmentCachingFilter.java
195:            if (CollectionUtils.isEmpty(cacheOperations)) {
196:                log.debug("No cacheable annotation found for {}:{} {}",
197:                        new Object[] { request.getMethod(), request.getRequestURI(), getContext() });
198:                chain.doFilter(request, response);
199:                return;
200:            }
201:
Around line 63 of AbstractFilter.java
60:     try {
61:         // NO_FILTER set for RequestDispatcher forwards to avoid double gzipping
62:         if (filterNotDisabled(request)) {
63:             doFilter(request, response, chain);
64:         }
65:         else {
66:             chain.doFilter(req, res);
Around line 53 of GrailsAnonymousAuthenticationFilter.java
50:
51:     applyAnonymousForThisRequest((HttpServletRequest)req);
52:
53:     chain.doFilter(req, res);
54: }
55:
56: protected void applyAnonymousForThisRequest(HttpServletRequest request) {
Around line 49 of RequestHolderAuthenticationFilter.java
46: public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
47:     SecurityRequestHolder.set((HttpServletRequest)request, (HttpServletResponse)response);
48:     try {
49:         super.doFilter(request, response, chain);
50:     }
51:     finally {
52:         SecurityRequestHolder.reset();
Around line 82 of MutableLogoutFilter.java
79:         return;
80:     }
81:
82:     chain.doFilter(request, response);
83: }
84:
85: /**
Trace
    Line | Method
->>  530 | doFilter  in /.../grails-app/views/feedback/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <recaptcha:ifEnabled>: No signature of method: static com.megatome.grails.util.ConfigHelper.booleanValue() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], false]
Possible solutions: booleanValue(java.lang.Object)
->>   25 | doCall    in /.../grails-app/views/feedback/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by GrailsTagException: Error executing tag <recaptcha:ifEnabled>: No signature of method: static com.megatome.grails.util.ConfigHelper.booleanValue() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], false]
Possible solutions: booleanValue(java.lang.Object)
->>   22 | doCall    in /.../grails-app/views/feedback/index.gsp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by MissingMethodException: No signature of method: static com.megatome.grails.util.ConfigHelper.booleanValue() is applicable for argument types: (groovy.util.ConfigObject, java.lang.Boolean) values: [[:], false]
Possible solutions: booleanValue(java.lang.Object)
->>  132 | isEnabled in RecaptchaService.groovy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     29 | doCall    in RecaptchaTagLib.groovy
|     47 | doCall .  in ..._grails_app_views_feedback_index_gsp$_run_closure2_closure3
|     52 | doCall    in ..._grails_app_views_feedback_index_gsp$_run_closure2
|     61 | run . . . in ..._grails_app_views_feedback_index_gsp
|    198 | doFilter  in PageFragmentCachingFilter.java
|     63 | doFilter  in AbstractFilter.java
|     53 | doFilter  in GrailsAnonymousAuthenticationFilter.java
|     49 | doFilter  in RequestHolderAuthenticationFilter.java
|     82 | doFilter  in MutableLogoutFilter.java
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . in java.lang.Thread
@wwarlock

Ok, I found it's my bug. I had run grails in another environment not specified in the RecaptchaConfig.groovy.
But you should rewrite code to use some default values or to display better warning/error messages with detailed instructions what to do.

@iamthechad
Owner

The code does use default values for many of the settings. Without seeing what your configuration was like, I don't have a very good idea of what broke and what should change. If it's an issue that you think needs fixing, please open an issue with more detail so I can work on it.

@wwarlock

I'm using config exactly you've provided in the "Standalone Configuration" section of the manual.
About displaying messages I mean, you can notice about missed required values.
Which the name of the missed option.
Or about different environment, which is not existed in plugin config.
Or just enable plugin by default (for example).
In my case and in the case of the topicstarter the error appears because of unset "enabled" option.
Am I right?

@iamthechad
Owner

This issue that you're commenting on has a different underlying cause. What you are asking for is an enhancement, which would be a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.