private static boolean pathsMatch(String p1, String p2) {
        if ((p1 == null && p2 != null) || (p2 == null && p1 != null)) {
            return false;
        }
        
        if (p1 == null && p2 == null) {
            return true;
        }
        
        //at this point neither p1 nor p2 are null
        if (p1.equals(p2) || p1.startsWith(p2)) {
            return true;
        }
        
       return false; 
    }