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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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




Reply via email to