[ 
https://issues.apache.org/jira/browse/CXF-5786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14018669#comment-14018669
 ] 

Peter Frandsen commented on CXF-5786:
-------------------------------------

Now with code that conforms to the PMD rules ;-)

{code:title=WSIBPValidator.java|borderStyle=solid}
    public boolean isValid() {
        boolean valid = true;
        for (Method m : getClass().getMethods()) {
            if (m.getName().startsWith("check") && m.getGenericReturnType() == 
boolean.class
                    && m.getGenericParameterTypes().length == 0) {
                try {
                    Boolean res = (Boolean) m.invoke(this);
                    if (!res) {
                        valid = false;
                    }
                } catch (Exception e) {
                    throw new ToolException(e);
                }
            }
        }
        return valid;
    }
{code}

> isValid() in WSIBPValidator should check method signature
> ---------------------------------------------------------
>
>                 Key: CXF-5786
>                 URL: https://issues.apache.org/jira/browse/CXF-5786
>             Project: CXF
>          Issue Type: Improvement
>          Components: Tooling
>    Affects Versions: 3.0.0
>            Reporter: Peter Frandsen
>
> WSIBPValidator.isValid() does not check method signature before calling 
> "check*" method through reflection.
> Also, the check m.getModifiers() == Member.PUBLIC is always false so should 
> be removed. The call getClass().getMethods() only returns public members, and 
> if it was needed the check for public should be 
> Modifier.isPublic(m.getModifiers())



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to