Hi James, Yes, I just worked around the Message toString, which can handle the different language.
But if we throw the null point exception in the Get method, it is also hard to find the real murder by looking up the stack trace. Regards, Willem. James Mao wrote: >I know toString cause the problem, my question is, this really dose not >solve the real problem, i mean is it possible to throw the exception >when you Get the null point, not the time you set the null pointer. > >Cheers, >James. > > >>The question is exception build need to call the Message's toString() method. >> >>:) >> >>-----Original Message----- >>From: James Mao [mailto:[EMAIL PROTECTED] >>Sent: 12/21/2006 (星期四) 17:09 >>To: [email protected] >>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, [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 >>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > >
