Throw exception if the given string is null or empty or only whitespace.
187468
public static void assureSet(String s, String varName) {
    Objects.requireNonNull(varName);
    if (isEmpty(s.trim())) {
      throw new IllegalArgumentException(varName + " cannot be empty or whitespace only");
    }
  }
1194654
private void _handleEmptyValue(TypedValueDecoder dec)
        throws XMLStreamException
    {
        try { // default action is to throw an exception
            dec.handleEmptyValue();
        } catch (IllegalArgumentException iae) {
            throw _constructTypeException(iae, "");
        }
    }
530026
public static boolean isWhitespace(String s) {
        // Is s empty?
        if (isEmpty(s)) return true;

        // Search through string's characters one by one
        // until we find a non-whitespace character.
        // When we do, return false; if we don't, return true.
        for (int i = 0; i < s.length(); i++) {
            // Check that current character isn't whitespace.
            char c = s.charAt(i);

            if (whitespace.indexOf(c) == -1) return false;
        }
        // All characters are whitespace.
        return true;
    }
617515
public static void checkNotEmpty(@Nullable String value, @NonNull String message) {
        if (value == null) {
            throw new NullPointerException(message);
        } else if (value.length() == 0) {
            throw new IllegalStateException(message);
        }
    }
834093
public final void mEMPTY() throws RecognitionException {
		try {
			int _type = EMPTY;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:23:7: ( 'empty' )
			// hql.g:23:9: 'empty'
			{
			match("empty"); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
187068
public static String notEmptyIfNotNull(String value, String name, String info) {
        if (value == null) {
            return value;
        }

        if (value.trim().length() == 0) {
            throw new IllegalArgumentException(name + " cannot be empty" + (info == null ? "" : ", " + info));
        }
        return value.trim();
    }
885047
protected String nullIfEmpty(String str) {
        return (str == null || str.trim().length() == 0) ? null : str;
    }
1344736
public final IJSONSerializable<?> fromString(final String string) throws Exception, ValidationException
    {
        final ValidationContext ctx = new ValidationContext();

        ctx.setValidate(true);

        ctx.setStopOnError(true);

        final IJSONSerializable<?> result = fromString(string, ctx);

        if (ctx.getErrorCount() > 0)
        {
            throw new ValidationException(ctx);
        }
        if (null == result)
        {
            throw new Exception("Unknown reason for NULL result in JSONParser");
        }
        return result;
    }
587018
private void skipWhitespace() throws SAXException, IOException {
        // OK, do it the slow way.
        char c = readCh();
        while (isWhitespace(c)) {
            c = readCh();
        }
        unread(c);
    }
594651
public static boolean isEmpty(String aString)  {
    	boolean result = true;
    	if (aString != null && aString.trim().length()>0) { 
    		if (!aString.trim().toUpperCase().equals("NULL")) { 
    		   result = false;
    		}
    	}
    	return result;
    }
678711
public static void checkNotEmpty(CharSequence str, String message) {
    if (str == null || str.length() == 0) {
      throw new IllegalArgumentException(message);
    }
  }
96498
def check_convert_string(obj, name=None,
                             no_leading_trailing_whitespace=True,
                             no_whitespace=False,
                             no_newline=True,
                             whole_word=False,
                             min_len=1,
                             max_len=0):
        """"""
        if not name:
            name = 'Argument'
        obj = ensure_unicode(obj, name=name)
        if no_whitespace:
            if _PATTERN_WHITESPACE.match(obj):
                raise ValueError('%s cannot contain whitespace' % name)
        elif no_leading_trailing_whitespace and _PATTERN_LEAD_TRAIL_WHITESPACE.match(obj):
            raise ValueError('%s contains leading/trailing whitespace' % name)
        if (min_len and len(obj) < min_len) or (max_len and len(obj) > max_len):
            raise ValueError('%s too short/long (%d/%d)' % (name, min_len, max_len))
        if whole_word:
            if not _PATTERN_WORD.match(obj):
                raise ValueError('%s can only contain alphanumeric (unicode) characters, numbers and the underscore'
                                 % name)
        # whole words cannot contain newline so additional check not required
        elif no_newline and '\n' in obj:
            raise ValueError('%s cannot contain line breaks' % name)
        return obj
315672
@CheckForNull
    public static String fixEmpty(@CheckForNull String s) {
        if(s==null || s.length()==0)    return null;
        return s;
    }
963298
private boolean tryWhitespace() throws SAXException, IOException {
        char c;
        c = readCh();
        if (isWhitespace(c)) {
            skipWhitespace();
            return true;
        } else {
            unread(c);
            return false;
        }
    }
444538
private void validate() throws Exception {
		final String text = parent.getText().trim();
		if (text.isEmpty() || text.length() == 1) {
			String msg = String.format("Empty query");
			invalid = true;
			throw new Exception(msg);
		}

		TargetQueryParser textParser = new TurtleOBDASQLParser(
		        apic.getMutablePrefixManager().getPrefixMap(),
                apic.getTermFactory(),
				apic.getTargetAtomFactory(),
				apic.getRdfFactory());
		ImmutableList<TargetAtom> query = textParser.parse(text);

		if (query == null) {
			invalid = true;
			throw parsingException;
		}
		List<IRI> invalidPredicates = TargetQueryValidator.validate(query, apic.getCurrentVocabulary());
		if (!invalidPredicates.isEmpty()) {
			String invalidList = "";
			for (IRI predicateIri : invalidPredicates) {
				invalidList += "- " + predicateIri + "\n";
			}
			String msg = String.format("ERROR: The below list of predicates is unknown by the ontology: \n %s Note: null indicates an unknown prefix.", invalidList);
			invalid = true;
			throw new Exception(msg);
		}
		invalid = false;
	}
886598
public static String trimWhitespaceToNull(final String s) {
        final String result = trimWhitespace(s);
        return StringUtils.isEmpty(result) ? null : s;
    }
1099905
public void validate(String input) throws Exception {
        Assert.assertFalse(input == null);
        Assert.assertFalse(input.trim().equals(""));
    }