本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}