The sujbect has to be non-null
425694
public static String getUserNameFromSubject(Subject subject) {
        Iterator<Principal> it = subject.getPrincipals().iterator();
        String username = it.next().getName();
        return username;
    }
542003
public void setBooleanIfNotNull(@NotNull final String key, @Nullable final Boolean value) {
        if (null != value) {
            setBoolean(key, value);
        }
    }
270809
public static <K, V> void validateNotNull(K key, V value) {
        checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
        checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED);
    }
1212599
static <T> T ensureNotNull(String msg, T t) throws ClassLoadingConfigurationException {
        ensure(msg, t != null);
        return t;
    }
585319
def _is_null(self, value):
        """"""
        if isinstance(value, six.string_types):
            if not len(value.strip()):
                return True
        return value is None
928330
public static <T> T checkNotNull (T value, String param)
    {
        if (value == null) {
            throw new NullPointerException("Must supply non-null '" + param + "'.");
        }
        return value;
    }
261536
public static <T> T checkNotNull(T obj, String name) {
    if (obj == null) {
      String msg = String.format("parameter '%s' cannot be null", name);
      throw new NullPointerException(msg);
    }
    return obj;
  }
493885
static void assertNotNull(String message, Object nonNullObject)
    {
        if(nonNullObject == null)
        {
            System.err.println(message);
        }
    }
226014
public static <O extends Object> void notNull(O o, String message) {
		if(!validation) return;
		notNull(message);
		if(o == null)
			throw new ParameterException(ErrorCode.NULLPOINTER, message);
	}
547333
private <T> void bindIfNotNull(final Class<T> interfaceType, @Nullable final Class<? extends T> implementationType) {
        if (implementationType != null) {
            bind(interfaceType).to(implementationType);
        }
    }
734455
private boolean validateNull(Object validationObject, Annotation annotate)
    {
        if (checkNullObject(validationObject))
        {
            return true;
        }

        if (!validationObject.equals(null) || validationObject != null)
        {
            throwValidationException(((Null) annotate).message());
        }

        return true;
    }
1247886
public static void assertNotNull(final Object object, final StatusType status) {
		RESTAssert.assertTrue(object != null, status);
	}
88907
public static void validateNull( Object object, String identifier )
        throws PreConditionException
    {
        if( object == null )
        {
            return;
        }
        throw new PreConditionException( identifier + " was NOT NULL." );
    }
587169
public static Long nonNegative(@Nullable String role, Long x) {
		if (x.longValue() < 0) {
			throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
		}
		return x;
	}
64470
private Optional<Object> touchAuditor(AuditableBeanWrapper<?> wrapper,
			boolean isNew) {

		Assert.notNull(wrapper, "AuditableBeanWrapper must not be null!");

		return auditorAware.map(it -> {

			Optional<?> auditor = it.getCurrentAuditor();

			Assert.notNull(auditor,
					() -> String.format("Auditor must not be null! Returned by: %s!",
							AopUtils.getTargetClass(it)));

			auditor.filter(__ -> isNew).ifPresent(foo -> wrapper.setCreatedBy(foo));
			auditor.filter(__ -> !isNew || modifyOnCreation)
					.ifPresent(foo -> wrapper.setLastModifiedBy(foo));

			return auditor;
		});
	}
725573
private static String checkNotEmpty(String v, String name) {
    Preconditions.checkNotNull(v, name);
    Preconditions.checkArgument(!v.isEmpty(), "%s cannot be empty", name);
    return v;
  }
900178
private boolean hasNotNull(AnnotationRepository annotationRepository, Annotation annotation)
   {
      Collection<Annotation> values = annotationRepository.getAnnotation(javax.validation.constraints.NotNull.class);

      if (values == null || values.isEmpty())
         return false;

      for (Annotation notNullAnnotation : values)
      {
         if (notNullAnnotation.getClassName().equals(annotation.getClassName()) &&
             notNullAnnotation.getMemberName().equals(annotation.getMemberName()))
            return true;
      }

      return false;
   }