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:info.papdt.blacklight.api.statuses.BilateralTimeLineApi.java

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

    try {/* ww  w .jav a  2s. c o m*/
        JSONObject json = request(Constants.BILATERAL_TIMELINE, params, HTTP_GET);
        return new Gson().fromJson(json.toString(), MessageListModel.class);
    } catch (Exception e) {
        if (DEBUG) {
            Log.d(TAG, "Cannot fetch bilateral timeline, " + e.getClass().getSimpleName());
            Log.d(TAG, Log.getStackTraceString(e));
        }
        return null;
    }
}

From source file:Main.java

public static String getMsg(Exception ex) {
    if (ex == null)
        return "null";
    else if (ex.getMessage() == null)
        return "null, " + ex.getClass().getSimpleName();

    if (ex.getMessage().length() > 100)
        return ex.getMessage().substring(0, 100) + "...";
    return ex.getMessage();
}

From source file:com.dhenton9000.selenium.generic.UtilMethods.java

/**
 * handle an alert if no alert present error caught and reported
 * @param driver//from   www. j a  v a  2s .  com
 * @param doAccept 
 */
public static void handleAlert(WebDriver driver, boolean doAccept) {

    try {
        Alert a = driver.switchTo().alert();
        if (doAccept)
            a.accept();
        else
            a.dismiss();
    } catch (Exception err) {
        LOG.warn("handle alert error " + err.getClass().getName() + " " + err.getMessage());

    }

}

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

public static MessageListModel fetchMentionsTimeLineSince(long id) {
    WeiboParameters params = new WeiboParameters();
    params.put("since_id", id);

    try {//from ww w .ja va  2 s  .  c  o m
        JSONObject json = request(Constants.MENTIONS, 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());
        }
        return null;
    }
}

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

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

    try {//  www  .j a v  a  2 s  .  com
        JSONObject json = request(Constants.MENTIONS, 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());
        }
        return null;
    }
}

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

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

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

From source file:Main.java

public static void displayErrorDialog(Activity activity, Exception e) {
    String message = e.getLocalizedMessage();
    if (message == null || message == "") {
        message = e.getClass().getName();
    } else {// w w  w.  j  ava  2s  . co m
        message = e.getClass().getName() + ": " + message;
    }

    Log.e(activity.getClass().toString(), "Exception: " + message, e);

    final String title = "Error";

    displayInfoBox(activity, title, message);
}

From source file:com.thoughtworks.studios.journey.jql.DataQueryResult.java

public static DataQueryResult error(Exception e) {
    DataQueryResult result = new DataQueryResult(0);
    result.errors = e.getClass().getSimpleName() + ": " + e.getMessage();
    return result;
}

From source file:info.papdt.blacklight.api.user.UserApi.java

public static UserModel getUser(String uid) {
    WeiboParameters params = new WeiboParameters();
    params.put("uid", uid);

    try {/*from  w  ww .  ja v  a 2 s .  c o m*/
        JSONObject json = request(Constants.USER_SHOW, params, HTTP_GET);
        UserModel user = new Gson().fromJson(json.toString().replaceAll("-Weibo", ""), UserModel.class);
        return user;
    } catch (Exception e) {
        if (DEBUG) {
            Log.e(TAG, "Failed to fetch user info from net: " + e.getClass().getSimpleName());
        }
        return null;
    }
}

From source file:info.papdt.blacklight.api.user.UserApi.java

public static UserModel getUserByName(String name) {
    WeiboParameters params = new WeiboParameters();
    params.put("screen_name", name);

    try {/* w w  w.jav a 2 s .  c  o  m*/
        JSONObject json = request(Constants.USER_SHOW, params, HTTP_GET);
        UserModel user = new Gson().fromJson(json.toString().replaceAll("-Weibo", ""), UserModel.class);
        return user;
    } catch (Exception e) {
        if (DEBUG) {
            Log.e(TAG, "Failed to fetch user info from net: " + e.getClass().getSimpleName());
        }
        return null;
    }
}