Well, the latest the spec is mr4, I think Iris referred to the latest
version. One of the reason for this change is that, a new method
getSuppressed is added in JDK 7. I am thinking that CXF is 'lucky' here as
it does not strictly follow the rules required by spec

[1] http://jcp.org/en/jsr/detail?id=224


2013/1/10 Andrei Shakirin <[email protected]>

> Hi Freeman,
>
> I am not completely agree with you.
> The spec statement "3. For each getter in the exception ..." didn't really
> changed from 2_0 to 2_2.
> Spec explicitly says which methods must be excluded from getters:
> getCause(), getLocalizedMessage(), getStackTrace() and getClass().
> getMessage() is not in the list => getter should be generated.
>
> If you check RI, it generates following for exception element:
>
> <xs:complexType name="AddNumbersException">
>  <xs:sequence>
>     <xs:element name="detail" type="xs:string" minOccurs="0"/>
>     <xs:element name="message" type="xs:string" minOccurs="0"/>
>   </xs:sequence>
> </xs:complexType>
>
> Precisely said, we are not 100% compatible with the spec here, although I
> agree with Dan regarding performance concern and possible duplication of
> fault:Message.
>
> Would we like to fix it in further CXF versions?
> Any thoughts?
>
> Cheers,
> Andrei.
>
> > -----Original Message-----
> > From: Freeman Fang [mailto:[email protected]]
> > Sent: Donnerstag, 10. Januar 2013 06:26
> > To: [email protected]
> > Cc: [email protected]
> > Subject: Re: getMessage from java.lang.Throwable is excluded from
> > accepted method
> >
> > Hi Iris,
> >
> > Yep, I'm with Dan here.
> >
> > Moreover, seems your spec isn't the latest one. What I read from this
> part is
> > For each getter in the exception and its superclasses, a property of the
> same
> > type and name is added to the bean. The getCause, getLocalizedMessage
> > and getStackTrace getters from java.lang.Throwable and the getClass
> getter
> > from java.lang.Object are excluded from the list of getters to be mapped.
> >
> > In java.lang.Throwable.getLocalizedMessage() will return getMessage(),
> > that's what's the message you set from your code super(message);
> >
> >
> > FYI, you can download the latest JAXWS 2.2 spec from here[1], it's
> > Maintenance Release 3 [1]http://download.oracle.com/otndocs/jcp/jaxws-
> > 2.2-mrel3-full-oth-JSpec/
> >
> > -------------
> > Freeman(Yue) Fang
> >
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://fusesource.com | http://www.redhat.com/
> > Twitter: freemanfang
> > Blog: http://freemanfang.blogspot.com
> > http://blog.sina.com.cn/u/1473905042
> > weibo: @Freeman小屋
> >
> > On 2013-1-9, at 下午11:57, Daniel Kulp wrote:
> >
> > >
> > > Yea, definitely check what the RI is doing here.   IMO, it shouldn't be
> > mapped as the information would already be available on the wire as part
> of
> > the <fault:Message> and thus outputting it in the details would just be
> > redundant, waste bandwidth, etc….
> > >
> > >
> > > Dan
> > >
> > >
> > > On Jan 9, 2013, at 8:35 AM, Andrei Shakirin <[email protected]>
> wrote:
> > >
> > >> Hi Iris,
> > >>
> > >> If I interpret spec correctly, you are right.
> > >> Java bean mapped from exception should have getMessage() method.
> > >>
> > >> Did you check it under the reference implementation?
> > >>
> > >> Cheers,
> > >> Andrei.
> > >>
> > >>> -----Original Message-----
> > >>> From: iris ding [mailto:[email protected]]
> > >>> Sent: Dienstag, 8. Januar 2013 02:56
> > >>> To: [email protected]
> > >>> Subject: getMessage from java.lang.Throwable is excluded from
> > >>> accepted method
> > >>>
> > >>> According to jax-ws spec:
> > >>>
> > >>> For each getter in the exception and its superclasses, a property of
> > >>> the same type and name is added to the bean. All the getter methods
> > >>> except getMessage from java.lang.Throwable type hierarchy are
> > >>> excluded from the list of getters to be mapped.
> > >>>
> > >>> But currently, message does not show up in generated wsdl in CXF:
> > >>>
> > >>> public class AddNumbersException extends Exception {
> > >>>   private static final long serialVersionUID = 4629689348515005826L;
> > >>> String detail;
> > >>>
> > >>>   public AddNumbersException(String message, String detail) {
> > >>>       super(message);
> > >>>       this.detail = detail;
> > >>>   }
> > >>>
> > >>>  public String getDetail() {
> > >>>      return detail;
> > >>>  }
> > >>> }
> > >>> <xs:complexType name="AddNumbersException"> <xs:sequence>
> > >>> <xs:element name="detail" nillable="true" type="xs:string"/>
> > >>> </xs:sequence> </xs:complexType>
> > >>>
> > >>> The corrected version should be:
> > >>> <xs:complexType name="AddNumbersException"> <xs:sequence>
> > >>> <xs:element name="detail" nillable="true" type="xs:string"/>
> > >>> <xs:element name="message" nillable="true" type="xs:string"/>
> > >>> </xs:sequence> </xs:complexType>
> > >>>
> > >>> any thoughts?
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>> View this message in context:
> > >>> http://cxf.547215.n5.nabble.com/getMessage-from-java-lang-
> > Throwable-
> > >>> is- excluded-from-accepted-method-tp5721196.html
> > >>> Sent from the cxf-user mailing list archive at Nabble.com.
> > >
> > > --
> > > Daniel Kulp
> > > [email protected] - http://dankulp.com/blog Talend Community Coder -
> > > http://coders.talend.com
> > >
>
>


-- 
Ivan

Reply via email to