cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jiang, Ning \(Willem\)" <Ning.Ji...@iona.com>
Subject 答复: PMD issue [was Re: svn commit: r488948 [1/3]]
Date Thu, 21 Dec 2006 12:55:16 GMT

The question is exception build need to call the Message's toString() method.

:)

-----Original Message-----
From: James Mao [mailto:james.mao@iona.com]
Sent: 12/21/2006 (星期四) 17:09
To: cxf-dev@incubator.apache.org
Subject: Re: PMD issue [was Re: svn commit: r488948 [1/3]]
 
Question is why not throw the exception when you trying to retrieve the 
opName?
> 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
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message