[ 
https://issues.apache.org/jira/browse/MAPREDUCE-6455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14710053#comment-14710053
 ] 

Andrew Wang commented on MAPREDUCE-6455:
----------------------------------------

I talked with [~chelin] about this offline, seems pretty complex. Charlie's 
current thinking is that surefire is somehow passing some properties 
incorrectly when running in fork mode, leading to some expected variables like 
hadoop.log.dir being unset, and then us running into this surefire behavior 
change. That sounds like a more fundamental issue than null vs. {{""}}. The 
cleaner fix seems like setting these variables properly rather than relying on 
null/{{""}}/default parsing, and will avoid modifying non-test and non-pom code.

Thanks again to [~chelin] for the discussion and working on this issue.

> Unable to use surefire > 2.18
> -----------------------------
>
>                 Key: MAPREDUCE-6455
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6455
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>    Affects Versions: 2.7.1
>            Reporter: Charlie Helin
>            Assignee: Charlie Helin
>             Fix For: 3.0.0
>
>         Attachments: mr-6455.1.patch, mr-6455.2.patch, mr-6455.2.patch
>
>
> There are some compelling features in later version of surefire which lets 
> one exclude/include tests based the content of a file, re-running of test 
> case etc.
> However introduced in Surefire 2.18 is also 
> https://issues.apache.org/jira/browse/SUREFIRE-649. Which changed the 
> convention of null properties to empty string values (""). This only applies 
> to forked tests such as the MapReduce tests and cause a couple of them to 
> fail because of functionality that is directly or indirectly dependent on the 
> value being null. One such example is Configuration.substituteVars() and 
> TaskLog.getBaseLogDir().
> substituteVars() shows the issue when the getProperty returns empty String, 
> skipping the getRaw(var) expression. One way to work around this could be
> {code} 
>    if (val == null || val.isEmpty()) {
>         String raw = getRaw(var);
>         if (raw != null) {
>           // raw contains a value, otherwise default to whatever 
> System.getProperty returned
>           // since it could be an empty string
>           val = raw;
>         }
>       }
> {code}
> getBaseLogDir, similarly when returns an empty string the schematics of 
> java.io.File differs dependent on whether parent is null or "". A null value 
> is interpreted as new File(file); whereas "" will be interpreted as new 
> File(defaultParent /* / */, file);
> This could simply be addressed with 
> {code}
>   static String getBaseLogDir() {
>     String logDir = System.getProperty("hadoop.log.dir");
>     // there is a difference how null and "" is treated as a parent
>     // directory when creating a file
>     return logDir == null || logDir.isEmpty() ? null : logDir;
>   }
> {code}



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

Reply via email to