当前位置: 首页>>代码示例>>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;未经允许,请勿转载。