NPE during WPSFactory instantiation if ows:Abstract element is missing/null in 
DescriptionType
----------------------------------------------------------------------------------------------

                 Key: GEOT-2717
                 URL: http://jira.codehaus.org/browse/GEOT-2717
             Project: GeoTools
          Issue Type: Bug
          Components: new modules
    Affects Versions: 2.6-M2
            Reporter: Matthias Lendholt
            Priority: Minor


I got NullPointerExceptions creating a new WPSFactory. The first one 
happens in org.geotools.data.wps.WPSFactory:
private void buildValuesFromProcessDescriptionType():

this.description = this.pdt.getAbstract().getValue();

In net.opengis.wps10.impl.DescriptionTypeImpl getAbstract() returns 
_abstract and I cannot see any checks that avoid returning null. Trying 
.getValue() results in the NPE. Since the child element "ows:Abstract" 
of "DescriptionType" is optional 
(http://schemas.opengis.net/wps/1.0.0/common/DescriptionType.xsd) it 
must be checked if null is returned or not. Like

this.description = 
this.pdt.getAbstract()==null?"":this.pdt.getAbstract().getValue();

It's not up to me to decide whether an empty String "" or null for 
this.description should be used. Using null will result in an 
IllegalArgumentException in getDescription() during conversion into an 
InternationalString object.


The same problem in org.geotools.data.wps.WPSUtils twice:

1) createInputParamMap(..)
Creating the new Parameter
Parameter param = new Parameter(idt.getIdentifier().getValue(), type,
                     Text.text(idt.getTitle().getValue()),
                     Text.text(idt.getAbstract().getValue()), required,
                     idt.getMinOccurs().intValue(), 
idt.getMaxOccurs().intValue(),
                     null, null);

2) createOutputParamMap(..)
  Parameter param = new Parameter(odt.getIdentifier().getValue(), type,
                     Text.text(odt.getTitle().getValue()),
                     Text.text(odt.getAbstract().getValue()) );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to