--- java/org/apache/naming/resources/FileDirContext.java (date 1529757103000) +++ java/org/apache/naming/resources/FileDirContext.java (date 1530112009000) @@ -880,8 +880,12 @@ // // absPath is normalized so canPath needs to be normalized as well // Can't normalize canPath earlier as canonicalBase is not normalized - if (canPath.length() > 0) { - canPath = normalize(canPath); + // + // normalize will always prepend a leading slash, so even an empty String + // will result in "/" + canPath = normalize(canPath); + if (absPath.length() == 0) { // normalize will never return an empty string + absPath = "/"; // so absPath needs to be fixed as well } if (!canPath.equals(absPath)) { return null;