Throws an exception if no pass with the given name exists.
768853
private static int findPassIndexByName(
      List<PassFactory> factoryList, String name) {
    for (int i = 0; i < factoryList.size(); i++) {
      if (factoryList.get(i).getName().equals(name)) {
        return i;
      }
    }

    throw new IllegalArgumentException(
        "No factory named '" + name + "' in the factory list");
  }
1177551
public static <T extends Collection<?>> T checkNotEmpty(final String name,
                                                            final T parameter) {
        if (parameter == null || parameter.size() == 0) {
            throw new IllegalArgumentException("Parameter named '" + name + "' should be filled!");
        }
        return parameter;
    }
395126
def make_exception(method, e):
    """"""
    x = e.details()
    name = x[:x.find(':')].split('.')[-1]
    if name in globals():
        cls = globals()[name]
    else:
        cls = UnknownRpcException  # noqa

    return cls(method, e.code(), e.details())
1252979
public static void checkResourceName(String name) {
        if (name == null || (!name.isEmpty() && !name.matches("^[a-zA-Z0-9_;\\-\\.\\[\\]\\(\\)]+$"))) {
            throw new IllegalArgumentException("name(" + name + ") contains illegal character, must be (a-z,A-Z,0-9,_,.,(,),-,[,])");
        }
    }
255062
protected void validName(String name) throws SyntaxException {
		for (String varName : automaticVariables) {
			if (varName.equals(name)) {
				throw SyntaxException.create(getSourceRange(),
						MSG_AUTO_VAR_CANNOT_BE_SET, varName);
			}
		}
	}
1098131
def do_pass(self, element, decl, pseudo):
        """"""
        log(WARN, u"Old-style pass as declaration not allowed.{}"
            .format(decl.value).encpde('utf-8'))
1111133
function (func, name, value, valid) {
        if (typeof valid !== "undefined")
            if (!$cs.validate(value, valid))
                throw _cs.exception(func, "parameter \"" + name + "\" has " +
                    "value " + _cs.json(value) + ", which does not validate " +
                    "against \"" + valid + "\"");
    }
476244
static void checkPropName(String name, String callingMethodName) throws IllegalArgumentException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "checkPropName", new Object[] { name, callingMethodName });

        if ((name == null) || ("".equals(name))) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "Invalid field name: " + name + " as parameter to " + callingMethodName);
            throw (IllegalArgumentException) JmsErrorUtils.newThrowable(IllegalArgumentException.class,
                                                                        "INVALID_FIELD_NAME_CWSIA0106",
                                                                        null, // no inserts for CWSIA0106
                                                                        tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "checkPropName");
    }
1232329
private static Integer checkQuietly(final String name, final Integer value)
	{
		Integer val = 50;
		try
		{
			val = Args.withinRange(0, 100, value, name);
		}
		catch (final IllegalArgumentException e)
		{
			LOGGER.error(String.format(
				"Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.",
				name, 0, 100, value));
		}
		return val;

	}
3249
private void checkForExistence(String fileName) throws IOException {
        File file = new File(fileName);
        if (!file.exists()) {
            throw new FileNotFoundException("File with name " + fileName + " does not exist.");
        }
        if (!file.isFile()) {
            throw new IOException("Provided string does not correspond to an actual file.");
        }

    }
946785
public static <T> T assertNotNull(T value, String name) {
        if (value == null)
            throw new IllegalArgumentException("Null " + name);

        return value;
    }
1103326
public static void parameterNotEmpty(final String name, final Iterable obj) {
        if (!obj.iterator().hasNext()) {
            raiseError(format("Parameter '%s' from type '%s' is expected to NOT be empty", name, obj.getClass().getName()));
        }
    }
741532
private void checkForUTOKENNotFoundError(Subject subj) throws ResourceException {

        // A Subject without a UTOKEN genericCredential can
        // legitimately occur in the case where the resource
        // adapter has indicated Thread Identity Support
        // is "ALLOWED, but a valid Container-managed alias
        // was specified. On the other hand, at this ponit, if
        // either of the following two cases exist when there is
        // no UTOKEN genericCredential, then we have an
        // unexpected error and need to throw an exception:
        //
        //   1. The resource adapter REQUIRES that Thread Identity
        //      be used.
        //
        //   2. The Subject has no private credentials at all
        //

        // Check if ThreadIdentitySupport is "REQUIRED"

        if (m_ThreadIdentitySupport == AbstractConnectionFactoryService.THREAD_IDENTITY_REQUIRED) {

            // ThreadIdentitySupport indicates that the use of thread
            // identity is "REQUIRED" by the connector, but the
            // Subject doesn't contain a UTOKEN GenericCredential.
            // This should not ever occur because finalizeSubject()
            // should have created a Subject with a UTOKEN
            // GenericCredential when ThreadidentitySupport is
            // "REQUIRED". Thus, throw an exception to terminate
            // processing right here.
            //

            try {
                IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject not setup for using thread identity, but the connector requires thread identity be used.");
                Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
                Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                throw e;
            } catch (IllegalStateException ise) {
                ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
                re.initCause(ise);
                throw re;
            }

        } // end if m_ThreadIdentitySupport.equals REQUIRED

        // Check if Subject has at least one a private credential

        Set privateCredentials = subj.getPrivateCredentials();
        Iterator privateIterator = privateCredentials.iterator();

        if (!privateIterator.hasNext()) { // if no private credentials

            // There is not only no UTOKEN generic credential, but
            // also, there are no private credentials at all. This
            // should not happen. If there are no private credentials,
            // the finalizeSubject() processing should have built
            // a UTOKEN generic credential.
            //

            try {
                IllegalStateException e = new IllegalStateException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with no credentials.");
                Object[] parms = new Object[] { "ThreadIdentitySecurityHelper.beforeGettingConnection()", e };
                Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
                throw e;
            } catch (IllegalStateException ise) {
                ResourceException re = new ResourceException("ThreadIdentitySecurityHelper.beforeGettingConnection() detected Subject with illegal state");
                re.initCause(ise);
                throw re;
            }

        } // end if no private credentials
    }
247606
public Class<?> forName(final String name) throws ClassNotFoundException {
        if (System.getSecurityManager() == null)
            return Class.forName(name);
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
                @Override
                public Class<?> run() throws Exception {
                    return Class.forName(name);
                }
            }, controlContext);
        } catch (PrivilegedActionException e) {
            if (e.getException() instanceof ClassNotFoundException)
                throw (ClassNotFoundException) e.getException();
            throw (RuntimeException) e.getException();
        }
    }
1116548
public String checkName(String name) throws Failure {
        if(name==null)
            throw new Failure("Query parameter 'name' is required");

        name = name.trim();
        Jenkins.checkGoodName(name);

        if(Jenkins.getInstance().getNode(name)!=null)
            throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));

        // looks good
        return name;
    }
1195792
public static void validate(byte[] cert, String pass) throws Exception {

        try {
            KeyStore keyStore = KeyStore.getInstance(ALGORITHM);
            keyStore.load(new ByteArrayInputStream(cert), pass.toCharArray());
        } catch (Exception e) {
            throw new Exception("Certificate is not valid!", e);
        }
    }
231840
public static void EQ(long parameter, long expected, String name) throws IllegalArgumentException {
		if (parameter != expected) {
			throw new IllegalArgumentException(String.format("%s is not %d.", name, expected));
		}
	}