Example #1
0
  protected HashMap<String, String> getAttributeNameToSection() {
    HashMap<String, String> result = new HashMap<String, String>();
    InputStream inputStream =
        getClass()
            .getClassLoader()
            .getResourceAsStream("/" + schema.getName() + ".section" + ".properties");

    if (inputStream != null) {
      String line;
      BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
      try {
        while ((line = reader.readLine()) != null) {
          if (!(line.matches("^\\#.*") || line.isEmpty())) {
            String[] attributeValue = line.split("=");
            final String sectionName = attributeValue[0];
            result.put(attributeValue[1], sectionName);
          }
        }
      } catch (IOException e) {
        if (debug.errorEnabled()) {
          debug.error("Error reading section properties file", e);
        }
      }
    }
    return result;
  }