List of usage examples for java.lang IllegalStateException IllegalStateException
public IllegalStateException(Throwable cause)
From source file:Main.java
public static void checkMain() { if (!isMain()) { throw new IllegalStateException("Method call should happen from the main thread."); }// w ww. ja v a2s .co m }
From source file:Main.java
public static void checkNotMain() { if (isMain()) { throw new IllegalStateException("Method call should not happen from the main thread."); }/*from w ww . j av a 2s .c o m*/ }
From source file:Main.java
public static <T> T head(List<T> list) { if (list.size() == 0) { throw new IllegalStateException("head of empty list"); }/*from w w w . j av a2 s. c o m*/ return list.get(0); }
From source file:Main.java
public static void sleep(long millis) { try {//from ww w . j a v a 2 s . c om Thread.sleep(millis); } catch (InterruptedException e) { throw new IllegalStateException(e); } }
From source file:Main.java
public static void throwProguardError(Exception paramException) { if ((paramException instanceof NoSuchMethodException)) { throw new IllegalStateException( "Chartboost library error! Have you used proguard on your application? Make sure to add the line '-keep class com.chartboost.sdk.** { *; }' to your proguard config file."); }/* w ww . j av a 2 s. co m*/ throw new RuntimeException(paramException); }
From source file:Main.java
public static void checkBackgroudThread() { if (Looper.getMainLooper() == Looper.myLooper()) { throw new IllegalStateException("It must run in backgroud thread."); }//from w w w .j a v a 2s . c o m }
From source file:Main.java
public static void assertInEventDispatchThread() { if (!SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("Must be called from event dispatch thread"); }/*w w w . j a v a 2 s .c o m*/ }
From source file:Main.java
public static void assertUIThread() { if (!isUIThread()) { throw new IllegalStateException("is not ui thread!!"); }//w ww. jav a 2s .c om }
From source file:Main.java
public final static void assertInEDT() throws IllegalStateException { if (!SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("This code must run in the EDT"); }// ww w .j a va2s. com }
From source file:Main.java
public static void sleep(int delay) { try {/*from ww w .j ava 2 s . c om*/ Thread.sleep(delay + 100); } catch (InterruptedException shouldNotHappen) { throw new IllegalStateException(shouldNotHappen); } }