GeoTools
  1. GeoTools
  2. GEOT-2179

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1
    • Fix Version/s: 2.5.2, 2.6-M0
    • Component/s: main
    • Labels:
      None

      Description

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

            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());
      	}
      

      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

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Gabriel Roldan
            Reporter:
            Gabriel Roldan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: