ExceptionHandler.java

ExceptionHandler.java

Универсальный класс для обработки исключений.

ExceptionHandler.java
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public class ExceptionHandler extends Exception {

    private Exception thrownException;

    public ExceptionHandler(Exception thrownExc) {
        
        this.thrownException = thrownExc;

        if (thrownException.getClass().isInstance(javax.microedition.io.ConnectionNotFoundException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.io.IOException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.NullPointerException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.OutOfMemoryError.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.Exception.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.IndexOutOfBoundsException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.ArrayIndexOutOfBoundsException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.ArithmeticException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.IllegalArgumentException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(java.lang.IllegalStateException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(javax.microedition.midlet.MIDletStateChangeException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(javax.microedition.rms.RecordStoreNotFoundException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(javax.microedition.rms.RecordStoreFullException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(javax.microedition.rms.RecordStoreException.class)) {
            // DO SOMETHING
        } else if (thrownException.getClass().isInstance(javax.microedition.media.MediaException.class)) {
            // DO SOMETHING
        }

    }
}
Поиск по сайту

Результаты поиска

Начните вводить запрос. Можно искать по названию, описанию, тексту и тегам.