Skip to content

Encoder case sensitivity bug in GraphHopper.getWeightingForCH #496

Closed

Description

@linasm

The first line of GraphHopper.getWeightingForCH method is missing a toLowerCase() call. In case of one or more upper case letters, the matching fails as the resulting variable encoderStr is compared to a string representation of Weighting that is converted to lower case:

public Weighting getWeightingForCH( WeightingMap weightingMap, FlagEncoder encoder )
{
    String encoderStr = encoder.toString(); <-- MISSING toLowerCase()
    String weightingStr = weightingMap.getWeighting().toLowerCase();
    for (Weighting w : algoFactories.keySet())
    {
        // TODO too loose matching? see #490
        String str = w.toString().toLowerCase();
        if (str.contains(weightingStr) && str.contains(encoderStr))
            return w;
    }

Activity

  1. devemux86 commented on Aug 14, 2015

    @devemux86
    Contributor

    Related to #490.

  2. added this to the milestone on Aug 14, 2015
  3. added a commit that references this issue on Aug 24, 2015
  4. modified the milestones: 0.6, on Sep 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions