ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ping Liu (JIRA)" <>
Subject [jira] Commented: (WODEN-186) Various problems calling toString() on uninitialized *Impl classes
Date Fri, 25 Feb 2011 23:12:22 GMT


Ping Liu commented on WODEN-186:

I was able to reproduce the error cases for both ServiceElement and EndpointElement when calling

After a comprehensive investigation, it was found that all element implementations except
DescriptionElement (under package org.apache.woden.wsdl20.xml) have the same issue.  Here
is the list of the elements that have such issue.


There are also two component implementations (under package org.apache.woden.wsdl20) carrying
the same issue.  The two component are:


The error track can be found in the attached file (TestToStringForComponentAndElement.txt).

The issue is derived from getFragmentIdentifier() where toString() gets the actual content.
The issue is eventually boiled down to three categories:

	1. lacking its own name (NCName)
	2. lacking its parent's name or even its entire parent
	3. in the case of compents (ElementDeclaration and TypeDefinition), missing URI (fSystem)

The issue is due to "too early call" when the components and elements have not been fully
established yet at the calling time.

I think one possible fix could be like this:

	1. inside getFragmentIdentifier() in elements/components such as EndpointElement, add condition
checks for name, parent, etc.  Upon failing condition, throw the exception with meaningful
error description;
	2. then capture the exception in toString() implementation class:
	   - for elements: WSDLComponentImpl (the super class);
	   - for components: ElementDeclaration (for ElementDeclaration), TypeDefinition (for TypeDefinition)
as toString() and getFragmentIdentifier() reside together (no class hierarchy)
	3. wrap the exception in a friendly warning message as the return of toString().

> Various problems calling toString() on uninitialized *Impl classes
> ------------------------------------------------------------------
>                 Key: WODEN-186
>                 URL:
>             Project: Woden
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: M8
>            Reporter: Jeremy Hughes
>             Fix For: 1.0
>         Attachments: TestToStringForComponentAndElement.txt
> I'm using the Element API to construct a Description from the ground up, with some problems
in calling toString() on uninitialized *Impl objects.
>         WSDLFactory factory = WSDLFactory.newInstance();
>         DescriptionElement descElem1 = factory.newDescription();
>         ServiceElement svcElem1 = descElem1.addServiceElement();
>         assertNotNull(svcElem1.toString());
> gives:
> java.lang.IllegalArgumentException
> 	at org.apache.woden.wsdl20.fragids.ServicePart.<init>(
> 	at org.apache.woden.internal.wsdl20.ServiceImpl.getFragmentIdentifier(
> 	at org.apache.woden.internal.wsdl20.WSDLComponentImpl.toString(
> ServicePart ctor actually throws a new IllegalArgumentException if passed a null so that's
WAD. However, ServiceImpl.toString() should be friendlier.
> Then there is a problem with ElementImpl.toString():
>         WSDLFactory factory = WSDLFactory.newInstance();
>         DescriptionElement descElem1 = factory.newDescription();
>         ServiceElement svcElem1 = descElem1.addServiceElement();
>         EndpointElement endPtElem1 = svcElem1.addEndpointElement();
>         assertNotNull(endPtElem1.toString());
> gives:
> java.lang.NullPointerException
> 	at org.apache.woden.internal.wsdl20.EndpointImpl.getFragmentIdentifier(
> 	at org.apache.woden.internal.wsdl20.WSDLComponentImpl.toString(

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message