cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Frandsen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5786) isValid() in WSIBPValidator should check method signature
Date Thu, 05 Jun 2014 10:30:02 GMT

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

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

Suggested fix (I will try to make a github pull request):

    public boolean isValid() {
        boolean valid = true;
        for (Method m : getClass().getMethods()) {
            if (m.getName().startsWith("check")) {
                if (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;
    }


> 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)

Mime
View raw message