cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <ning.ji...@iona.com>
Subject Re: PMD issue [was Re: svn commit: r488948 [1/3]]
Date Thu, 21 Dec 2006 08:15:13 GMT
Hi Dan,

I just looked into this PMD error in Eclipse, find this is your code's 
error :)

  OperationInfo(InterfaceInfo it, QName n) {
        intf = it;
        setName(n);
    }
    OperationInfo(OperationInfo op) {
        intf = op.getInterface();
        setName(op.getName());
    }
   ...  
     public final void setName(QName name) {
        if (name == null) {
            throw new NullPointerException(
                new Message("OPERATION.NAME.NOT.NULL", LOG).toString());
        }       
        opName = name;
    }

The code is looked like this, the setName(QName name) is called in the 
OperationInfo, and if the name is null the setName() will call the 
Messsage. toString() which can be overridden. So the PMD think your code 
violated the rule of not calling overridden methods.

I tried to set the Message.toString to be final, but PMD error still 
there, so I changed the throw new NullPointerException(...) to throw new 
NullPointerException("Operation Name cannot be null.");

So I commited these change , and change the PMD rule back.

Cheers,

Willem.

Dan Diephouse wrote:

> On 12/20/06, dandiep@apache.org <dandiep@apache.org> wrote:
>
>>
>>
>>     
>> incubator/cxf/trunk/buildtools/src/main/resources/cxf-pmd-ruleset.xml
>>
>>
>
> I forgot to add in my commit notes: I had to change this as PMD seems to
> have a bug in it. It thought I was calling toString() in the 
> constructor and
> that violated the rule of not calling overridden methods. However I'm not
> calling it AFAIK. Let me know if I missed something...
>
> - Dan
>


Mime
View raw message