FeatureTypes.getAncestors will not terminate if a FeatureType has a getSuper() 
that is not also a FeatureType
-------------------------------------------------------------------------------------------------------------

                 Key: GEOT-3143
                 URL: http://jira.codehaus.org/browse/GEOT-3143
             Project: GeoTools
          Issue Type: Bug
          Components: core main
    Affects Versions: 2.7-M0, 2.6.4, 2.6.5, 2.7-M1
            Reporter: Ben Caradoc-Davies
            Assignee: Ben Caradoc-Davies
             Fix For: 2.6.5, 2.7-M1


FeatureTypes.getAncestors will not terminate if a FeatureType has a getSuper() 
that is not also a FeatureType. This is a simple oversight that caused by 
depending on builders that do not set non-features as super.

Discussion:
http://osgeo-org.1803224.n2.nabble.com/Issue-in-2-6-4-FeatureTypes-getAncestors-td5185387.html

{code}
-------- Original Message --------
Subject: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
Date: Wed, 16 Jun 2010 15:52:58 +0800
From: Thorsten Reitz 
To: geotools-gt2-us...@lists.sourceforge.net    

Hi GeoTools team,

I would have directly put that on the JIRA, but am not sure where to
register:

In GeoTools 2.6.4, there is an issue in FeatureTypes.getAncestors(...)
that will in some cases, specifically when a FeatureType's supertype is
not a FeatureType, but a ComplexType (as it is the case for the
AbstractFeatureType instance, for example, that GeoTools creates by
default) make the function loop indefinitely. This was resolved in 2.5.8
already. We'd suggest the following patch to the function:

public static List<FeatureType> getAncestors(FeatureType featureType) {
  List<FeatureType> ancestors = new ArrayList<FeatureType>();
  AttributeType type = featureType;
  while (type.getSuper() != null) {
    if (type.getSuper() instanceof FeatureType) {
      FeatureType superType = (FeatureType) featureType.getSuper();
      ancestors.add(superType);
    }
    type = type.getSuper();
  }
  return ancestors;
}

Kind regards,

Thorsten

-- 
Thorsten Reitz

Fraunhofer-Institut für Graphische Datenverarbeitung IGD
Fraunhoferstr. 5  |  64283 Darmstadt  |  Germany
{code}


{code}


-- 
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

       

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to