本文整理了Java中org.codehaus.jettison.json.JSONException.printStackTrace()
方法的一些代码示例,展示了JSONException.printStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONException.printStackTrace()
方法的具体详情如下:
包路径:org.codehaus.jettison.json.JSONException
类名称:JSONException
方法名:printStackTrace
暂无
代码示例来源:origin: org.codehaus.jettison/jettison
e.printStackTrace();
代码示例来源:origin: com.onpositive.aml/com.mulesoft.jaxrs.raml.generator
private void setRequiredSilent(boolean required) {
this.required=required;
try {
object.put("required",required);
} catch (JSONException e) {
e.printStackTrace();
}
}
代码示例来源:origin: com.onpositive.aml/com.mulesoft.jaxrs.raml.generator
private void setTypeSilent(String type) {
this.type = type;
try {
object.put("type", type);
} catch (JSONException e) {
e.printStackTrace();
}
}
代码示例来源:origin: GluuFederation/oxAuth
@Override
public String getQueryString() {
String jsonQueryString = null;
try {
jsonQueryString = getJSONParameters().toString(4).replace("\\/", "/");
} catch (JSONException e) {
e.printStackTrace();
}
return jsonQueryString;
}
}
代码示例来源:origin: com.onpositive.aml/com.mulesoft.jaxrs.raml.generator
private void pass(JSONObject obj, JSONObject sch) {
for( Iterator<?> iter = obj.keys() ; iter.hasNext() ; ){
Object o = iter.next() ;
String propName = o.toString();
Object value;
try {
value = obj.get(propName);
registerProperty(propName,value,sch);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: gentics/mesh
public JSONObject getAuthTokenResponse() {
JSONObject node = new JSONObject();
try {
node.put("token",
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyVXVpZCI6IlVVSURPRlVTRVIxIiwiZXhwIjoxNDY5MTE3MjQ3LCJpYXQiOjE0NjkxMTM2NDd9.i1u4RMs4K7zBkGhmcpp1P79Wpz2UQYJkZKJTVdFp_iU=");
} catch (JSONException e) {
e.printStackTrace();
}
return node;
}
代码示例来源:origin: eclipse-ee4j/glassfish
public static List<Map<String, String>> getPropertiesFromJson(String json) {
List<Map<String, String>> properties = null;
json = json.trim();
if (json.startsWith("{")) {
properties = new ArrayList<Map<String, String>>();
properties.add(processJsonMap(json));
} else if (json.startsWith("[")) {
try {
properties = processJsonArray(new JSONArray(json));
} catch (JSONException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
} else {
throw new RuntimeException("The JSON string must start with { or ["); // i18n
}
return properties;
}
代码示例来源:origin: GluuFederation/oxAuth
public String getDecodedJwt() {
String decodedJwt = null;
try {
decodedJwt = payloadToJSONObject().toString(4);
} catch (JSONException e) {
e.printStackTrace();
}
return decodedJwt;
}
代码示例来源:origin: com.netflix.karyon/karyon2-admin-web
@SuppressWarnings("unchecked")
public JSONArray getChildrenJSONArray() {
JSONArray ar = null;
if (children != null) {
ar = new JSONArray();
for (DynaTreeNode a : children.values()) {
try {
ar.put(a.toJSONObject());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return ar;
}
}
代码示例来源:origin: com.netflix.karyon/karyon-admin-web
@SuppressWarnings("unchecked")
public JSONArray getChildrenJSONArray() {
JSONArray ar = null;
if (children != null) {
ar = new JSONArray();
for (DynaTreeNode a : children.values()) {
try {
ar.put(a.toJSONObject());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return ar;
}
}
代码示例来源:origin: gentics/mesh
public JSONObject getSearchQueryExample() {
JSONObject node = new JSONObject();
try {
JSONObject query = new JSONObject();
JSONObject queryString = new JSONObject();
queryString.put("query", "some name");
query.put("query_string", queryString);
node.put("query", query);
} catch (JSONException e) {
e.printStackTrace();
}
return node;
}
代码示例来源:origin: GluuFederation/oxAuth
@Parameters({"jwksPath"})
@Test
public void requestJwks(final String jwksPath) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + jwksPath).request();
request.header("Accept", MediaType.APPLICATION_JSON);
Response response = request.get();
String entity = response.readEntity(String.class);
showResponse("requestJwks", response, entity);
assertEquals(response.getStatus(), 200, "Unexpected response code.");
try {
JSONObject jsonObj = new JSONObject(entity);
assertTrue(jsonObj.has(JSON_WEB_KEY_SET), "Unexpected result: keys not found");
JSONArray keys = jsonObj.getJSONArray(JSON_WEB_KEY_SET);
assertNotNull(keys, "Unexpected result: keys is null");
assertTrue(keys.length() > 0, "Unexpected result: keys is empty");
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
代码示例来源:origin: GluuFederation/oxAuth
@Parameters({"registerPath"})
@Test
public void requestClientRegistrationFail3(final String registerPath) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
String registerRequestContent = null;
try {
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app",
Arrays.asList("https://client.example.com/cb#fail_fragment"));
registerRequestContent = registerRequest.getJSONParameters().toString(4);
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage());
}
Response response = request.post(Entity.json(registerRequestContent));
String entity = response.readEntity(String.class);
showResponse("requestClientRegistrationFail3", response, entity);
assertEquals(response.getStatus(), 400, "Unexpected response code. " + entity);
TestUtil.assertErrorResponse(entity);
}
代码示例来源:origin: GluuFederation/oxAuth
@Parameters({"registerPath"})
@Test
public void requestClientRegistrationFail1(final String registerPath) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
String registerRequestContent = null;
try {
RegisterRequest registerRequest = new RegisterRequest(null, null, null);
registerRequestContent = registerRequest.getJSONParameters().toString(4);
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage());
}
Response response = request.post(Entity.json(registerRequestContent));
String entity = response.readEntity(String.class);
showResponse("requestClientRegistrationFail 1", response, entity);
assertEquals(response.getStatus(), 400, "Unexpected response code. " + entity);
TestUtil.assertErrorResponse(entity);
}
代码示例来源:origin: GluuFederation/oxAuth
@Parameters({"endSessionPath"})
@Test(enabled = true) // switched off test : WebApplicationException seems to not translated correctly into response by container and results in 500 error. See org.xdi.oxauth.session.ws.rs.EndSessionRestWebServiceImpl.endSession()
public void requestEndSessionFail1(final String endSessionPath) throws Exception {
EndSessionRequest endSessionRequest = new EndSessionRequest(null, null, null);
Builder request = ResteasyClientBuilder.newClient()
.target(url.toString() + endSessionPath + "?" + endSessionRequest.getQueryString()).request();
request.header("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
Response response = request.get();
String entity = response.readEntity(String.class);
showResponse("requestEndSessionFail1", response, entity);
assertEquals(response.getStatus(), 400, "Unexpected response code.");
assertNotNull(entity, "Unexpected result: " + entity);
try {
JSONObject jsonObj = new JSONObject(entity);
assertTrue(jsonObj.has("error"), "The error type is null");
assertTrue(jsonObj.has("error_description"), "The error description is null");
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage() + "\nResponse was: " + entity);
}
}
代码示例来源:origin: GluuFederation/oxAuth
@Parameters({"registerPath"})
@Test
public void requestClientRegistrationFail2(final String registerPath) throws Exception {
Builder request = ResteasyClientBuilder.newClient().target(url.toString() + registerPath).request();
String registerRequestContent = null;
try {
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "oxAuth test app", null); // Missing
// redirect
// URIs
registerRequestContent = registerRequest.getJSONParameters().toString(4);
} catch (JSONException e) {
e.printStackTrace();
fail(e.getMessage());
}
Response response = request.post(Entity.json(registerRequestContent));
String entity = response.readEntity(String.class);
showResponse("requestClientRegistrationFail 2", response, entity);
assertEquals(response.getStatus(), 400, "Unexpected response code. " + entity);
TestUtil.assertErrorResponse(entity);
}
代码示例来源:origin: org.gradoop/gradoop-flink
/**
* Creates a JSON string representation from a given vertex.
*
* @param v vertex
* @return JSON string representation
*/
@Override
public String format(V v) {
JSONObject json = new JSONObject();
try {
json.put(JSONConstants.IDENTIFIER, v.getId());
json.put(JSONConstants.DATA, writeProperties(v));
json.put(JSONConstants.META, writeGraphElementMeta(v));
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
}
代码示例来源:origin: org.gradoop/gradoop-flink
/**
* Creates a JSON string representation of a given graph head object.
*
* @param g graph head
* @return JSON string representation
*/
@Override
public String format(G g) {
JSONObject json = new JSONObject();
try {
json.put(JSONConstants.IDENTIFIER, g.getId());
json.put(JSONConstants.DATA, writeProperties(g));
json.put(JSONConstants.META, writeGraphMeta(g));
} catch (JSONException ex) {
ex.printStackTrace();
}
return json.toString();
}
}
代码示例来源:origin: dbs-leipzig/gradoop
/**
* Creates a JSON string representation of a given graph head object.
*
* @param g graph head
* @return JSON string representation
*/
@Override
public String format(G g) {
JSONObject json = new JSONObject();
try {
json.put(JSONConstants.IDENTIFIER, g.getId());
json.put(JSONConstants.DATA, writeProperties(g));
json.put(JSONConstants.META, writeGraphMeta(g));
} catch (JSONException ex) {
ex.printStackTrace();
}
return json.toString();
}
}
代码示例来源:origin: dbs-leipzig/gradoop
/**
* Creates a JSON string representation from a given vertex.
*
* @param v vertex
* @return JSON string representation
*/
@Override
public String format(V v) {
JSONObject json = new JSONObject();
try {
json.put(JSONConstants.IDENTIFIER, v.getId());
json.put(JSONConstants.DATA, writeProperties(v));
json.put(JSONConstants.META, writeGraphElementMeta(v));
} catch (JSONException e) {
e.printStackTrace();
}
return json.toString();
}
}
内容来源于网络,如有侵权,请联系作者删除!