public FileBasedMatcher()

in command.line/java/com/jetbrains/teamcity/resources/FileBasedMatcher.java [67:102]


  public FileBasedMatcher(final File file) {
    if (file == null || !file.exists()) {
      throw new IllegalArgumentException(MessageFormat.format("File is null or not extists: \"{0}\"", file));
    }
    try {
      myFile = file.getAbsoluteFile();
      // parse content
      final List<String> items = FileUtil.readFile(myFile);
      if (items.isEmpty()) {
        throw new IllegalArgumentException(MessageFormat.format("\"{0}\" is empty", myFile));
      }
      // will build ordered by full path map for next local files mapping
      for (final String item : items) {
        final String[] columns = item.trim().split(FIELD_DEVIDER);
        if (columns.length < 2) {
          throw new IllegalArgumentException(MessageFormat.format("\"{0}\" format is wrong", myFile));
        }

        final String path = columns[0];
        final String tcid = StringUtil.removeTailingSlash(columns[1]);// slash
                                                                      // will be
                                                                      // added
                                                                      // to Url
                                                                      // later
        // absolute or not: if relative have to add the source file location to
        // paths describes mappings from the file
        File ruleContainer = new File(path);
        if (!ruleContainer.isAbsolute()) {
          ruleContainer = new File(myFile.getParentFile().getAbsoluteFile(), path);
        }
        myRulesMap.put(Util.toPortableString(ruleContainer.getCanonicalFile().getAbsolutePath()), tcid);
      }
    } catch (IOException e) {
      throw new IllegalArgumentException(e);
    }
  }