code: public static Class goodClassOrNull(Configuration conf, String className, String defaultPackage) {
      if (className.indexOf('.') == -1 && defaultPackage != null) {
        className = defaultPackage + "." + className;
      }
      Class clazz = null;
      try {
        clazz = conf.getClassByName(className);
      } catch (ClassNotFoundException cnf) {
      }
      return clazz;
    }
docs: It may seem strange to silently switch behaviour when a String
  is not a classname; the reason is simplified Usage:<pre>
  -mapper [classname | program ]
  instead of the explicit Usage:
  [-mapper program | -javamapper classname], -mapper and -javamapper are mutually exclusive.
  (repeat for -reducer, -combiner) </pre>