Dead code in DuplicatingFilterVisitor.visit(Id filter, Object extraData)
------------------------------------------------------------------------

                 Key: GEOT-2179
                 URL: http://jira.codehaus.org/browse/GEOT-2179
             Project: GeoTools
          Issue Type: Bug
          Components: core filter
    Affects Versions: 2.5.1
            Reporter: Gabriel Roldán
            Assignee: Gabriel Roldán
             Fix For: 2.5.2, 2.6-M0


The class DuplicatingFilterVisitor contains an instanceof check in visit(Id, 
Object) that can never evaluate to true:

{code}
      public Object visit(Id filter, Object extraData) {                
                if (filter instanceof FeatureId) {
                        FeatureId featureId = (FeatureId) filter;
                        return 
getFactory(extraData).featureId(featureId.getID());
                }
                return getFactory(extraData).id(filter.getIdentifiers());
        }
{code}

problem is org.opengis.filter.identity.FeatureId does not extend Filter so the 
instanceof check will never be true. That if block is seems like plain dead 
code, and it is ok for the method body to be just the last line.

and btw, the class does not have a single unit test



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

       

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to