List of usage examples for java.lang IllegalStateException IllegalStateException
public IllegalStateException(Throwable cause)
From source file:com.tibbo.linkserver.plugin.device.file.item.NumericItem.java
private void validate() { super.validate(getItemRegisterCount()); if (range == 0 || range == 1) { throw new IllegalStateException("Only binary values can be read from Coil and Input ranges"); }/*from w w w .java2s . c om*/ if (!ArrayUtils.contains(DATA_TYPES, dataType)) { throw new IllegalStateException("Invalid data type"); } else { return; } }
From source file:cz.lbenda.rcp.config.ConfigurationRW.java
/** Return already created instance of configuration RW * @return already create instance of configuration which must be create by {@link ConfigurationRW#createInstance(String, String)} * @throws IllegalStateException when you want get instance of configuraiton RW before you create it * */// w w w. java2s.co m public static ConfigurationRW getInstance() throws IllegalStateException { if (configurationRW == null) { throw new IllegalStateException("The instance isn't created yet."); } return configurationRW; }
From source file:com.connorbrezinsky.msg.security.Hash.java
/** * Checks whether given plaintext password corresponds to a stored salted * hash of the password.//w ww .j a v a 2 s.c om */ public static boolean check(String password, String stored) throws Exception { String[] saltAndPass = stored.split("\\$"); if (saltAndPass.length != 2) { throw new IllegalStateException("The stored password have the form 'salt$hash'"); } String hashOfInput = hash(password, Base64.decodeBase64(saltAndPass[0])); return hashOfInput.equals(saltAndPass[1]); }
From source file:org.onebusaway.webapp.impl.GWTAbstractFactory.java
public void setType(Class<?> type) { if (!_parentType.isAssignableFrom(type)) throw new IllegalStateException("type is not assignable to " + _parentType); _type = type;//from w w w . j a v a2 s . c o m }
From source file:cz.cuni.amis.planning4j.external.impl.itsimple.ItSimpleUtils.java
/** * This method gets the operating system name on which the program is running as * used in itSimple xml format//from w w w . j a va 2 s .co m * @return "linux" OR "windows" OR "mac" */ public static EPlannerPlatform getOperatingSystem() { String operatingSystem = System.getProperty("os.name").toLowerCase(); if (operatingSystem.indexOf("linux") == 0) { return EPlannerPlatform.LINUX; } else if (operatingSystem.indexOf("windows") == 0) { return EPlannerPlatform.WINDOWS; } else if (operatingSystem.indexOf("mac") == 0) { return EPlannerPlatform.MAC; } throw new IllegalStateException("Current platform could not be guessed"); }
From source file:de.kaiserpfalzEdv.iam.identity.LoginQueryBuilder.java
private void validate() { if (isBlank(login)) throw new IllegalStateException("Can't query without login!"); if (isBlank(password)) throw new IllegalStateException("Can't query without password!"); }
From source file:com.github.woozoo73.test.dummy.ProcessorImpl.java
private String processInternal(String name) { if (name == null) { throw new IllegalStateException("name must not be null."); }// ww w. ja v a2 s .c o m String id = UUID.randomUUID().toString(); User user = new User(id, name); userDao.insert(user); try { userDao.insertInvalid(); } catch (Exception e) { } user = userDao.select(id); return "Hello, " + user.getName() + "."; }
From source file:com.reactive.hzdfs.SpringContext.java
/** * //ww w .jav a 2 s .co m * @param type * @return */ public static <T> T getBean(Class<T> type) { if (springContext == null) throw new IllegalStateException("Context not formed"); return springContext.getBean(type); }
From source file:com.microsoft.tfs.core.internal.db.ConnectionPool.java
public synchronized DBConnection getConnection() { if (shutdown) { throw new IllegalStateException(Messages.getString("ConnectionPool.ConnectionPoolHasBeenShutdown")); //$NON-NLS-1$ }/*from w w w .j a v a 2s. c o m*/ if (pooledConnections.size() > 0) { final DBConnection connection = (DBConnection) pooledConnections.remove(0); givenConnections.put(connection, MessageFormat.format("gave connection to [{0}] at [{1}]", //$NON-NLS-1$ Thread.currentThread().getName(), new Date())); return connection; } else if (givenConnections.size() < POOL_SIZE) { final DBConnection connection = connectionConfiguration.createNewConnection(); givenConnections.put(connection, MessageFormat.format("gave connection to [{0}] at [{1}]", //$NON-NLS-1$ Thread.currentThread().getName(), new Date())); return connection; } throw new IllegalStateException( MessageFormat.format("no connections left in pool ({0})", givenConnections)); //$NON-NLS-1$ }
From source file:com.adito.networkplaces.NetworkPlaceDatabaseFactory.java
/** * @param networkPlaceDatabaseImpl the class of the NetworkPlace database * @param lock weather to lock the NetworkPlace database after setting it. * @throws IllegalStateException//from www .j a v a 2 s . c o m */ public static void setFactoryImpl(Class networkPlaceDatabaseImpl, boolean lock) throws IllegalStateException { if (locked) { throw new IllegalStateException("NetworkPlace database factory has been locked by another plugin."); } NetworkPlaceDatabaseFactory.networkPlaceDatabaseImpl = networkPlaceDatabaseImpl; locked = lock; }