Tests if an argument is not null.

@param argument     the argument tested to see if it is not null.
@param errorMessage the errorMessage
@return the argument that was tested.
@throws java.lang.NullPointerException if argument is null
194004
public static <T> T checkNotNull(T argument, String errorMessage) {
        if (argument == null) {
            throw new NullPointerException(errorMessage);
        }
        return argument;
    }
288905
public void error(final String msg)
    {
        errors++;

        if (!suppressOutput)
        {
            out.println("ERROR: " + msg);
        }

        if (stopOnError)
        {
            throw new IllegalArgumentException(msg);
        }
    }
638328
protected void error(String msg, Object[] args)
          throws javax.xml.transform.TransformerException
  {

    String fmsg = XSLMessages.createXPATHMessage(msg, args);

    // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, 
    //                                      m_support.ERROR,
    //                                      null, 
    //                                      null, fmsg, 0, 0);
    // if(shouldThrow)
    {
      throw new XPathException(fmsg, this);
    }
  }
209153
public static <T extends CharSequence> T checkArgNotNullOrEmpty(final T arg, final String argNameOrErrorMsg) {
        if (N.isNullOrEmpty(arg)) {
            if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) {
                throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be null or empty");
            } else {
                throw new IllegalArgumentException(argNameOrErrorMsg);
            }
        }

        return arg;
    }
1261
public static int checkArgPositive(final int arg, final String argNameOrErrorMsg) {
        if (arg <= 0) {
            if (argNameOrErrorMsg.indexOf(' ') == N.INDEX_NOT_FOUND) {
                throw new IllegalArgumentException("'" + argNameOrErrorMsg + "' can not be zero or negative: " + arg);
            } else {
                throw new IllegalArgumentException(argNameOrErrorMsg);
            }
        }

        return arg;
    }
233987
protected String getParameterAsString(Object arg) {
        if (arg instanceof String) {
            return (String) arg;
        }
        return arg == null ? "null" : arg.toString();
    }
889934
private static void checkArguments(final Object... args) {
        for (Object o : args) {
            if (o == null) {
                throw new NullPointerException("argument can not be null " + Arrays.toString(args));
            }
        }
    }
493710
private void assertNotNull(Object value, String message) throws IllegalArgumentException {
        if (value == null) {
            throw new IllegalArgumentException(message);
        }
    }
957821
private void failWithMessage(String errorMessage) {
      AssertionError assertionError = Failures.instance().failureIfErrorMessageIsOverridden(info);
      if (assertionError == null) {
        // error message was not overridden, build it.
        String description = MessageFormatter.instance().format(info.description(), info.representation(), "");
        assertionError = new AssertionError(description + errorMessage);
      }
      Failures.instance().removeAssertJRelatedElementsFromStackTraceIfNeeded(assertionError);
      throw assertionError;
    }
1318866
public static <T> T checkNotEmpty(T reference,  Object errorMessage) {
        checkNotNull(reference, "Expected not null object, got '%s'", reference);
        checkNotEmpty(reference, String.valueOf(errorMessage), Arrays2.EMPTY_ARRAY);
        return reference;
    }
1184315
@Override
    public T parse(String arg) throws ParseException {
        if (isNull(arg)) {
            if (nullable) {
                return null;
            } else {
                throw new ParseException(ParseError.INVALID_PARAM, "Parameter doesn't take 'null' values: " + getName());
            }
        }
        return parseNonNull(arg);
    }
746340
public static void checkNotNull(Object value, String message, Object... args) {
    if (value == null) {
      throw new NullPointerException(String.format(message, args));
    }
  }
845186
public static String checkNotEmpty(String arg, @Nullable Object errorMessage) {
    boolean empty = Strings.isNullOrEmpty(arg) || CharMatcher.whitespace().matchesAllOf(arg);
    checkArgument(!empty, errorMessage);
    return arg;
  }
586574
public static <T> T assertNotNull(T argument, String msg) {
        if (argument == null) throw new IllegalArgumentException(msg);
        return argument;
    }
39231
public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
    if (!b) {
      throw new IllegalArgumentException(format(errorMessageTemplate, p1));
    }
  }
133547
Object convertArgument(String arg, Type paramType) throws IllegalArgumentException {
		Object result = null;
		if (null == arg || "null".equals(arg)) {
			return result;
		}
		logger.debug("Try to convert {} : param = {} : {}", new Object[]{arg, paramType, paramType.getClass()});
		try { // GenericArrayType, ParameterizedType, TypeVariable<D>, WildcardType, Class
			if (ParameterizedType.class.isInstance(paramType)) {
				JavaType javaType = getJavaType(paramType);
				logger.debug("Try to convert '{}' to JavaType : '{}'", arg, paramType);
				result = getObjectMapper().readValue(arg, javaType);
				logger.debug("Conversion of '{}' to '{}' : OK", arg, paramType);
			} else if (Class.class.isInstance(paramType)) {
				Class cls = (Class) paramType;
				logger.debug("Try to convert '{}' to Class '{}'", arg, paramType);
				checkStringArgument(cls, arg);
				result = getObjectMapper().readValue(arg, cls);
				logger.debug("Conversion of '{}' to '{}' : OK", arg, paramType);
			} else { // GenericArrayType, TypeVariable<D>, WildcardType
				logger.warn("Conversion of '{}' to '{}' not yet supported", arg, paramType);
			}
		} catch (IOException ex) {
			logger.debug("Conversion of '{}' to '{}' failed", arg, paramType);
			throw new IllegalArgumentException(paramType.toString());
		}
		return result;
	}
970856
public static void assertNull(String message, Object object) {
        if (object == null) {
            return;
        }
        failNotNull(message, object);
    }