/**
   * Find files that match the given patterns
   *
   * @param currentSolution The VS solution being analyzed by sonar
   * @param defaultWorkDir A working directory
   * @param patternArray A list of paths or ant style patterns
   * @return The files found on the filesystem
   */
  @SuppressWarnings("unchecked")
  public static Collection<File> findFiles(
      VisualStudioSolution currentSolution, File defaultWorkDir, String... patternArray) {

    if (patternArray == null || patternArray.length == 0) {
      return Collections.EMPTY_LIST;
    }

    Set<File> result = new HashSet<File>();
    for (String pattern : patternArray) {
      String currentPattern = convertSlash(pattern);
      File workDir = defaultWorkDir;
      if (StringUtils.startsWith(pattern, SOLUTION_DIR_KEY)) {
        workDir = currentSolution.getSolutionDir();
        currentPattern = StringUtils.substringAfter(currentPattern, SOLUTION_DIR_KEY);
      }
      while (StringUtils.startsWith(currentPattern, PARENT_DIRECTORY)) {
        workDir = workDir.getParentFile();
        if (workDir == null) {
          LOG.warn("The following pattern is not correct: " + pattern);
          break;
        }
        currentPattern = StringUtils.substringAfter(currentPattern, PARENT_DIRECTORY);
      }
      if (workDir == null) {
        continue;
      } else if (StringUtils.contains(currentPattern, '*')) {
        String prefix = StringUtils.substringBefore(currentPattern, "*");
        if (StringUtils.contains(prefix, '/')) {
          workDir = browse(workDir, prefix);
          currentPattern = "*" + StringUtils.substringAfter(currentPattern, "*");
        }
        IOFileFilter externalFilter = new PatternFilter(workDir, currentPattern);
        listFiles(result, workDir, externalFilter);

      } else {
        File file = browse(workDir, currentPattern);
        if (file.exists()) {
          result.add(browse(workDir, currentPattern));
        }
      }
    }

    logResults(result, patternArray);

    return result;
  }
 /**
  * Find files that match the given patterns
  *
  * @param currentSolution The VS solution being analyzed by sonar
  * @param defaultWorkPath A working path that may be relative to solution root directory
  * @param patternArray A list of paths or ant style patterns
  * @return The files found on the filesystem
  */
 public static Collection<File> findFiles(
     VisualStudioSolution currentSolution, String defaultWorkPath, String... patternArray) {
   return findFiles(
       currentSolution, new File(currentSolution.getSolutionDir(), defaultWorkPath), patternArray);
 }