[ 
https://issues.apache.org/jira/browse/HADOOP-13777?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tianyin Xu updated HADOOP-13777:
--------------------------------
    Comment: was deleted

(was: patch against trunk)

> Trim configuration values in `rumen`
> ------------------------------------
>
>                 Key: HADOOP-13777
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13777
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: tools
>    Affects Versions: 3.0.0-alpha1
>            Reporter: Tianyin Xu
>            Priority: Minor
>         Attachments: HADOOP-13777.0000.patch
>
>
> The current implementation of {{ClassName.java}} in {{rumen}} does not follow 
> the practice of trimming configuration values. This leads to silent and 
> hard-to-diagnosis errors if users set values containing space or 
> newline---basically classes supposed to need anonymization will not do.
> See the previous commits as reference (just list a few):
> HADOOP-6578. Configuration should trim whitespace around a lot of value types
> HADOOP-6534. Trim whitespace from directory lists initializing
> Patch is available against trunk
> HDFS-9708. FSNamesystem.initAuditLoggers() doesn't trim classnames
> HDFS-2799. Trim fs.checkpoint.dir values.
> YARN-3395. FairScheduler: Trim whitespaces when using username for queuename.
> YARN-2869. CapacityScheduler should trim sub queue names when parse 
> configuration.
> Patch is available against trunk (tested):
> {code:title=ClassName.java|borderStyle=solid}
> @@ -43,15 +43,13 @@ protected String getPrefix() {
>    @Override
>    protected boolean needsAnonymization(Configuration conf) {
> -    String[] preserves = conf.getStrings(CLASSNAME_PRESERVE_CONFIG);
> -    if (preserves != null) {
> -      // do a simple starts with check
> -      for (String p : preserves) {
> -        if (className.startsWith(p)) {
> -          return false;
> -        }
> +    String[] preserves = conf.getTrimmedStrings(CLASSNAME_PRESERVE_CONFIG);
> +    // do a simple starts with check
> +    for (String p : preserves) {
> +      if (className.startsWith(p)) {
> +        return false;
>        }
>      }
>      return true;
>    }
> {code}
> (the NULL check is no longer needed because {{getTrimmedStrings}} returns an 
> empty array if nothing is set)



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

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to