Example usage for org.json JSONException getLocalizedMessage

List of usage examples for org.json JSONException getLocalizedMessage

Introduction

In this page you can find the example usage for org.json JSONException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:com.spoiledmilk.ibikecph.login.HTTPAccountHandler.java

public static Message performPutUser(UserData userData) {
    Message message = new Message();
    JsonNode result = null;/* w  w  w  .  j a v a 2  s. co  m*/
    JSONObject jsonPOST = new JSONObject();
    JSONObject jsonUser = new JSONObject();
    JSONObject jsonImagePath = new JSONObject();
    try {

        jsonUser.put("name", userData.getName());
        jsonUser.put("email", userData.getEmail());
        jsonUser.put("password", userData.getPassword());
        jsonUser.put("password_confirmation", userData.getPassword());
        if (userData.getBase64Image() != null && !userData.getBase64Image().trim().equals("")) {
            jsonImagePath.put("filename", userData.getImageName());
            jsonImagePath.put("original_filename", userData.getImageName());
            jsonImagePath.put("file", userData.getBase64Image());
            jsonUser.put("image_path", jsonImagePath);
        }
        jsonPOST.put("user", jsonUser);
        jsonPOST.put("id", userData.getId());
        jsonPOST.put("auth_token", userData.getAuth_token());

        result = HttpUtils.putToServer(Config.API_SERVER_REGISTER, jsonPOST);
        message = HttpUtils.JSONtoMessage(result);
        message.getData().putInt("type", PUT_USER);
    } catch (JSONException e) {
        LOG.e(e.getLocalizedMessage());
        message.getData().putInt("type", ERROR);
    }
    return message;
}

From source file:com.spoiledmilk.ibikecph.login.HTTPAccountHandler.java

public static Message performDeleteUser(UserData userData) {
    Message message = new Message();
    JsonNode result = null;//from  w  w  w .ja  va  2 s .co m
    JSONObject jsonPOST = new JSONObject();
    try {

        jsonPOST.put("auth_token", userData.getAuth_token());
        LOG.d("fb auth token = " + userData.getAuth_token());
        result = HttpUtils.deleteFromServer(Config.API_SERVER_REGISTER + "/" + userData.getId(), jsonPOST);
        message = HttpUtils.JSONtoMessage(result);
        message.getData().putInt("type", DELETE_USER);
    } catch (JSONException e) {
        LOG.e(e.getLocalizedMessage());
        message.getData().putInt("type", ERROR);
    }
    return message;
}

From source file:com.nextgis.firereporter.ScanexNotificationItem.java

public ScanexNotificationItem(Context c, JSONObject object) {
    Prepare(c);// w  w w . java2 s.  c  o m
    try {
        this.nID = object.getLong("id");
        this.dt = new Date(object.getLong("date"));
        this.X = object.getDouble("X");
        this.Y = object.getDouble("Y");
        this.nConfidence = object.getInt("confidence");
        this.nPower = object.getInt("power");
        this.sURL1 = object.getString("URL1");
        this.sURL2 = object.getString("URL2");
        this.sType = object.getString("type");
        this.sPlace = object.getString("place");
        this.sMap = object.getString("map");
        this.nIconId = object.getInt("iconId");
        this.mbWatched = object.getBoolean("watched");

    } catch (JSONException e) {
        SendError(e.getLocalizedMessage());
    }

}

From source file:com.nextgis.firereporter.ScanexNotificationItem.java

public JSONObject getAsJSON() {
    JSONObject object = new JSONObject();
    try {//from  www  . j a va 2 s . c  om
        object.put("id", nID);
        object.put("date", dt.getTime());
        object.put("X", X);
        object.put("Y", Y);
        object.put("iconId", nIconId);
        object.put("confidence", nConfidence);
        object.put("power", nPower);
        object.put("URL1", sURL1);
        object.put("URL2", sURL2);
        object.put("type", sType);
        object.put("place", sPlace);
        object.put("map", sMap);
        object.put("watched", mbWatched);

    } catch (JSONException e) {
        SendError(e.getLocalizedMessage());
    }
    return object;
}

From source file:org.cloudsky.cordovaPlugins.BarcodeminCDV.java

/**
 * Starts an intent to scan and decode a barcode.
 */// ww  w .  j av  a  2 s  . c  o  m
