當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONException.printStackTrace方法代碼示例

本文整理匯總了Java中org.json.JSONException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java JSONException.printStackTrace方法的具體用法?Java JSONException.printStackTrace怎麽用?Java JSONException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.json.JSONException的用法示例。


在下文中一共展示了JSONException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getArrayDouble

import org.json.JSONException; //導入方法依賴的package包/類
public static double[] getArrayDouble(JSONObject docObj, String name) {
	double[] list = null;
	if (docObj.has(name)) {
		JSONArray json;
		try {
			json = docObj.getJSONArray(name);
			int lenFeatures = json.length();
			list = new double[lenFeatures];
			for (int j = 0; j < lenFeatures; j++) {
				double f = json.getDouble(j);
				list[j] = f;
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}

	}
	return list;

}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:21,代碼來源:JSONUtil.java

示例2: getList

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * 將JSONArray直接轉換為List<T>( 外部json數據專用 )
 * @param jsArr 需要解析的JSONArray數據
 * @param t 需要轉換成的泛型對象
 * @param <T> 繼承自ListItem的對象
 * @return 解析後的List<T>>數據
 */
public static <T extends ListItem> List<T> getList(JSONArray jsArr, T t) {
    if (jsArr == null) {
        return null;
    }
    try {
        if (jsArr == null || jsArr.length() == 0) {
            return null;
        }
        List<T> res = new ArrayList<T>();
        T nt = t;
        for (int i = 0; i < jsArr.length(); i++) {
            if (nt == null) {
                nt = t.newObject();
            }
            nt.praseFromJson(new JsonUtil(jsArr.getJSONObject(i)));
            res.add(nt);
            nt = null;
        }
        return res;
    } catch (JSONException e) {
        e.printStackTrace();
        Log.e(tag, e.getMessage());
    }
    return null;
}
 
開發者ID:luck-fc,項目名稱:Interface_Json_Model,代碼行數:33,代碼來源:JsonUtil.java

示例3: geAttendanceList

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * 獲取當月考勤匯總 <一句話功能簡述>
 * 
 * @Description<功能詳細描述>
 * 
 * @param task
 * @param handler
 * @param requestType
 * @param todayDate
 * @return
 * @LastModifiedDate:2017-5-8
 * @author zxm
 * @EditHistory:<修改內容><修改人>
 */
public static NetTask geAttendanceList(NetTask task, Handler handler, int requestType, String curMonthDate)
{
    JSONObject bodyVaule = new JSONObject();
    try
    {
        bodyVaule.put("date", curMonthDate);
    }
    catch (JSONException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    JSONObject requestObj =
        NetRequestController.getPredefineObj("attendance",
            "AttendanceAdapter",
            "getAttendanceList",
            "general",
            bodyVaule);
    
    return NetRequestController.getClockList(task, handler, requestType, requestObj);
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:36,代碼來源:YDKQServiceImpl.java

示例4: onProfileUpdateSuccess

import org.json.JSONException; //導入方法依賴的package包/類
@Override
public void onProfileUpdateSuccess() {
    if (getIntent() != null && getIntent().getStringExtra("branch_params") != null) {
        try {
            //If clicked on branch link and branch payload has auto_accept key set then don't show Invite Screen and accept invite
            JSONObject branchParams = new JSONObject(getIntent().getStringExtra("branch_params"));
            if (branchParams.getBoolean(Invite.AUTO_ACCEPT_KEY)) {
                HyperTrack.startTracking();
                SharedPreferenceManager.setTrackingON(this);
                acceptInvite(HyperTrack.getUserId(), branchParams.getString(Invite.ACCOUNT_ID_KEY));

            } else {
                Intent intent = new Intent(Profile.this, Invite.class);
                intent.putExtra("branch_params", getIntent().getStringExtra("branch_params"));
                startActivity(intent);
            }
            return;
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    startPlacelineScreen();
}
 
開發者ID:hypertrack,項目名稱:hypertrack-live-android,代碼行數:25,代碼來源:Profile.java

示例5: handleProvinceResponse

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * 解析和處理服務器返回的省級數據
 */
public static boolean handleProvinceResponse(String response){
    if(!TextUtils.isEmpty(response)){
        try {
            JSONArray allProvince  = new JSONArray(response);
            for (int i = 0; i < allProvince.length(); i++) {
                JSONObject object = allProvince.getJSONObject(i);
                Province province = new Province();
                province.setProvinceName(object.getString("name"));
                province.setProvinceCode(object.getInt("id"));
                province.save();
            }
            return true;
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    return false;
}
 
開發者ID:mzhkby,項目名稱:coolweater,代碼行數:22,代碼來源:Utility.java

示例6: build

import org.json.JSONException; //導入方法依賴的package包/類
public void build(String data){

        try {
            // PHP에서 받아온 JSON 데이터를 JSON오브젝트로 변환
            JSONObject jObject = new JSONObject(data);
            // results라는 key는 JSON배열로 되어있다.
            JSONArray results = jObject.getJSONArray("result");
            String countTemp = (String)jObject.get("num_result");
            int count = Integer.parseInt(countTemp);

            for ( int i = 0; i < count; ++i ) {
                JSONObject temp = results.getJSONObject(i);
                convert(temp);

            }

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

    }
 
開發者ID:pooi,項目名稱:Nearby,代碼行數:22,代碼來源:TakeMedicine.java

示例7: receivePath

import org.json.JSONException; //導入方法依賴的package包/類
@Override
public void receivePath(String jsonPath) {
    try {
        if (jsonPath.isEmpty() || jsonPath.equals("[]")) {
            checkIfValidPathOrDie();
        } else {

            PathManager pathManager = new PathManager(new JSONArray(jsonPath));
            path = pathManager.getPath();
            Log.d("MEXX", "decoded:" + path.toString());
            drawPath();
            sendAck();
            hideLoadingScreen();
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
開發者ID:Augugrumi,項目名稱:SpaceRace,代碼行數:19,代碼來源:MultiPlayerActivity.java

示例8: refreshCurrentData

import org.json.JSONException; //導入方法依賴的package包/類
private void refreshCurrentData(JSONObject object) {
    try {
        initHeader(object);
        this.mPosts = Post.removeDisablePost(Post.parsePosts(object.getJSONArray("posts")
                .toString()));
        this.mAdapter = new UserTimelineAdapter(this, this.mPosts, this.mUser);
        this.mListView.setAdapter(this.mAdapter);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:UserTimelineActivity.java

示例9: doSplashScreenAction

import org.json.JSONException; //導入方法依賴的package包/類
private void doSplashScreenAction(String action, JSONArray args) {
    CordovaPlugin p = appView.pluginManager.getPlugin("org.apache.cordova.splashscreeninternal");
    if (p != null) {
        args = args == null ? new JSONArray() : args;
        try {
            p.execute(action, args, null);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:12,代碼來源:CordovaActivity.java

示例10: onRequestPermissionsResult

import org.json.JSONException; //導入方法依賴的package包/類
/**
 * Called by the system when the user grants permissions
 *
 * @param requestCode
 * @param permissions
 * @param grantResults
 */
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
                                       int[] grantResults) {
    try
    {
        cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
    }
    catch (JSONException e)
    {
        LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
        e.printStackTrace();
    }

}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:22,代碼來源:CordovaActivity.java

示例11: parse

import org.json.JSONException; //導入方法依賴的package包/類
public static Geo parse(String jsonString) {
    if (TextUtils.isEmpty(jsonString)) {
        return null;
    }

    Geo geo = null;
    try {
        JSONObject jsonObject = new JSONObject(jsonString);
        geo = parse(jsonObject);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return geo;
}
 
開發者ID:yangjie127,項目名稱:ESSocialSDK-master,代碼行數:16,代碼來源:Geo.java

示例12: parse

import org.json.JSONException; //導入方法依賴的package包/類
public static User parse(String jsonString) {
    try {
        JSONObject jsonObject = new JSONObject(jsonString);
        return User.parse(jsonObject);
    } catch (JSONException e) {
        e.printStackTrace();
    }
    
    return null;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:11,代碼來源:User.java

示例13: getOfficialActiveNodeList

import org.json.JSONException; //導入方法依賴的package包/類
public static NetTask getOfficialActiveNodeList(NetTask task, Handler handler, int requestType,
    String messageitemguid, String type)
{
    JSONObject requestObj = null;
    
    JSONObject bodyVaule = new JSONObject();
    
    try
    {
        bodyVaule.put("messageitemguid", messageitemguid);
        bodyVaule.put("type", type);
    }
    catch (JSONException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    
    requestObj =
        NetRequestController.getPredefineObj("official",
            "OfficialAdapter",
            "getOfficialActiveNodeList",
            "general",
            bodyVaule);
    
    return NetRequestController.sendStrBaseServlet(task, handler, requestType, requestObj);
}
 
開發者ID:zhuyu1022,項目名稱:amap,代碼行數:28,代碼來源:GWLZServiceImpl.java

示例14: getItem

import org.json.JSONException; //導入方法依賴的package包/類
@Override
public Object getItem(int position) {
    try {
        return projects.getJSONObject(position);
    } catch (JSONException e){
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:doljko,項目名稱:youth-health,代碼行數:10,代碼來源:ProjectAdapter.java

示例15: _deserializeMessageJSON

import org.json.JSONException; //導入方法依賴的package包/類
private JSONArray _deserializeMessageJSON(String messageJSON) {
    log("decode", messageJSON);
    try {
        return new JSONArray(messageJSON);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return null;
}
 
開發者ID:luffyjet,項目名稱:WebViewJavaScriptBridge,代碼行數:11,代碼來源:WebViewJavaScriptBridgeBase.java


注:本文中的org.json.JSONException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。