Example usage for java.lang Exception getClass

List of usage examples for java.lang Exception getClass

Introduction

In this page you can find the example usage for java.lang Exception getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:de.arraying.arraybot.util.UScript.java

/**
 * Error in chat./*from w  w w  .jav  a  2  s  . c  o m*/
 * @param exception The exception.
 */
public static void error(CommandEnvironment environment, Exception exception) {
    Message.SCRIPT_ERROR.send(environment.getChannel(), exception.getClass().getName(), exception.getMessage())
            .queue();
}

From source file:info.papdt.blacklight.api.login.LoginApi.java

public static String[] login(String appId, String appSecret, String username, String passwd) {
    WeiboParameters params = new WeiboParameters();
    params.put("username", username);
    params.put("password", passwd);
    params.put("client_id", appId);
    params.put("client_secret", appSecret);
    params.put("grant_type", "password");

    try {/*  w w  w.ja va 2s .co  m*/
        JSONObject json = requestWithoutAccessToken(Constants.OAUTH2_ACCESS_TOKEN, params, HTTP_POST);
        return new String[] { json.optString("access_token"), json.optString("expires_in") };
    } catch (Exception e) {
        if (DEBUG) {
            Log.e(TAG, "login error:" + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:info.papdt.blacklight.api.search.TopicsApi.java

public static MessageListModel searchTopic(String q, int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("q", q);
    params.put("count", count);
    params.put("page", page);

    try {/*from   w  w w.j  a va 2  s . co  m*/
        JSONObject json = request(Constants.SEARCH_TOPICS, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), MessageListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot search, " + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:info.papdt.blacklight.api.favorites.FavListApi.java

public static MessageListModel fetchFavList(int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("count", count);
    params.put("page", page);

    try {/*  w ww  .  java2s . c o m*/
        JSONObject json = request(Constants.FAVORITES_LIST, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), FavListModel.class).toMsgList();
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch fav list, " + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:com.switchfly.inputvalidation.CobrandNameValidationStrategyTest.java

public static void assertThrowException(Class<? extends Throwable> exceptionClass, Closure closure) {
    try {/*from  w ww. ja  v  a2  s. com*/
        closure.execute(null);
        fail("Should throw " + exceptionClass.getName());
    } catch (Exception e) {
        assertTrue(exceptionClass.isAssignableFrom(e.getClass()));
    }
}

From source file:info.papdt.blacklight.api.statuses.HomeTimeLineApi.java

public static MessageListModel fetchHomeTimeLine(int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("count", count);
    params.put("page", page);

    try {/*from   w w  w .j a  v a  2 s  .co m*/
        JSONObject json = request(Constants.HOME_TIMELINE, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), MessageListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch home timeline, " + e.getClass().getSimpleName());
            Log.d(TAG, Log.getStackTraceString(e));
        }
        return null;
    }
}

From source file:fi.vm.kapa.identification.shibboleth.extauthn.util.CertificateUtil.java

public static boolean checkSignature(String data, String signature, X509Certificate cert) {
    boolean result = false;
    try {//from   w  w w.  j  a v a 2  s  . co  m
        logger.debug("checkSignature: data={}, signature={}, cert={}", data, signature, cert.toString());
        byte[] sigToVerify = Base64.getDecoder().decode(signature);
        Signature sig = Signature.getInstance("SHA256withRSA");
        sig.initVerify(cert);
        sig.update(Base64.getDecoder().decode(data));
        result = sig.verify(sigToVerify);
    } catch (Exception e) {
        logger.warn("checkSignature: Got exception " + e.getClass(), e);
    }
    return result;
}

From source file:info.papdt.blacklight.api.comments.CommentMentionsTimeLineApi.java

public static CommentListModel fetchCommentMentionsTimeLine(int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("count", count);
    params.put("page", page);

    try {/*  w  w w .j av  a 2 s .  co  m*/
        JSONObject json = request(Constants.COMMENTS_MENTIONS, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), CommentListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch mentions timeline, " + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:info.papdt.blacklight.api.statuses.RepostTimeLineApi.java

public static RepostListModel fetchRepostTimeLine(long msgId, int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("id", msgId);
    params.put("count", count);
    params.put("page", page);

    try {//from ww w  .j a  v  a 2  s .c  o m
        JSONObject json = request(Constants.REPOST_TIMELINE, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), RepostListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch repost timeline, " + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:info.papdt.blacklight.api.comments.StatusCommentApi.java

public static CommentListModel fetchCommentOfStatus(long msgId, int count, int page) {
    WeiboParameters params = new WeiboParameters();
    params.put("id", msgId);
    params.put("count", count);
    params.put("page", page);

    try {/*from   w  w  w.j  ava  2s.  c  o  m*/
        JSONObject json = request(Constants.COMMENTS_SHOW, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), CommentListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch comments timeline, " + e.getClass().getSimpleName());
        }
        return null;
    }
}