public void scan(final JSONArray args) {

    final CordovaPlugin that = this;

    cordova.getThreadPool().execute(new Runnable() {
        public void run() {

            Intent intentScan = new Intent(SCAN_INTENT);
            intentScan.addCategory(Intent.CATEGORY_DEFAULT);

            // add config as intent extras
            if (args.length() > 0) {

                JSONObject obj;
                JSONArray names;
                String key;
                Object value;

                for (int i = 0; i < args.length(); i++) {

                    try {
                        obj = args.getJSONObject(i);
                    } catch (JSONException e) {
                        Log.i("CordovaLog", e.getLocalizedMessage());
                        continue;
                    }

                    names = obj.names();
                    for (int j = 0; j < names.length(); j++) {
                        try {
                            key = names.getString(j);
                            value = obj.get(key);

                            if (value instanceof Integer) {
                                intentScan.putExtra(key, (Integer) value);
                            } else if (value instanceof String) {
                                intentScan.putExtra(key, (String) value);
                            }

                        } catch (JSONException e) {
                            Log.i("CordovaLog", e.getLocalizedMessage());
                        }
                    }

                    intentScan.putExtra(Intents.Scan.CAMERA_ID,
                            obj.optBoolean(PREFER_FRONTCAMERA, false) ? 1 : 0);
                    intentScan.putExtra(Intents.Scan.SHOW_FLIP_CAMERA_BUTTON,
                            obj.optBoolean(SHOW_FLIP_CAMERA_BUTTON, false));
                    if (obj.has(FORMATS)) {
                        intentScan.putExtra(Intents.Scan.FORMATS, obj.optString(FORMATS));
                    }
                    if (obj.has(PROMPT)) {
                        intentScan.putExtra(Intents.Scan.PROMPT_MESSAGE, obj.optString(PROMPT));
                    }
                    //if (obj.has(ORIENTATION)) {
                    //intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, obj.optString(ORIENTATION));
                    intentScan.putExtra(Intents.Scan.ORIENTATION_LOCK, "false");
                    //}
                }

            }

            // avoid calling other phonegap apps
            intentScan.setPackage(that.cordova.getActivity().getApplicationContext().getPackageName());

            that.cordova.startActivityForResult(that, intentScan, REQUEST_CODE);
        }
    });
}

From source file:de.tudarmstadt.dvs.myhealthassistant.myhealthhub.services.SystemMonitor.java

private void publishResult(Location loc) {
    String t = getTimestamp() + "\n";
    t += "Longitude:" + loc.getLongitude() + "\n";
    t += "Latitude:" + loc.getLatitude() + "\n";
    t += "BatteryPercent: " + batteryPercent + "\n";
    t += "-----------------------------------------";

    SharedPreferences prefs = getApplicationContext().getSharedPreferences("personal", Context.MODE_PRIVATE);

    phoneNr = prefs.getString(getString(R.string.p_emcy_phone_nr), "");

    // TODO: check Internet State before sending

    // send message to server
    JSONArray jsa = new JSONArray();
    JSONObject jso = new JSONObject();
    try {// w  w w  .  ja  va  2  s  .c om
        jso.put("Timestamp", getTimestamp());
        jso.put("Longitude", loc.getLongitude());
        jso.put("Latitude", loc.getLatitude());
        jso.put("PercentBattery", batteryPercent);
        jsa.put(jso);
        sendNotification(jsa);
    } catch (JSONException e) {
        Log.e(SystemMonitor.class.getSimpleName(), e.getLocalizedMessage());
    }

    // send message to a gmail acc
    new AsyncTask<String, Void, Void>() {

        @Override
        protected Void doInBackground(String... params) {
            //            String message = params[0];
            // GMailSender sender = new GMailSender(
            // null,
            // null);
            // try {
            // sender.sendMail("myHealthAssistant: SystemMonitor",
            // message,
            // null,
            // null);
            // } catch (Exception e) {
            // Log.e(SystemMonitor.class.getSimpleName(), e.getMessage());
            // }
            return null;
        }

    }.execute(t, null, null);

}

From source file:cz.opendata.linked.lodcloud.loader.Loader.java

