Example usage for android.accounts NetworkErrorException getMessage

List of usage examples for android.accounts NetworkErrorException getMessage

Introduction

In this page you can find the example usage for android.accounts NetworkErrorException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.smilec.smile.bu.AbstractBaseManager.java

protected static void checkServer(String ip) throws NetworkErrorException {

    InputStream is = null;//from  ww  w.  j a v  a 2 s. c  o m
    String url = SmilePlugUtil.createUrl(ip);

    try {
        is = HttpUtil.executeGet(url);
    } catch (NetworkErrorException e) {
        throw new NetworkErrorException("Connection errror: " + e.getMessage(), e);
    } finally {
        IOUtil.silentClose(is);
    }

    if (is == null) {
        throw new NetworkErrorException("Server unavailable");
    }

}

From source file:org.smilec.smile.bu.AbstractBaseManager.java

protected InputStream get(String ip, Context context, String url) throws NetworkErrorException {

    connect(ip, context);/*from  w w  w .  j a va2  s  .  co m*/

    try {
        return HttpUtil.executeGet(url);
    } catch (NetworkErrorException e) {
        throw new NetworkErrorException("Connection error: " + e.getMessage(), e);
    }

}

From source file:org.smilec.smile.bu.AbstractBaseManager.java

protected void put(String ip, Context context, String url, String json) throws NetworkErrorException {
    connect(ip, context);/*  w w w .  ja va2 s . com*/

    InputStream is = null;

    try {
        is = HttpUtil.executePut(url, json);
    } catch (NetworkErrorException e) {
        throw new NetworkErrorException("Connection error: " + e.getMessage(), e);
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    } catch (JSONException e) {
        throw new RuntimeException(e);
    } finally {
        IOUtil.silentClose(is);
    }

    if (is == null) {
        throw new NetworkErrorException("Service unavailable");
    }

}