class PropertyFilter {

  static void filterProperties(Message message, Set<String> namesToClear) {
    ArrayList<Object> retainedProperties = messagePropertiesBuffer();
    try {
      filterProperties(message, namesToClear, retainedProperties);
    } finally {
      retainedProperties.clear(); // ensure no object references are held due to any exception
    }
  }

}