hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajat Khandelwal (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HADOOP-13799) org.apache.hadoop.conf.Configuration#getClasses doesn't return the default classes passed
Date Mon, 07 Nov 2016 11:55:58 GMT
Rajat Khandelwal created HADOOP-13799:
-----------------------------------------

             Summary: org.apache.hadoop.conf.Configuration#getClasses doesn't return the default
classes passed
                 Key: HADOOP-13799
                 URL: https://issues.apache.org/jira/browse/HADOOP-13799
             Project: Hadoop Common
          Issue Type: Task
    Affects Versions: 2.6.2
            Reporter: Rajat Khandelwal


{noformat}
  /** 
   * Get the value of the <code>name</code> property
   * as an array of <code>Class</code>.
   * The value of the property specifies a list of comma separated class names.  
   * If no such property is specified, then <code>defaultValue</code> is 
   * returned.
   * 
   * @param name the property name.
   * @param defaultValue default value.
   * @return property value as a <code>Class[]</code>, 
   *         or <code>defaultValue</code>. 
   */
  public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
    String[] classnames = getTrimmedStrings(name);
    if (classnames == null)
      return defaultValue;
    try {
      Class<?>[] classes = new Class<?>[classnames.length];
      for(int i = 0; i < classnames.length; i++) {
        classes[i] = getClassByName(classnames[i]);
      }
      return classes;
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }

{noformat}

The issue is, that getTrimmedStrings doesn't return null. It returns a zero length array in
case no value is present for the given key. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org


Mime
View raw message