private static void repairNullArgsAndWarnIfNecessary ( String [ ] args ) { boolean haveANullArg = false ; for ( String s : args ) { if ( s == null ) { haveANullArg = true ; break ; } } if ( haveANullArg ) { Log . warn ( "Found a null command-line argument; printing all command-line arguments out now" ) ; printArgs ( args ) ; } for ( int i = 0 ; i < args . length ; i ++ ) { String s = args [ i ] ; args [ i ] = ( s == null ) ? "" : s ; } }
This shouldn t be necessary but is . In one really weird Hadoop environment we saw an argument coming across from the driver as null . This shouldn t be possible but it happened . So repair it here by forcing a null to really be the empty string .