private void load()

in runAs-agent/src/main/java/jetbrains/buildServer/runAs/agent/ProfileParametersServiceImpl.java [95:125]


  private void load(@NotNull final File propertyFile) {
    Configuration properties = CreateConfiguration();
    try {
      if(LOG.isDebugEnabled()) {
        LOG.debug("Loading credentials from \"" + propertyFile + "\"");
      }
      final ByteArrayInputStream stream = new ByteArrayInputStream(myFileService.readAllTextFile(propertyFile).getBytes(StandardCharsets.UTF_8));
      properties.load(stream);

      for(Map.Entry<Object, Object> entry: properties.entrySet())
      {
        if(!(entry.getValue() instanceof String))
        {
          continue;
        }

        final String decryptedString = myCryptographicService.unscramble((String)entry.getValue());
        entry.setValue(decryptedString);
      }


      if(LOG.isDebugEnabled()) {
        LOG.debug(properties.size() + " properties were loaded from \"" + propertyFile + "\"");
      }
    }
    catch (IOException ex){
      LOG.error("Error occurred during loading property file \"" + propertyFile + "\"", ex);
    }

    myProfiles.put(propertyFile.getName(), properties);
  }