Package org.json

Examples of org.json.JSONObject.optJSONObject()


            .getJSONArray("bindings");
        int count = 0;
        while (count < repoList.length()) {
          JSONObject obj = repoList.getJSONObject(count++);
          repositories
          .add(obj.optJSONObject("id").optString("value"));
        }
        // check for karama_models repo
        if (!repositories.contains(karma_model_repo)) {
          logger.info("karma_models not found");
          if (create_repo(karma_model_repo,
View Full Code Here


    }

    private static void assertPropertyExists(String path, String property, JSONObject result) throws Exception {
        JSONObject temp = result;
        for (String segment : PathUtils.elements(path)) {
            temp = temp.optJSONObject(segment);

            if (temp == null) {
                throw new Exception(String.format("The node %s could not be found!", path));
            }
        }
View Full Code Here

            JSONObject jsonObject = this.jsonObject;

            if (!"".equals(path)) {
                for (String segment : PathUtils.elements(path)) {
                    LOG.debug(String.format("Checking segment %s of path %s in object %s", segment, path, jsonObject));
                    jsonObject = jsonObject.optJSONObject(segment);
                    if (jsonObject == null) {
                        throw new Exception(String.format("The path %s was not found in the current state", path));
                    }
                }
            }
View Full Code Here

      if (eventName.equals(EVENT_PAUSED)) {
        int isolateId = params.optInt("isolateId", -1);
        String reason = params.optString("reason", null);
        VmIsolate isolate = getCreateIsolate(isolateId);
        VmValue exception = VmValue.createFrom(isolate, params.optJSONObject("exception"));
        VmLocation location = VmLocation.createFrom(isolate, params.optJSONObject("location"));

        isolate.setPaused(true);

        if (!"interrupted".equals(reason) || !isolate.isTemporarilyInterrupted()) {
View Full Code Here

      if (eventName.equals(EVENT_PAUSED)) {
        int isolateId = params.optInt("isolateId", -1);
        String reason = params.optString("reason", null);
        VmIsolate isolate = getCreateIsolate(isolateId);
        VmValue exception = VmValue.createFrom(isolate, params.optJSONObject("exception"));
        VmLocation location = VmLocation.createFrom(isolate, params.optJSONObject("location"));

        isolate.setPaused(true);

        if (!"interrupted".equals(reason) || !isolate.isTemporarilyInterrupted()) {
          sendDelayedDebuggerPaused(PausedReason.parse(reason), isolate, location, exception);
View Full Code Here

        script.steps.add(step);
        JSONArray keysA = stepO.names();
        for (int j = 0; j < keysA.length(); j++) {
          String key = keysA.getString(j);
          if (key.equals("type") || key.equals("negated")) { continue; }
          if (stepO.optJSONObject(key) != null) {
            step.locatorParams.put(key, new Locator(
                stepO.getJSONObject(key).getString("type"),
                stepO.getJSONObject(key).getString("value")
            ));
          } else {
View Full Code Here

                }
                _passSuccess(callback, result);
            } else {
                OTClientError error;
                if (result != null && result.has("error")) {
                    error = OTClientError.fromJson(result.optJSONObject("error"));
                } else {
                    error = new OTClientError(status, conn.getResponseMessage(), result.toString());
                }
                if (L.isDebugEnabled()) {
                    L.debug("request err: error=" + error);
View Full Code Here

        _request(POST, null, data, new OTClientCallback<JSONObject>() {
            @Override
            public void onSuccess(JSONObject data) {
                bearer = data;
                currentApp = OTApp.SERIALIZER.fromJson(data.optJSONObject("app"));
                _notifyConnect();
                _passSuccess(callback, currentApp);
            }

            @Override
View Full Code Here

        _request(POST, "/auth/signup", data, new OTClientCallback<JSONObject>() {
            @Override
            public void onSuccess(JSONObject data) {
                // autor-signin
                if (signupInfo.isSigninNow()) {
                    currentPlayer = OTPlayer.SERIALIZER.fromJson(data.optJSONObject("player"));
                    _notifySignin();
                    _passSuccess(callback, currentPlayer);
                    return;
                }
                _passSuccess(callback, data);
View Full Code Here

        JSONObject data = signinInfo.toJson();

        _request(POST, "/auth/signin", data, null, new OTClientCallback<JSONObject>() {
            @Override
            public void onSuccess(JSONObject data) {
                currentPlayer = OTPlayer.SERIALIZER.fromJson(data.optJSONObject("player"));
                _notifySignin();
                _passSuccess(callback, currentPlayer);
            }

            @Override
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.