Java 类org.json.simple.parser.ParseException 实例源码

项目:JHearthstone    文件:Card.java   
public Card(String n) throws ParseException{
    reader = new JSonReader(new File(GetExecutionPath()).getParent() + "/all-cards.json");
    name = n;
    cost =  (int)(reader.getCost(n));
    attack = (int)(reader.getAttack(n));
    health = (int)(reader.getHealth(n));
    setRarity(JSonReader.getRarity(n));
    set = JSonReader.getSet(n);
    canAttack = false;
    //effects = reader.getEffects(n);
    attributes = reader.getAttributes(n);
    type = reader.getType(n);
    attribute_values = reader.getAttributeValues(n, type);
    triggers = reader.getTriggers(n, type);
    trigger_object = reader.getTriggerObject(n, type);
    hasTaunt = attributes.contains("TAUNT");
    hasDivineShield = attributes.contains("DIVINE_SHIELD");
    hasWindfury = attributes.contains("WINDFURY");
    containsAura = reader.hasAura(n);
    race = reader.getRace(n, type);
}
项目:JHearthstone    文件:Card.java   
public Card(String n, String t) throws ParseException{
    reader = new JSonReader(new File(GetExecutionPath()).getParent() + "/all-cards.json");
    name = n;
    cost =  (int)(reader.getCost(n, t));
    attack = (int)(reader.getAttack(n, t));
    health = (int)(reader.getHealth(n, t));
    setRarity(JSonReader.getRarity(n, t));
    set = JSonReader.getSet(n, t);
    canAttack = false;
    //effects = reader.getEffects(n);
    attributes = reader.getAttributes(n, t);
    attribute_values = reader.getAttributeValues(n, t);
    triggers = reader.getTriggers(n, t);
    trigger_object = reader.getTriggerObject(n, t);
    type = t;
    hasTaunt = attributes.contains("TAUNT");
    hasDivineShield = attributes.contains("DIVINE_SHIELD");
    hasWindfury = attributes.contains("WINDFURY");
    containsAura = reader.hasAura(n, t);
    race = reader.getRace(n, t);
}
项目:talchain    文件:GitHubStateTest.java   
@Test // testing full suite
public void testRandomStateGitHub() throws ParseException, IOException {

    String sha = "99db6f4f5fea3aa5cfbe8436feba8e213d06d1e8";
    List<String> fileNames = JSONReader.getFileNamesForTreeSha(sha);
    List<String> includedFiles =
            Arrays.asList(
                    "st201504081841JAVA.json",
                    "st201504081842JAVA.json",
                    "st201504081843JAVA.json"
            );

    for (String fileName : fileNames) {
        if (includedFiles.contains(fileName)) {
          System.out.println("Running: " + fileName);
          String json = JSONReader.loadJSON("StateTests//RandomTests/" + fileName);
          GitHubJSONTestSuite.runStateTest(json);
        }
    }

}
项目:Parabot-317-API-Minified-PkHonor    文件:Items.java   
public static String getName(int id) {
    String name;
    if ((name = names.get(id)) != null) {
        return name;
    } else {
        try {
            String content = WebUtil.getContents(Configuration.ITEM_API + id);
            if (content.length() > 0) {
                JSONObject jsonObject      = (JSONObject) jsonParser.parse(content);
                JSONObject itemInformation = (JSONObject) jsonObject.get("result");
                if (itemInformation.get("name") != null && !((String) itemInformation.get("name")).equalsIgnoreCase("null")) {
                    name = (String) itemInformation.get("name");
                    names.put(id, name);
                    return name;
                }
            }
        } catch (MalformedURLException | ParseException e) {
            e.printStackTrace();
        }
    }

    return null;
}
项目:legendarybot    文件:IlvlCommand.java   
public long getM15(String json) throws ParseException {
    long m15 = 0;
    if (json != null) {
        JSONParser parser = new JSONParser();
        JSONObject battleNetCharacter = (JSONObject) parser.parse(json);
        JSONObject achivements = (JSONObject) battleNetCharacter.get("achievements");
        JSONArray criteriaObject = (JSONArray) achivements.get("criteria");
        int criteriaNumber = -1;
        for (int i = 0; i < criteriaObject.size(); i++) {
            if ((long)criteriaObject.get(i) == 32028    ) {
                criteriaNumber = i;
            }
        }

        if (criteriaNumber != -1) {
            m15 = (long) ((JSONArray)achivements.get("criteriaQuantity")).get(criteriaNumber);
            if (m15 >= 1) {
                m15 += 1;
            }
        }
    }
    return m15;
}
项目:alfresco-remote-api    文件:SubscriptionServiceFollowsPost.java   
@SuppressWarnings("unchecked")
public JSONArray executeImpl(String userId, WebScriptRequest req, WebScriptResponse res) throws IOException,
        ParseException
{
    JSONArray jsonUsers = (JSONArray) JSONValue.parseWithException(req.getContent().getContent());

    JSONArray result = new JSONArray();

    for (Object o : jsonUsers)
    {
        String user = (o == null ? null : o.toString());
        if (user != null)
        {
            JSONObject item = new JSONObject();
            item.put(user, subscriptionService.follows(userId, user));
            result.add(item);
        }
    }

    return result;
}
项目:talchain    文件:GitHubTransactionTest.java   
@Test
public void testEIP155TransactionTestFromGitHub() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();
    SystemProperties.getDefault().setBlockchainConfig(new BaseNetConfig() {{
        add(0, new FrontierConfig());
        add(1_150_000, new HomesteadConfig());
        add(2_457_000, new Eip150HFConfig(new DaoHFConfig()));
        add(2_675_000, new Eip160HFConfig(new DaoHFConfig()){
            @Override
            public Integer getChainId() {
                return null;
            }
        });
    }});
    String json = JSONReader.loadJSONFromCommit("TransactionTests/EIP155/ttTransactionTest.json", shacommit);
    GitHubJSONTestSuite.runGitHubJsonTransactionTest(json, excluded);
}
项目:Parabot-317-API-Minified-Dreamscape    文件:Items.java   
/**
 * Returns an int array based on the string it contains. getIdsContain(dragon) will return an int array with all items containingdragon
 *
 * @param name
 *
 * @return
 */
public static int[] getIdsContain(String name) {
    try {
        String content = WebUtil.getContents(Configuration.ITEM_API + "contains/" + name);
        if (content.length() > 0) {
            JSONObject jsonObject = (JSONObject) jsonParser.parse(content);
            JSONArray  array      = (JSONArray) jsonObject.get("result");
            if (array.size() > 0) {
                int[] ids = new int[array.size()];
                for (int i = 0; i < array.size(); i++) {
                    ids[i] = Integer.parseInt((String) array.get(i));
                }
                return ids;
            }
        }
    } catch (MalformedURLException | ParseException e) {
        e.printStackTrace();
    }

    return new int[0];
}
项目:rskj    文件:GitHubStateTest.java   
@Test // testing full suite
public void testRandomStateGitHub() throws ParseException, IOException {

    String sha = "99db6f4f5fea3aa5cfbe8436feba8e213d06d1e8";
    List<String> fileNames = getFileNamesForTreeSha(sha);
    List<String> includedFiles =
            Arrays.asList(
                    "st201504081841JAVA.json",
                    "st201504081842JAVA.json",
                    "st201504081843JAVA.json"
            );

    for (String fileName : fileNames) {
        if (includedFiles.contains(fileName)) {
          System.out.println("Running: " + fileName);
          String json = JSONReader.loadJSON("StateTests//RandomTests/" + fileName);
          GitHubJSONTestSuite.runStateTest(json);
        }
    }

}
项目:talchain    文件:GitHubStateTest.java   
@Test
public void stWalletTest() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();

    String json = JSONReader.loadJSONFromCommit("StateTests/stWalletTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);

    json = JSONReader.loadJSONFromCommit("StateTests/Homestead/stWalletTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);

    json = JSONReader.loadJSONFromCommit("StateTests/EIP150/Homestead/stWalletTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);

    json = JSONReader.loadJSONFromCommit("StateTests/EIP158/Homestead/stWalletTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:aws-lambda-proxy-java    文件:LambdaProxyHandlerTest.java   
@Test
public void shouldReturnServerErrorAndReasonWhenMisconfigured() throws ParseException {
    ApiGatewayProxyRequest request = new ApiGatewayProxyRequestBuilder()
            .withHttpMethod(METHOD)
            .build();
    LambdaProxyHandler<Configuration> handlerWithFailingConguration = new TestLambdaProxyHandlerWithFailingConguration();
    handlerWithFailingConguration.registerMethodHandler(METHOD, c -> methodHandler);

    ApiGatewayProxyResponse actual = handlerWithFailingConguration.handleRequest(request, context);

    assertThat(actual).isNotNull();
    assertThat(actual.getStatusCode()).isEqualTo(INTERNAL_SERVER_ERROR.getStatusCode());
    JSONParser jsonParser = new JSONParser();
    JSONObject jsonObject = (JSONObject) jsonParser.parse(actual.getBody());
    assertThat(jsonObject.keySet()).contains("message", "cause");
    assertThat((String) jsonObject.get("message")).contains("This service is mis-configured. Please contact your system administrator.");
    assertThat((String) jsonObject.get("cause")).contains("NullPointerException");
}
项目:rskj    文件:GitHubVMTest.java   
@Test // testing full suite
public void testRandomVMGitHub() throws ParseException {

    String shacommit = "c5eafb85390eee59b838a93ae31bc16a5fd4f7b1";
    List<String> fileNames = getFileNamesForTreeSha(shacommit);
    List<String> excludedFiles =
            Collections.singletonList(
                    ""
            );

    for (String fileName : fileNames) {

        if (excludedFiles.contains(fileName)) continue;
        System.out.println("Running: " + fileName);
        String json = JSONReader.loadJSON("VMTests//RandomTests/" + fileName);
        GitHubJSONTestSuite.runGitHubJsonVMTest(json);
    }

}
项目:KMUC    文件:Carte.java   
/**
 * 네트워크 연결을 통한 모든 메뉴 JSON 파싱
 * @param reqAddress 모든 파라미터가 포함된 리퀘스트 주소
 * @return 모든 메뉴가 담긴 JSONObject
 * @throws IOException
 * @throws ParseException
 */
private JSONObject getAllMenuJson(String reqAddress) throws IOException, ParseException {
    HttpURLConnection conn = (HttpURLConnection)new URL(reqAddress).openConnection();
    conn.setRequestMethod("GET");
    conn.setRequestProperty("User-Agent", "Mozilla/5.0");
    conn.setConnectTimeout(5000);

    BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    StringBuilder sb = new StringBuilder();

    while((line = br.readLine()) != null){
        sb.append(line);
    }
    br.close();


    JSONParser parser = new JSONParser();
    JSONObject allMenu = (JSONObject)parser.parse(replace(sb.toString()));

    return allMenu;
}
项目:rskj    文件:GitHubBlockTest.java   
private void runHomestead(String name) throws IOException, ParseException {
    String json = JSONReader.loadJSONFromCommit("BlockchainTests/Homestead/" + name + ".json", shacommit);
    ConfigHelper.CONFIG.setBlockchainConfig(new GenesisConfig());
    try {
        GitHubJSONTestSuite.runGitHubJsonBlockTest(json, Collections.EMPTY_SET);
    } finally {
        ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
    }
}
项目:JHearthstone    文件:Spell.java   
public JSONObject getEffect() {
    try {
        return new org.json.JSONObject(reader.getEffect(name).toJSONString());
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return new org.json.JSONObject();
}
项目:raven    文件:MessageTool.java   
protected Result sendMessage(Constants.RequestPath requestPath, StringBuilder body, int retries) throws IOException, ParseException {
    int attempt = 0;
    Result result = null;
    int backoff = 1000;
    boolean tryAgain = false;

    do {
        ++attempt;
        if(logger.isLoggable(Level.FINE)) {
            logger.fine("Attempt #" + attempt + " to send " + body + " to url " + requestPath.getPath());
        }

        String bodyStr = body.toString();
        if(bodyStr.charAt(0) == 38) {
            bodyStr = body.toString().substring(1);
        }

        result = this.sendMessage(requestPath, bodyStr);
        tryAgain = result == null && attempt <= retries;
        if(tryAgain) {
            int sleepTime = backoff / 2 + this.random.nextInt(backoff);
            this.sleep((long)sleepTime);
            if(2 * backoff < 1024000) {
                backoff *= 2;
            }
        }
    } while(tryAgain);

    if(result == null) {
        throw this.exception(attempt);
    } else {
        return result;
    }
}
项目:talchain    文件:GitHubStateTest.java   
@Test
public void stRecursiveCreate() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();
    String json = JSONReader.loadJSONFromCommit("StateTests/stRecursiveCreate.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/Homestead/stRecursiveCreate.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP150/Homestead/stRecursiveCreate.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP158/Homestead/stRecursiveCreate.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:rskj    文件:GitHubStateTest.java   
@Test
public void stInitCodeTest() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();
    String json = JSONReader.loadJSONFromCommit("StateTests/stInitCodeTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);

}
项目:JHearthstone    文件:JSonReader.java   
public long getHealth(String n, String t) throws org.json.simple.parser.ParseException{
    long[] info = findCard(n, t);
    if(info[0] != 2){
        return info[3];
    }
    return -1;
}
项目:rskj    文件:GitHubStateTest.java   
@Test
public void stMemoryTest() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();

    String json = JSONReader.loadJSONFromCommit("StateTests/stMemoryTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);

}
项目:JHearthstone    文件:Test.java   
public static void main(String args[]) throws ParseException{
    ArrayList<String> hand = new ArrayList<>();
    hand.add("Northshire Cleric");
    hand.add("Claw");
    hand.add("Fiery War Axe");
    hand.add("Moonfire");
    for (int i = 0; i < 10; i++) {
        int random = (int) (Math.random() * hand.size());
        System.out.println(hand.get(random));
    }
}
项目:bibliome-java-utils    文件:ArabidoDiff2013.java   
public static void main(String[] args) throws ClassNotFoundException, SQLException, ParseException, IOException {
    switch (args[0]) {
        case "diff":
            doDiff(Integer.parseInt(args[1]), args[2], args[3], args[4], args[5]);
            break;
        case "docs":
            queryDocs(Arrays.asList(args).subList(1, args.length));
            break;
        default:
            throw new RuntimeException();
    }
}
项目:otus_java_2017_04    文件:SocketClientChannel.java   
private Msg getMsgFromJSON(String json) throws ParseException, ClassNotFoundException {
    JSONParser jsonParser = new JSONParser();
    JSONObject jsonObject = (JSONObject) jsonParser.parse(json);
    String className = (String) jsonObject.get(Msg.CLASS_NAME_VARIABLE);
    Class<?> msgClass = Class.forName(className);
    return (Msg) new Gson().fromJson(json, msgClass);
}
项目:open-weather-retriever-z    文件:OpenWeatherRetrieverZ.java   
@Override
protected Void doInBackground(Void... objects) {
    try {
        this.weatherInfo = processWeatherInfo(this.url);
    } catch (IOException|ParseException e) {
        e.printStackTrace();
        callback.onFailure(e.toString());
    }
    return null;
}
项目:open-weather-retriever-z    文件:OpenWeatherRetrieverZ.java   
@Override
protected Void doInBackground(Object... objects) {
    try {
        dailyForecastInfoList = processDailyForecastInfo(url);
    } catch (IOException|ParseException e) {
        e.printStackTrace();
        callback.onFailure(e.toString());
    }
    return null;
}
项目:MixPush    文件:MiPushServerManager.java   
@Override
public void sendNotifyToAlias(List<String> alias, String title, String description, String messagePayload) throws IOException, ParseException {
    Constants.useOfficial();
    Sender sender = new Sender(appSecretKey);
    Message message = getNotifyMessage(title, description, messagePayload);

    for (String item : alias) {
        Result result = sender.sendToAlias(message, item, 10);
        System.out.println(item + ":" + result.toString());
    }
}
项目:rskj    文件:GitHubJSONTestSuite.java   
public static void runGitHubJsonSingleBlockTest(String json, String testName) throws ParseException, IOException {

        BlockTestSuite testSuite = new BlockTestSuite(json);
        Set<String> testCollection = testSuite.getTestCases().keySet();

        for (String testCase : testCollection) {
            if (testCase.equals(testName))
                logger.info(" => " + testCase);
            else
                logger.info("    " + testCase);
        }

        runSingleBlockTest(testSuite, testName);
    }
项目:talchain    文件:GitHubStateTest.java   
@Test
public void stPreCompiledContracts() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();

    String json = JSONReader.loadJSONFromCommit("StateTests/stPreCompiledContracts.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/Homestead/stPreCompiledContracts.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP150/Homestead/stPreCompiledContracts.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP158/Homestead/stPreCompiledContracts.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:raven    文件:Sender.java   
public Result sendToUserAccount(Message message, List<String> userAccounts, int retries) throws IOException, ParseException {
    int attempt = 0;
    Result result = null;
    int backoff = 1000;

    boolean tryAgain;
    do {
        ++attempt;
        if(logger.isLoggable(Level.FINE)) {
            logger.fine("Attempt #" + attempt + " to send message " + message + " to user account " + userAccounts);
        }

        result = this.sendToUserAccountNoRetry(message, userAccounts);
        tryAgain = result == null && attempt <= retries;
        if(tryAgain) {
            int sleepTime = backoff / 2 + this.random.nextInt(backoff);
            this.sleep((long)sleepTime);
            if(2 * backoff < 1024000) {
                backoff *= 2;
            }
        }
    } while(tryAgain);

    if(result == null) {
        throw this.exception(attempt);
    } else {
        return result;
    }
}
项目:incubator-netbeans    文件:DOMTest.java   
/**
 * Test of {@code handleCharacterDataModified} method.
 */
@Test
public void testHandleCharacterDataModified() throws ParseException {
    TransportImplementation transport = new DummyTransportImplementation();
    DOM dom = new DOM(new TransportHelper(transport), null);
    final Node root = dom.getDocument();
    final String DATA = "myData"; // NOI18N
    final int[] eventsFired = new int[1];
    DOM.Listener listener = new DOMAdapter() {
        @Override
        public void characterDataModified(Node node) {
            eventsFired[0]++;
            assertEquals(root, node);
            String value = root.getNodeValue();
            assertEquals(DATA, value);
        }
    };
    dom.addListener(listener);
    JSONParser parser = new JSONParser();

    // Modification of a known node
    Object json = parser.parse("{\"nodeId\":" + ROOT_NODE_ID + ",\"characterData\":\"" + DATA + "\"}"); // NOI18N
    dom.handleCharacterDataModified((JSONObject)json);
    assertEquals(1, eventsFired[0]);

    // Modification of an unknown node
    json = parser.parse("{\"nodeId\":" + (ROOT_NODE_ID+1) + ",\"characterData\":\"someData\"}"); // NOI18N
    dom.handleCharacterDataModified((JSONObject)json);
    assertEquals(1, eventsFired[0]);
}
项目:talchain    文件:GitHubStateTest.java   
@Test
public void stNonZeroCallsTest() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();

    String json = JSONReader.loadJSONFromCommit("StateTests/EIP158/stNonZeroCallsTest.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:talchain    文件:GitHubStateTest.java   
@Test
public void stLogTests() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();
    String json = JSONReader.loadJSONFromCommit("StateTests/stLogTests.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/Homestead/stLogTests.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP150/Homestead/stLogTests.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
    json = JSONReader.loadJSONFromCommit("StateTests/EIP158/Homestead/stLogTests.json", shacommit);
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:incubator-netbeans    文件:DOMTest.java   
/**
 * Test of {@code handleChildNodeInserted} method.
 */
@Test
public void testHandleChildNodeInserted() throws ParseException {
    TransportImplementation transport = new DummyTransportImplementation();
    DOM dom = new DOM(new TransportHelper(transport), null);
    final Node root = dom.getDocument();
    final int CHILD_ID = 2;
    final String CHILD_NAME = "DIV"; // NOI18N
    final int[] eventsFired = new int[1];
    DOM.Listener listener = new DOMAdapter() {
        @Override
        public void childNodeInserted(Node parent, Node child) {
            eventsFired[0]++;
            assertEquals(root, parent);
            List<Node> children = parent.getChildren();
            assertNotNull(children);
            assertEquals(1, children.size());
            assertEquals(child, children.get(0));
            assertEquals(CHILD_ID, child.getNodeId());
            assertEquals(CHILD_NAME, child.getNodeName());
        }
    };
    dom.addListener(listener);
    JSONParser parser = new JSONParser();

    // Modification of a known node
    Object json = parser.parse("{\"node\":{\"childNodeCount\":0,\"localName\":\"div\",\"nodeId\":" + // NOI18N
            CHILD_ID + ",\"nodeValue\":\"\",\"nodeName\":\"" + // NOI18N
            CHILD_NAME + "\",\"attributes\":[],\"nodeType\":1},\"parentNodeId\":" + // NOI18N
            ROOT_NODE_ID + ",\"previousNodeId\":0}"); // NOI18N
    assertNull(root.getChildren());
    dom.handleChildNodeInserted((JSONObject)json);
    assertEquals(1, eventsFired[0]);

    // Modification of an unknown node
    json = parser.parse("{\"node\":{\"childNodeCount\":0,\"localName\":\"div\",\"nodeId\":5,\"nodeValue\":\"\",\"nodeName\":\"DIV\",\"attributes\":[],\"nodeType\":1},\"parentNodeId\":5,\"previousNodeId\":0}"); // NOI18N
    dom.handleChildNodeInserted((JSONObject)json);
    assertEquals(1, eventsFired[0]);
}
项目:incubator-netbeans    文件:WebKitDebuggingTransport.java   
@Override
public Void call(final String p) {
    RP.post(new Runnable() {
        @Override
        public void run() {
            try {
                JSONObject json = (JSONObject)JSONValue.parseWithException(p);
                responseCallback.handleResponse(new Response(json));
            } catch (ParseException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    });
    return null;
}
项目:rskj    文件:LocalStateTest.java   
@Test
public void stTransitionTest() throws ParseException, IOException {
    Set<String> excluded = new HashSet<>();

    String json = getJSON("stTransitionTest");
    GitHubJSONTestSuite.runStateTest(json, excluded);
}
项目:personium-core    文件:UserDataWithNPDeclaredDoublePropertyTest.java   
/**
 * ZERO_ONE対ZERO_ONEのUserDataをNavigationProperty経由で取得して対象データが取得できること.
 * @throws ParseException パース例外
 */
@Test
public final void ZERO_ONE対ZERO_ONEのUserDataをNavigationProperty経由で取得して対象データが取得できること() throws ParseException {
    try {
        String sourceMultiplicity = "0..1";
        String targetMultiplicity = "0..1";
        checkSchemaTypeDouble(sourceMultiplicity, targetMultiplicity);
    } finally {
        CellUtils.bulkDeletion(BEARER_MASTER_TOKEN, CELL_NAME);
    }
}
项目:keywordEntityApiRankService    文件:AlchemyEntityAPI.java   
/**
 * Implemented receiveGET from Interface interfaceAPI (see for more details)
 *
 * @throws IOException
 *             IO Error
 * @throws ParseException
 *             Parse Error
 */
@Override
public void receiveGET() throws IOException, ParseException {
    JSONArray JSONArray = readResponseJSON(API_IDENTIFIER, EntityUtils.toString(httpEntity, "UTF-8"), "entities");

    if (JSONArray != null) {
        for (Object aJSONArray : JSONArray) {

            JSONObject object = (JSONObject) aJSONArray;
            ResponseEntry entity = new ResponseEntry();

            String s = (String) object.get("text");
            s = addEntity(s);

            // Add Entity only if it is new and has not been added before
            if (s != null) {
                entity.setEntry(s);
                entity.setConfidence(convertRelevance((String) object.get("relevance")));
                foundEntryList.add(entity);
            }
        }

        // Sort the Array List Entities from A to Z
        Collections.sort(foundEntryList, new SortResponseEntity());
        int i = 1;
        for (ResponseEntry e : foundEntryList) {
            LOG.debug("Entity " + i + " is " + e.getEntry() + "(" + e.getConfidence() + ")");
            i++;
        }
    }
}
项目:keywordEntityApiRankService    文件:MeaningCloudAPI.java   
/**
 * Implemented receiveGET from Interface interfaceAPI (see for more details)
 *
 * @throws IOException
 *             IO Error
 * @throws ParseException
 *             Parse Error
 */
public void receiveGET() throws IOException, ParseException {
    JSONArray JSONArray = readResponseJSON(API_IDENTIFIER, EntityUtils.toString(httpEntity, "UTF-8"), "entity_list");

    if (JSONArray != null) {
        for (Object aJSONArray : JSONArray) {

            JSONObject object = (JSONObject) aJSONArray;
            ResponseEntry entity = new ResponseEntry();

            String s = (String) object.get("form");
            s = addEntity(s);

            // Add Entity only if it is new and has not been added before
            if (s != null) {
                entity.setEntry(s);
                entity.setConfidence(convertRelevance((String) object.get("relevance")));
                foundEntryList.add(entity);
            }
        }

        // Sort the Array List Entities from A to Z
        Collections.sort(foundEntryList, new SortResponseEntity());

        int i = 1;
        for (ResponseEntry e : foundEntryList) {
            LOG.debug("Entity " + i + " is " + e.getEntry() + "(" + e.getConfidence() + ")");
            i++;
        }
    }
}
项目:AppCoins-ethereumj    文件:GitHubTransactionTest.java   
@Test
public void ttWrongRLPFrontier() throws IOException, ParseException {
    suite.run("ttWrongRLPFrontier", new HashSet<>(Arrays.asList(
            "RLPArrayLengthWithFirstZeros",    // TODO fix those tests, it just fails
            "RLPIncorrectByteEncoding00",
            "RLPIncorrectByteEncoding01",
            "RLPIncorrectByteEncoding127",
            "RLPListLengthWithFirstZeros"
    )));
}
项目:java-velocypack    文件:VPackParser.java   
private void add(final Boolean value) throws ParseException {
    try {
        builder.add(attribute, value);
        attribute = null;
    } catch (final VPackBuilderException e) {
        throw new ParseException(ParseException.ERROR_UNEXPECTED_EXCEPTION);
    }
}