本文整理汇总了Java中com.eclipsesource.json.ParseException类的典型用法代码示例。如果您正苦于以下问题:Java ParseException类的具体用法?Java ParseException怎么用?Java ParseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseException类属于com.eclipsesource.json包,在下文中一共展示了ParseException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCommandAndGetJsonValue
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
private JsonValue executeCommandAndGetJsonValue(String command1, String command2, String command3)
throws WalletCallException, IOException, InterruptedException
{
String strResponse = this.executeCommandAndGetSingleStringResponse(command1, command2, command3);
JsonValue response = null;
try
{
response = Json.parse(strResponse);
} catch (ParseException pe)
{
throw new WalletCallException(strResponse + "\n" + pe.getMessage() + "\n", pe);
}
return response;
}
示例2: ProxyJSONConfigParser
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
public ProxyJSONConfigParser(final String file) throws IOException, JSONConfigException {
final String content = new String(Files.readAllBytes(Paths.get(file)));
try {
this.jsonObject = Json.parse(content).asObject();
} catch (final ParseException | UnsupportedOperationException e) {
throw new JSONConfigException("JSON Syntax Error");
}
}
示例3: testCreateTermsOfServiceUserStatusInfoParseAllFieldsCorrectly
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
@Test
@Category(UnitTest.class)
public void testCreateTermsOfServiceUserStatusInfoParseAllFieldsCorrectly() throws ParseException {
final String type = "terms_of_service_user_status";
final String statusID = "1939280";
final String tosID = "2778";
final JsonObject fakeJSONResponse = JsonObject.readFrom("{\n"
+ " \"type\": \"terms_of_service_user_status\",\n"
+ " \"id\": \"1939280\",\n"
+ " \"tos\": {\n"
+ " \"type\": \"terms_of_service\",\n"
+ " \"id\": \"2778\"\n"
+ " },\n"
+ " \"user\": {\n"
+ " \"type\": \"user\",\n"
+ " \"id\": \"11111\"\n"
+ " },\n"
+ " \"is_accepted\": true,\n"
+ " \"created_at\": \"2013-05-16T15:27:57-07:00\",\n"
+ " \"modified_at\": \"2013-05-16T15:27:57-07:00\"\n"
+ "}");
BoxAPIConnection api = new BoxAPIConnection("");
api.setRequestInterceptor(JSONRequestInterceptor.respondWith(fakeJSONResponse));
BoxTermsOfServiceUserStatus.Info tosUserStatusInfo = BoxTermsOfServiceUserStatus.create(api, tosID, true);
Assert.assertEquals(tosID, tosUserStatusInfo.getTermsOfService().getID());
Assert.assertEquals(statusID, tosUserStatusInfo.getID());
Assert.assertEquals(type, tosUserStatusInfo.getType());
}
示例4: result
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
void result(String data) throws ParseException {
JsonArray res = Json.parse(data).asObject().get("results").asArray();
Vector<Address> r = new Vector<Address>();
for (int i = 0; i < res.size(); i++) {
JsonObject o = res.get(i).asObject();
Address addr = new Address();
addr.address = o.get("formatted_address").asString();
JsonObject geo = o.get("geometry").asObject().get("location").asObject();
addr.lat = geo.get("lat").asDouble();
addr.lon = geo.get("lng").asDouble();
r.add(addr);
}
result(r);
}
示例5: testGetProActiveServerVersionStatusCode200InvalidPayload
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
@Test(expected = ParseException.class)
public void testGetProActiveServerVersionStatusCode200InvalidPayload() throws IOException {
testGetProActiveServerVersion(200, "Abracadabra", false);
}
示例6: mockParseException
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
@Test
public void mockParseException() {
Mockito.mock(ParseException.class);
}
示例7: processModFile
import com.eclipsesource.json.ParseException; //导入依赖的package包/类
private static Set<Archive> processModFile(final Path path, final SettingsModelFactory settingsFactory) throws IOException, StarDBException, ParseException {
Set<Archive> archives = new HashSet<>();
if (FileHelper.identifyType(path, false).equals("pak")) {
processPakFile(path, archives, settingsFactory);
} else {
processArchive(path, archives, settingsFactory);
}
return archives;
}