Example usage for org.json JSONException printStackTrace

List of usage examples for org.json JSONException printStackTrace

Introduction

In this page you can find the example usage for org.json JSONException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:koubachi.internal.json.JSONFactory.java

private PlantCareAdvice createCareAdvice(JSONObject jsonObject) {
    try {/* w ww .jav  a 2s . co  m*/
        Type collectionType = new TypeToken<PlantCareAdvice>() {
        }.getType();
        return gson.fromJson(cleanDateFormat(jsonObject.getString("plant_care_advice")), collectionType);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:koubachi.internal.json.JSONFactory.java

public ArrayList<Sensor> createPlantSensorReadingList(String jsonData) {
    try {/*from ww  w .  j  a  v  a  2  s. c om*/
        JSONObject jsonObject = new JSONObject(jsonData);

        //JSONArray jsonArray = new JSONArray(jsonData);
        return createPlantSensorReadingList(jsonObject.getJSONArray("sensors"));
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:koubachi.internal.json.JSONFactory.java

public Sensor createSensor(String jsonData) {
    try {//from ww  w. j av  a2s . c o  m
        JSONObject jsonObject = new JSONObject(jsonData);
        return createSensor(jsonObject);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;

}

From source file:koubachi.internal.json.JSONFactory.java

private Sensor createSensor(JSONObject jsonObject) {
    try {//from  www .j  a  va 2  s.  c om
        Type collectionType = new TypeToken<Sensor>() {
        }.getType();
        return gson.fromJson(cleanDateFormat(jsonObject.getString("sensor")), collectionType);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:koubachi.internal.json.JSONFactory.java

public CareAction createCareAction(String jsonData) {
    try {//from  ww  w .  j  av a2  s . c  o  m
        JSONObject jsonObject = new JSONObject(jsonData);
        return createCareAction(jsonObject);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;

}

From source file:koubachi.internal.json.JSONFactory.java

private CareAction createCareAction(JSONObject jsonObject) {
    try {//  w ww . j  av a2s .  co  m
        Type collectionType = new TypeToken<CareAction>() {
        }.getType();
        return gson.fromJson(cleanDateFormat(jsonObject.getString("care_action")), collectionType);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.cloverstudio.spika.couchdb.ConnectionHandler.java

public static String getError(JSONObject jsonObject) {

    String error = "Unknown Spika Error: ";

    if (jsonObject.has("message")) {
        try {/*  ww w. j  a  va2s . c  om*/
            error = jsonObject.getString("message");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    } else {
        error += jsonObject.toString();
    }
    return error;
}

From source file:com.example.wcl.test_weiboshare.StatusList.java

public static StatusList parse(String jsonString) {
    if (TextUtils.isEmpty(jsonString)) {
        return null;
    }/*from  ww  w. j  av a 2s .  co  m*/

    StatusList statuses = new StatusList();
    try {
        JSONObject jsonObject = new JSONObject(jsonString);
        statuses.hasvisible = jsonObject.optBoolean("hasvisible", false);
        statuses.previous_cursor = jsonObject.optString("previous_cursor", "0");
        statuses.next_cursor = jsonObject.optString("next_cursor", "0");
        statuses.total_number = jsonObject.optInt("total_number", 0);

        JSONArray jsonArray = jsonObject.optJSONArray("statuses");
        if (jsonArray != null && jsonArray.length() > 0) {
            int length = jsonArray.length();
            statuses.statusList = new ArrayList<Status>(length);
            for (int ix = 0; ix < length; ix++) {
                statuses.statusList.add(Status.parse(jsonArray.getJSONObject(ix)));
            }
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return statuses;
}

From source file:org.billthefarmer.tuner.MainActivity.java

void getPreferences() {
    // Load preferences

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

    // Set preferences
    if (audio != null) {
        audio.input = Integer.parseInt(preferences.getString(PREF_INPUT, "0"));
        audio.reference = preferences.getInt(PREF_REFERENCE, 440);
        audio.transpose = Integer.parseInt(preferences.getString(PREF_TRANSPOSE, "0"));

        audio.filter = preferences.getBoolean(PREF_FILTER, false);
        audio.downsample = preferences.getBoolean(PREF_DOWNSAMPLE, false);
        audio.multiple = preferences.getBoolean(PREF_MULTIPLE, false);
        audio.screen = preferences.getBoolean(PREF_SCREEN, false);
        audio.strobe = preferences.getBoolean(PREF_STROBE, false);
        audio.zoom = preferences.getBoolean(PREF_ZOOM, true);

        // Check screen
        if (audio.screen) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }//from w w  w . ja v a 2s .  c  o  m

        else {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }

        // Check for strobe before setting colours
        if (strobe != null) {
            strobe.colour = Integer.valueOf(preferences.getString(PREF_COLOUR, "0"));

            if (strobe.colour == 3) {
                JSONArray custom;

                try {
                    custom = new JSONArray(preferences.getString(PREF_CUSTOM, null));

                    strobe.foreground = custom.getInt(0);
                    strobe.background = custom.getInt(1);
                }

                catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            // Ensure the view dimensions have been set
            if (strobe.width > 0 && strobe.height > 0)
                strobe.createShaders();
        }
    }
}

From source file:com.imalu.alyou.activity.ConcernlistFragment.java

public void ConcernFound() {
    String key = AlUApplication.getMyInfo().getKey();
    concerns = new ArrayList<ConsernPerson>();
    ConcernRequest ConcernReq = new ConcernRequest();
    ConcernReq.setUserkey(key);/*from   w ww .j ava 2 s  . c  o m*/
    NetManager.execute(NetManager.CONCERN_REQUEST_OPERATION, ConcernReq, new JsonHttpResponseHandler() {
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONArray response) {
            // TODO Auto-generated method stub
            super.onSuccess(statusCode, headers, response);
            try {
                getJsonObj(response);
                Log.e("AAAAAAAAA", "" + concerns.toString());
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

}