You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Bo Wang (JIRA)" <ji...@apache.org> on 2012/08/31 01:39:08 UTC

[jira] [Created] (HADOOP-8750) Configuration.getClasses never returns default value

Bo Wang created HADOOP-8750:
-------------------------------

             Summary: Configuration.getClasses never returns default value
                 Key: HADOOP-8750
                 URL: https://issues.apache.org/jira/browse/HADOOP-8750
             Project: Hadoop Common
          Issue Type: Bug
            Reporter: Bo Wang
            Assignee: Bo Wang


getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
    String[] classnames = getTrimmedStrings(name);
    if (classnames == null)
      return defaultValue;
    // Load and return classes using classnames... (omitted)
  }

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8750) Configuration.getClasses never returns default value

Posted by "Bo Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bo Wang updated HADOOP-8750:
----------------------------

    Description: 
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
  String[] classnames = getTrimmedStrings(name);
  if (classnames == null)
    return defaultValue;
  // Load and return classes using classnames... (omitted)
}

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



  was:
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
  String[] classnames = getTrimmedStrings(name);
  if (classnames == null)
    return defaultValue;
    // Load and return classes using classnames... (omitted)
}

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



    
> Configuration.getClasses never returns default value
> ----------------------------------------------------
>
>                 Key: HADOOP-8750
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8750
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Bo Wang
>            Assignee: Bo Wang
>
> getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.
> public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
>   String[] classnames = getTrimmedStrings(name);
>   if (classnames == null)
>     return defaultValue;
>   // Load and return classes using classnames... (omitted)
> }
> This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).
> To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8750) Configuration.getClasses never returns default value

Posted by "Bo Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bo Wang updated HADOOP-8750:
----------------------------

    Description: 
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
  String[] classnames = getTrimmedStrings(name);
  if (classnames == null)
    return defaultValue;
    // Load and return classes using classnames... (omitted)
}

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



  was:
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
    String[] classnames = getTrimmedStrings(name);
    if (classnames == null)
      return defaultValue;
    // Load and return classes using classnames... (omitted)
  }

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



    
> Configuration.getClasses never returns default value
> ----------------------------------------------------
>
>                 Key: HADOOP-8750
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8750
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Bo Wang
>            Assignee: Bo Wang
>
> getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.
> public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
>   String[] classnames = getTrimmedStrings(name);
>   if (classnames == null)
>     return defaultValue;
>     // Load and return classes using classnames... (omitted)
> }
> This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).
> To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (HADOOP-8750) Configuration.getClasses never returns default value

Posted by "Bo Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bo Wang updated HADOOP-8750:
----------------------------

    Description: 
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



  was:
getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.

public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
  String[] classnames = getTrimmedStrings(name);
  if (classnames == null)
    return defaultValue;
  // Load and return classes using classnames... (omitted)
}

This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).

To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"



    
> Configuration.getClasses never returns default value
> ----------------------------------------------------
>
>                 Key: HADOOP-8750
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8750
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Bo Wang
>            Assignee: Bo Wang
>
> getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.
> This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).
> To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (HADOOP-8750) Configuration.getClasses never returns default value

Posted by "Bo Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HADOOP-8750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bo Wang resolved HADOOP-8750.
-----------------------------

    Resolution: Duplicate

Duplicated with HADOOP-7851
                
> Configuration.getClasses never returns default value
> ----------------------------------------------------
>
>                 Key: HADOOP-8750
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8750
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Bo Wang
>            Assignee: Bo Wang
>
> getClasses method in Configuration never returns defaultValue even if the classnames is not set in Configuration.
> This is because the condition "if (classnames == null)" is always True. If name is not set in Configuration, classnames will be an empty array (but not null).
> To fix it, just change the condition to "if (classnames == null || classnames.length == 0)"

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira