code: public static String getUserNameInConf(Configuration jobConf)
  			throws IllegalArgumentException {
  		String userName = jobConf.get(Constants.USER_CONF_KEY_HADOOP2);
  		if (StringUtils.isBlank(userName)) {
  			userName = jobConf.get(Constants.USER_CONF_KEY);
  			if (StringUtils.isBlank(userName)) {
  				// neither user.name nor hadoop.mapreduce.job.user.name found
  				throw new IllegalArgumentException(" Found neither "
  						+ Constants.USER_CONF_KEY + " nor "
  						+ Constants.USER_CONF_KEY_HADOOP2);
  			}
  		}
  		return userName;
  	}
docs: Get the user name from the job conf check for hadoop2 config param, then
  hadoop1
  
  @param jobConf
  @return userName
  
  @throws IllegalArgumentException