@Override
protected void innerExecute() throws DPUException {
    logger.debug("Querying metadata");

    String datasetUrl = executeSimpleSelectQuery(
            "SELECT ?d WHERE {?d a <" + LoaderVocabulary.DCAT_DATASET_CLASS + ">}", "d");

    List<Map<String, Value>> distributions = executeSelectQuery(
            "SELECT ?distribution WHERE {<" + datasetUrl + "> <" + LoaderVocabulary.DCAT_DISTRIBUTION
                    + "> ?distribution . ?distribution <" + LoaderVocabulary.VOID_SPARQLENDPOINT + "> [] .  }");

    if (distributions.size() != 1) {
        throw new DPUException("Expected 1 distribution with SPARQL endpoint. Found: " + distributions.size());
    }//  w  w  w  . j  a  v a  2 s . c o m

    String distribution = distributions.get(0).get("distribution").stringValue();
    String title = executeSimpleSelectQuery("SELECT ?title WHERE {<" + distribution + "> <" + DCTERMS.TITLE
            + "> ?title FILTER(LANGMATCHES(LANG(?title), \"en\"))}", "title");
    String description = executeSimpleSelectQuery("SELECT ?description WHERE {<" + distribution + "> <"
            + DCTERMS.DESCRIPTION + "> ?description FILTER(LANGMATCHES(LANG(?description), \"en\"))}",
            "description");
    String sparqlEndpointVoid = executeSimpleSelectQuery("SELECT ?sparqlEndpoint WHERE {<" + distribution
            + "> <" + LoaderVocabulary.VOID_SPARQLENDPOINT + "> ?sparqlEndpoint }", "sparqlEndpoint");
    String datadump = executeSimpleSelectQuery(
            "SELECT ?dwnld WHERE {<" + distribution + "> <" + LoaderVocabulary.VOID_DATADUMP + "> ?dwnld }",
            "dwnld");
    String triplecount = executeSimpleSelectQuery("SELECT ?triplecount WHERE {<" + distribution + "> <"
            + LoaderVocabulary.VOID_TRIPLES + "> ?triplecount }", "triplecount");
    String dformat = executeSimpleSelectQuery(
            "SELECT ?format WHERE {<" + distribution + "> <" + DCTERMS.FORMAT + "> ?format }", "format");
    String dlicense = executeSimpleSelectQuery(
            "SELECT ?license WHERE {<" + distribution + "> <" + DCTERMS.LICENSE + "> ?license }", "license");
    String dschema = executeSimpleSelectQuery("SELECT ?schema WHERE {<" + distribution + "> <"
            + LoaderVocabulary.WDRS_DESCRIBEDBY + "> ?schema }", "schema");

    LinkedList<String> examples = new LinkedList<String>();
    for (Map<String, Value> map : executeSelectQuery("SELECT ?exampleResource WHERE {<" + distribution + "> <"
            + LoaderVocabulary.VOID_EXAMPLERESOURCE + "> ?exampleResource }")) {
        examples.add(map.get("exampleResource").stringValue());
    }

    logger.debug("Querying for the dataset in CKAN");
    boolean exists = false;
    Map<String, String> resUrlIdMap = new HashMap<String, String>();
    Map<String, String> resFormatIdMap = new HashMap<String, String>();

    CloseableHttpClient queryClient = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy())
            .build();
    HttpGet httpGet = new HttpGet(config.getApiUri() + "/" + config.getDatasetID());
    CloseableHttpResponse queryResponse = null;
    try {
        queryResponse = queryClient.execute(httpGet);
        if (queryResponse.getStatusLine().getStatusCode() == 200) {
            logger.info("Dataset found");
            exists = true;

            JSONObject response = new JSONObject(EntityUtils.toString(queryResponse.getEntity()));
            JSONArray resourcesArray = response.getJSONArray("resources");
            for (int i = 0; i < resourcesArray.length(); i++) {
                try {
                    String id = resourcesArray.getJSONObject(i).getString("id");
                    String url = resourcesArray.getJSONObject(i).getString("url");
                    resUrlIdMap.put(url, id);

                    if (resourcesArray.getJSONObject(i).has("format")) {
                        String format = resourcesArray.getJSONObject(i).getString("format");
                        resFormatIdMap.put(format, id);
                    }

                } catch (JSONException e) {
                    logger.error(e.getLocalizedMessage(), e);
                }
            }

        } else {
            String ent = EntityUtils.toString(queryResponse.getEntity());
            logger.info("Dataset not found");
        }
    } catch (ClientProtocolException e) {
        logger.error(e.getLocalizedMessage(), e);
    } catch (IOException e) {
        logger.error(e.getLocalizedMessage(), e);
    } catch (ParseException e) {
        logger.error(e.getLocalizedMessage(), e);
    } catch (JSONException e) {
        logger.error(e.getLocalizedMessage(), e);
    } finally {
        if (queryResponse != null) {
            try {
                queryResponse.close();
                queryClient.close();
            } catch (IOException e) {
                logger.error(e.getLocalizedMessage(), e);
            }
        }
    }

    logger.debug("Creating JSON");
    try {
        JSONObject root = new JSONObject();

        JSONArray tags = new JSONArray();
        tags.put("lod");
        tags.put(config.getVocabTag().toString());
        tags.put(config.getVocabMappingTag().toString());
        tags.put(config.getPublishedTag().toString());
        tags.put(config.getProvenanceMetadataTag().toString());
        tags.put(config.getLicenseMetadataTag().toString());
        if (config.isLimitedSparql())
            tags.put("limited-sparql-endpoint");
        if (config.isLodcloudNolinks())
            tags.put("lodcloud.nolinks");
        if (config.isLodcloudUnconnected())
            tags.put("lodcloud.unconnected");
        if (config.isLodcloudNeedsInfo())
            tags.put("lodcloud.needsinfo");
        if (config.isLodcloudNeedsFixing())
            tags.put("lodcloud.needsfixing");
        for (String prefix : config.getVocabularies()) {
            tags.put("format-" + prefix);
        }
        tags.put(config.getTopic());
        for (String s : config.getAdditionalTags())
            tags.put(s);

        JSONArray resources = new JSONArray();

        // Start of Sparql Endpoint resource
        JSONObject sparqlEndpoint = new JSONObject();

        sparqlEndpoint.put("format", "api/sparql");
        sparqlEndpoint.put("resource_type", "api");
        sparqlEndpoint.put("description", config.getSparqlEndpointDescription());
        sparqlEndpoint.put("name", config.getSparqlEndpointName());
        sparqlEndpoint.put("url", sparqlEndpointVoid);

        if (resFormatIdMap.containsKey("api/sparql"))
            sparqlEndpoint.put("id", resFormatIdMap.get("api/sparql"));

        resources.put(sparqlEndpoint);
        // End of Sparql Endpoint resource

        // Start of VoID resource
        JSONObject voidJson = new JSONObject();

        voidJson.put("format", "meta/void");
        voidJson.put("resource_type", "file");
        voidJson.put("description", "VoID description generated live");
        voidJson.put("name", "VoID");
        String voidUrl = sparqlEndpointVoid + "?query="
                + URLEncoder.encode("DESCRIBE <" + distribution + ">", "UTF-8") + "&output="
                + URLEncoder.encode("text/turtle", "UTF-8");
        voidJson.put("url", voidUrl);

        if (resFormatIdMap.containsKey("meta/void"))
            voidJson.put("id", resFormatIdMap.get("meta/void"));

        resources.put(voidJson);
        // End of VoID resource

        if (config.getVocabTag() != LoaderConfig.VocabTags.NoProprietaryVocab && !dschema.isEmpty()) {
            // Start of RDFS/OWL schema resource
            JSONObject schemaResource = new JSONObject();

            schemaResource.put("format", "meta/rdf-schema");
            schemaResource.put("resource_type", "file");
            schemaResource.put("description", "RDFS/OWL Schema with proprietary vocabulary");
            schemaResource.put("name", "RDFS/OWL schema");
            schemaResource.put("url", dschema);

            if (resFormatIdMap.containsKey("meta/rdf-schema"))
                schemaResource.put("id", resFormatIdMap.get("meta/rdf-schema"));

            resources.put(schemaResource);
            // End of RDFS/OWL schema resource
        }

        // Start of Dump resource
        JSONObject dump = new JSONObject();

        dump.put("format", dformat);
        dump.put("resource_type", "file");
        //dump.put("description","Dump is a zipped TriG file");
        dump.put("name", "Dump");
        dump.put("url", datadump);

        if (resUrlIdMap.containsKey(datadump))
            dump.put("id", resUrlIdMap.get(datadump));

        resources.put(dump);
        // End of Dump resource

        for (String example : examples) {
            // Start of Example resource text/turtle
            JSONObject exTurtle = new JSONObject();

            exTurtle.put("format", "example/turtle");
            exTurtle.put("resource_type", "file");
            //exTurtle.put("description","Generated by Virtuoso FCT");
            exTurtle.put("name", "Example resource in Turtle");
            String exTurtleUrl = sparqlEndpointVoid + "?query="
                    + URLEncoder.encode("DESCRIBE <" + example + ">", "UTF-8") + "&output="
                    + URLEncoder.encode("text/turtle", "UTF-8");
            exTurtle.put("url", exTurtleUrl);

            if (resUrlIdMap.containsKey(exTurtleUrl))
                exTurtle.put("id", resUrlIdMap.get(exTurtleUrl));

            resources.put(exTurtle);
            // End of text/turtle resource

            // Start of Example resource html
            JSONObject exHTML = new JSONObject();

            exHTML.put("format", "HTML");
            exHTML.put("resource_type", "file");
            exHTML.put("description", "Generated by Virtuoso FCT");
            exHTML.put("name", "Example resource in Virtuoso FCT");
            exHTML.put("url", example);

            if (resUrlIdMap.containsKey(example))
                exHTML.put("id", resUrlIdMap.get(example));

            resources.put(exHTML);
            // End of html resource

            // Mapping file resources
            for (MappingFile mapping : config.getMappingFiles()) {
                JSONObject exMapping = new JSONObject();

                String mappingMime = "mapping/" + mapping.getMappingFormat();
                exMapping.put("format", mappingMime);
                exMapping.put("resource_type", "file");
                exMapping.put("description",
                        "Schema mapping file in " + mapping.getMappingFormat() + " format.");
                exMapping.put("name", "Mapping " + mapping.getMappingFormat());
                exMapping.put("url", mapping.getMappingFile());

                if (resFormatIdMap.containsKey(mappingMime))
                    exMapping.put("id", resFormatIdMap.get(mappingMime));

                resources.put(exMapping);
            }
            // End of mapping file resources

        }

        JSONObject extras = new JSONObject();
        extras.put("triples", triplecount);
        if (!config.getShortname().isEmpty())
            extras.put("shortname", config.getShortname());
        if (!config.getNamespace().isEmpty())
            extras.put("namespace", config.getNamespace());
        if (!dlicense.isEmpty())
            extras.put("license_link", dlicense);
        extras.put("sparql_graph_name", datasetUrl);
        for (LinkCount link : config.getLinks()) {
            extras.put("links:" + link.getTargetDataset(), link.getLinkCount());
        }

        if (!config.getDatasetID().isEmpty())
            root.put("name", config.getDatasetID());
        root.put("url", datasetUrl);
        root.put("title", title);
        if (!config.getMaintainerName().isEmpty())
            root.put("maintainer", config.getMaintainerName());
        if (!config.getMaintainerEmail().isEmpty())
            root.put("maintainer_email", config.getMaintainerEmail());
        root.put("license_id", config.getLicense_id());
        root.put("notes", description);
        if (!config.getAuthorName().isEmpty())
            root.put("author", config.getAuthorName());
        if (!config.getAuthorEmail().isEmpty())
            root.put("author_email", config.getAuthorEmail());

        if (config.isVersionGenerated()) {
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            Date versiondate = new Date();
            String version = dateFormat.format(versiondate);
            root.put("version", version);
        } else if (!config.getVersion().isEmpty())
            root.put("version", config.getVersion());

        root.put("tags", tags);
        root.put("resources", resources);
        root.put("extras", extras);

        if (!exists) {
            JSONObject createRoot = new JSONObject();

            createRoot.put("name", config.getDatasetID());
            createRoot.put("title", title);
            createRoot.put("owner_org", config.getOrgID());

            logger.debug("Creating dataset in CKAN");
            CloseableHttpClient client = HttpClientBuilder.create()
                    .setRedirectStrategy(new LaxRedirectStrategy()).build();
            HttpPost httpPost = new HttpPost(config.getApiUri());
            httpPost.addHeader(new BasicHeader("Authorization", config.getApiKey()));

            String json = createRoot.toString();

            logger.debug("Creating dataset with: " + json);

            httpPost.setEntity(new StringEntity(json, Charset.forName("utf-8")));

            CloseableHttpResponse response = null;

            try {
                response = client.execute(httpPost);
                if (response.getStatusLine().getStatusCode() == 201) {
                    logger.info("Dataset created OK: " + response.getStatusLine());
                } else if (response.getStatusLine().getStatusCode() == 409) {
                    logger.error("Dataset already exists: " + response.getStatusLine());
                    ContextUtils.sendError(ctx, "Dataset already exists", "Dataset already exists: {0}",
                            response.getStatusLine());
                } else {
                    ContextUtils.sendError(ctx, "Error creating dataset",
                            "Response while creating dataset: {0}", response.getStatusLine());
                }
            } catch (ClientProtocolException e) {
                logger.error(e.getLocalizedMessage(), e);
            } catch (IOException e) {
                logger.error(e.getLocalizedMessage(), e);
            } finally {
                if (response != null) {
                    try {
                        response.close();
                        client.close();
                    } catch (IOException e) {
                        logger.error(e.getLocalizedMessage(), e);
                        ContextUtils.sendError(ctx, "Error creating dataset", e.getLocalizedMessage());
                    }
                }
            }
        }

        if (!ctx.canceled()) {
            logger.debug("Posting to CKAN");
            CloseableHttpClient client = HttpClients.createDefault();
            URIBuilder uriBuilder = new URIBuilder(config.getApiUri() + "/" + config.getDatasetID());
            HttpPost httpPost = new HttpPost(uriBuilder.build().normalize());
            httpPost.addHeader(new BasicHeader("Authorization", config.getApiKey()));

            String json = root.toString();

            httpPost.setEntity(new StringEntity(json, Charset.forName("utf-8")));

            CloseableHttpResponse response = null;

            try {
                response = client.execute(httpPost);
                if (response.getStatusLine().getStatusCode() == 200) {
                    logger.info("Response: " + response.getEntity());
                } else {
                    ContextUtils.sendError(ctx, "Error updating dataset",
                            "Response while updating dataset: {0}", response.getStatusLine());
                }
            } catch (ClientProtocolException e) {
                logger.error(e.getLocalizedMessage(), e);
            } catch (IOException e) {
                logger.error(e.getLocalizedMessage(), e);
            } finally {
                if (response != null) {
                    try {
                        response.close();
                        client.close();
                    } catch (IOException e) {
                        logger.error(e.getLocalizedMessage(), e);
                        ContextUtils.sendError(ctx, "Error updating dataset", e.getLocalizedMessage());
                    }
                }
            }
        }
    } catch (JSONException e) {
        logger.error(e.getLocalizedMessage(), e);
    } catch (URISyntaxException e) {
        logger.error(e.getLocalizedMessage(), e);
    } catch (UnsupportedEncodingException e) {
        logger.error(e.getLocalizedMessage(), e);
    }

}

