class EnvAutodetectResource {

  @VisibleForTesting
  static Attributes parseResourceAttributes(@Nullable String rawEnvAttributes) {
    if (rawEnvAttributes == null) {
      return Attributes.empty();
    } else {
      Attributes.Builder attrBuilders = Attributes.newBuilder();
      String[] rawAttributes = rawEnvAttributes.split(ATTRIBUTE_LIST_SPLITTER, -1);
      for (String rawAttribute : rawAttributes) {
        String[] keyValuePair = rawAttribute.split(ATTRIBUTE_KEY_VALUE_SPLITTER, -1);
        if (keyValuePair.length != 2) {
          continue;
        }
        attrBuilders.setAttribute(
            keyValuePair[0].trim(), keyValuePair[1].trim().replaceAll("^\"|\"$", ""));
      }
      return attrBuilders.build();
    }
  }

  private  EnvAutodetectResource();

}