Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/235#discussion_r107805516
  
    --- Diff: 
core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java ---
    @@ -165,30 +165,35 @@ private void checkType(Property property, 
PropertyType type) {
       }
     
       /**
    -   * Gets a property of type {@link PropertyType#MEMORY}, interpreting the 
value properly.
    +   * Gets a property of type {@link PropertyType#BYTES}, interpreting the 
value properly.
        *
        * @param property
    -   *          property to get
    +   *          Property to get
        * @return property value
        * @throws IllegalArgumentException
    -   *           if the property is of the wrong type
    -   * @see #getMemoryInBytes(String)
    +   *           if the property is of the wrong type @see #getBytes(String)
        */
    -  public long getMemoryInBytes(Property property) {
    -    checkType(property, PropertyType.MEMORY);
    +  public long getAsBytes(Property property) {
    +    checkType(property, PropertyType.BYTES);
     
         String memString = get(property);
    -    return getMemoryInBytes(memString);
    +    if (property.getType().equals(PropertyType.MEMORY)) {
    +      return getMemoryAsBytes(memString);
    +    } else if (property.getType().equals(PropertyType.BYTES)) {
    +      return getBytes(memString);
    +    } else {
    +      throw new IllegalArgumentException(property.getKey() + " is not of 
BYTES or MEMORY type");
    +    }
       }
     
       /**
    -   * Interprets a string specifying a memory size. A memory size is 
specified as a long integer followed by an optional B (bytes), K (KB), M (MB), 
or G (GB).
    +   * Interprets a string specifying bytes. A bytes type is specified as a 
long integer followed by an optional B (bytes), K (KB), M (MB), or G (GB).
        *
        * @param str
    -   *          string value
    -   * @return interpreted memory size
    +   *          String value
    +   * @return interpreted memory size in bytes
        */
    -  static public long getMemoryInBytes(String str) {
    +  static public long getBytes(String str) {
    --- End diff --
    
    getBytes is too common of a method name (Example `String#getBytes()`). The 
type is still for bytes of memory, so there's no reason to change that. Keeping 
the old name makes the changeset much smaller. The new one could be something 
more like: `getMemoryRatioAsBytes()`, and could be parsed as either a ratio or 
fall back to bytes (if not ending with '%').


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to