From source file:to.networld.fbtosemweb.ws.SIOCHomeExporter.java

@Override
public void doGet(HttpServletRequest _request, HttpServletResponse _response)
        throws ServletException, IOException {
    String access_token = SessionHandler.getAccessToken(_request);
    if (access_token == null) {
        access_token = (String) _request.getParameter("access_token");
        if (access_token == null) {
            _response.sendRedirect(".");
            return;
        } else {//from w  w  w  . j  ava  2  s. c  om
            access_token = "access_token=" + access_token;
        }
    }

    PrintWriter out = _response.getWriter();

    try {
        FacebookAgentHandler currentAgentHandler = new FacebookAgentHandler(access_token);
        FacebookToSIOC siocFile = new FacebookToSIOC(currentAgentHandler.getFacebookHomeFeed());
        _response.setCharacterEncoding("UTF-8");
        _response.setContentType("application/rdf+xml; charset=UTF-8");
        _response.setHeader("Content-Disposition", "attachment; filename=sioc_home.rdf");
        out.println(siocFile);
    } catch (JSONException e) {
        out.println(e.getLocalizedMessage());
        _response.setStatus(500);
    }
}

From source file:com.soomla.levelup.LevelUp.java

public static HashMap<String, JSONObject> getWorlds(JSONObject model) {
    HashMap<String, JSONObject> worlds = new HashMap<String, JSONObject>();

    try {//from   w ww.  j  a  va 2  s  .c  o m
        JSONObject mainWorld = model.getJSONObject("mainWorld");
        addWorldObjectToWorlds(worlds, mainWorld);
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG, "couldn't get something from model. error: " + e.getLocalizedMessage());
    }

    return worlds;
}

From source file:com.soomla.levelup.LevelUp.java

private static void findInternalLists(HashMap<String, JSONObject> objects, String[] listClasses,
        String listName) {/*  ww  w.j  av  a  2  s. co m*/
    try {
        List<String> classes = Arrays.asList(listClasses);
        for (JSONObject objectJSON : objects.values()) {
            findInternalLists(objects, classes, listName, objectJSON);
        }
    } catch (JSONException e) {
        SoomlaUtils.LogError(TAG,
                "couldn't get internal lists for " + listName + ". error: " + e.getLocalizedMessage());
    }
}