Example usage for org.json.simple JSONArray get

List of usage examples for org.json.simple JSONArray get

Introduction

In this page you can find the example usage for org.json.simple JSONArray get.

Prototype

public E get(int index) 

Source Link

Document

Returns the element at the specified position in this list.

Usage

From source file:au.edu.jcu.fascinator.plugin.harvester.directory.DirectoryNameHarvester.java

/**
 * Create digital object/*  w w w.j a va  2s .  com*/
 *
 * @param list         The set of harvested IDs to add to
 * @param file         File (directory name) to be transformed to be digital object
 * @param oid          Unique identifier for the object
 * @param metaDataType the metadata type being processed based on configuration setup.
 * @throws HarvesterException if fail to create the object
 * @throws StorageException if fail to save the file to the storage
 */
private void createDigitalObject(Set<String> list, File file, String oid, JsonSimple metadataType)
        throws HarvesterException, StorageException {

    //obtaining directory name to use as part of the metadata
    String directory = file.getName();

    //read the override metadata file if it exists
    JsonSimple overrideMeta = null;

    try {
        this.overrideMetadata = new JsonSimple(new File(file, this.overrideMetadataFilename));
        overrideMeta = new JsonSimple(this.overrideMetadata.getObject("harvester", "metadata"));
    } catch (IOException ex) {
        log.info("Metadata override file does not exist: ", file + this.overrideMetadataFilename);
    }

    JsonSimple defaultMetadata = new JsonSimple(
            this.defaultMetadata.getObject("harvester", "default-metadata"));

    //asembling the data
    JsonSimple data = new JsonSimple();
    //adding the species (the directory name) to the data        
    data.getJsonObject().put("species", directory);

    //Merging the default metadata with the override metadata
    //obtaining the metadata type
    String type = metadataType.getString("", "type");
    //for the metadata type, obtain the metadata and add it
    JSONArray tempDefault = defaultMetadata.getArray(type);
    JsonObject tempObj = (JsonObject) tempDefault.get(0);
    data.getJsonObject().putAll(tempObj);

    JSONArray tempOverride = null;
    if (overrideMeta != null) {
        tempOverride = overrideMeta.getArray(type);
        tempObj = (JsonObject) tempOverride.get(0);
        data.getJsonObject().putAll(tempObj);
    }

    JsonObject meta = new JsonObject();
    meta.put("dc.identifier", idPrefix + directory + "/" + type);

    storeJsonInObject(data.getJsonObject(), meta, oid);
    list.add(oid);
}

From source file:be.appfoundry.custom.google.android.gcm.server.Sender.java

/**
 * Sends a message without retrying in case of service unavailability. See
 * {@link #send(Message, String, int)} for more info.
 *
 * @return result of the post, or {@literal null} if the GCM service was
 * unavailable or any network exception caused the request to fail,
 * or if the response contains more than one result.
 * @throws InvalidRequestException  if GCM didn't returned a 200 status.
 * @throws IllegalArgumentException if to is {@literal null}.
 *///from   w  w w. j  a  v  a 2s . com
public Result sendNoRetry(Message message, String to) throws IOException {
    nonNull(to);
    Map<Object, Object> jsonRequest = new HashMap<Object, Object>();
    messageToMap(message, jsonRequest);
    jsonRequest.put(JSON_TO, to);
    String responseBody = makeGcmHttpRequest(jsonRequest);
    if (responseBody == null) {
        return null;
    }
    JSONParser parser = new JSONParser();
    JSONObject jsonResponse;
    try {
        jsonResponse = (JSONObject) parser.parse(responseBody);
        Result.Builder resultBuilder = new Result.Builder();
        if (jsonResponse.containsKey("results")) {
            // Handle response from message sent to specific device.
            JSONArray jsonResults = (JSONArray) jsonResponse.get("results");
            if (jsonResults.size() == 1) {
                JSONObject jsonResult = (JSONObject) jsonResults.get(0);
                String messageId = (String) jsonResult.get(JSON_MESSAGE_ID);
                String canonicalRegId = (String) jsonResult.get(TOKEN_CANONICAL_REG_ID);
                String error = (String) jsonResult.get(JSON_ERROR);
                resultBuilder.messageId(messageId).canonicalRegistrationId(canonicalRegId).errorCode(error);
            } else {
                logger.log(Level.WARNING, "Found null or " + jsonResults.size() + " results, expected one");
                return null;
            }
        } else if (to.startsWith(TOPIC_PREFIX)) {
            if (jsonResponse.containsKey(JSON_MESSAGE_ID)) {
                // message_id is expected when this is the response from a topic message.
                Long messageId = (Long) jsonResponse.get(JSON_MESSAGE_ID);
                resultBuilder.messageId(messageId.toString());
            } else if (jsonResponse.containsKey(JSON_ERROR)) {
                String error = (String) jsonResponse.get(JSON_ERROR);
                resultBuilder.errorCode(error);
            } else {
                logger.log(Level.WARNING,
                        "Expected " + JSON_MESSAGE_ID + " or " + JSON_ERROR + " found: " + responseBody);
                return null;
            }
        } else if (jsonResponse.containsKey(JSON_SUCCESS) && jsonResponse.containsKey(JSON_FAILURE)) {
            // success and failure are expected when response is from group message.
            int success = getNumber(jsonResponse, JSON_SUCCESS).intValue();
            int failure = getNumber(jsonResponse, JSON_FAILURE).intValue();
            List<String> failedIds = null;
            if (jsonResponse.containsKey("failed_registration_ids")) {
                JSONArray jFailedIds = (JSONArray) jsonResponse.get("failed_registration_ids");
                failedIds = new ArrayList<String>();
                for (int i = 0; i < jFailedIds.size(); i++) {
                    failedIds.add((String) jFailedIds.get(i));
                }
            }
            resultBuilder.success(success).failure(failure).failedRegistrationIds(failedIds);
        } else {
            logger.warning("Unrecognized response: " + responseBody);
            throw newIoException(responseBody, new Exception("Unrecognized response."));
        }
        return resultBuilder.build();
    } catch (ParseException e) {
        throw newIoException(responseBody, e);
    } catch (CustomParserException e) {
        throw newIoException(responseBody, e);
    }
}

From source file:com.taiter.ce.Main.java

public void updateCheck() {
    try {/* w  w w  . ja v  a  2 s  . c o m*/
        Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] Checking for updates...");

        URLConnection connection = updateListURL.openConnection();
        connection.setConnectTimeout(5000);
        connection.addRequestProperty("User-Agent", "Custom Enchantments - Update Checker");
        connection.setDoOutput(true);
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String response = reader.readLine();
        JSONArray array = (JSONArray) JSONValue.parse(response);
        JSONObject newestUpdate = (JSONObject) array.get(array.size() - 1);

        newVersion = newestUpdate.get("name").toString().replace("Custom Enchantments ", "").trim();
        newMD5 = newestUpdate.get("md5").toString();

        int newLength = newVersion.length();
        int currentLength = currentVersion.length();

        double versionNew;
        double versionCurrent;

        Boolean newHasSubVersion = false;
        Boolean currentHasSubVersion = false;

        try {
            versionNew = Double.parseDouble(newVersion);
        } catch (NumberFormatException ex) {
            newHasSubVersion = true;
            versionNew = Double.parseDouble(newVersion.substring(0, newVersion.length() - 1));
        }

        try {
            versionCurrent = Double.parseDouble(currentVersion);
        } catch (NumberFormatException ex) {
            currentHasSubVersion = true;
            versionCurrent = Double.parseDouble(currentVersion.substring(0, currentVersion.length() - 1));
        }

        if ((versionNew > versionCurrent) || ((versionNew == versionCurrent) && newHasSubVersion
                && currentHasSubVersion && ((byte) newVersion.toCharArray()[newLength
                        - 1] > (byte) currentVersion.toCharArray()[currentLength - 1]))) {
            hasUpdate = true;
            updateDownloadURL = new URL(newestUpdate.get("downloadUrl").toString().replace("\\.", ""));
            Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] A new update is available!");
            Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] The new version is " + ChatColor.AQUA
                    + newVersion + ChatColor.GREEN + ".");
            Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] You are currently using "
                    + ChatColor.AQUA + currentVersion + ChatColor.GREEN + ".");
            Bukkit.getConsoleSender().sendMessage(
                    ChatColor.GREEN + "[CE] You can use '/ce update applyupdate' to update automatically.");

        } else {
            hasUpdate = false;
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.GREEN + "[CE] You are using the latest Version of CE!");
        }
        hasChecked = true;
    } catch (IOException ioex) {
        Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] Failed to check for updates");
    }

}

From source file:functionaltests.RestSchedulerJobPaginationTest.java

private void checkJobIds(boolean indexAndRange, int index, int limit, String... expectedIds) throws Exception {
    JSONObject page;/*from   w  w w  .  j  a v  a 2s .  com*/
    JSONArray jobs;

    Set<String> expected = new HashSet<>(Arrays.asList(expectedIds));
    Set<String> actual = new HashSet<>();

    String url;

    // test 'jobs' request
    if (indexAndRange) {
        url = getResourceUrl("jobs?index=" + index + "&limit=" + limit);
    } else {
        url = getResourceUrl("jobs");
    }
    page = getRequestJSONObject(url);
    jobs = (JSONArray) page.get("list");
    for (int i = 0; i < jobs.size(); i++) {
        actual.add((String) jobs.get(i));
    }

    Assert.assertEquals("Unexpected result of 'jobs' request (" + url + ")", expected, actual);

    // test 'jobsinfo' request
    if (indexAndRange) {
        url = getResourceUrl("jobsinfo?index=" + index + "&limit=" + limit);
    } else {
        url = getResourceUrl("jobsinfo");
    }
    page = getRequestJSONObject(url);
    jobs = (JSONArray) page.get("list");
    actual.clear();
    for (int i = 0; i < jobs.size(); i++) {
        JSONObject job = (JSONObject) jobs.get(i);
        actual.add((String) job.get("jobid"));
    }
    Assert.assertEquals("Unexpected result of 'jobsinfo' request (" + url + ")", expected, actual);

    // test 'revisionjobsinfo' request
    if (indexAndRange) {
        url = getResourceUrl("revisionjobsinfo?index=" + index + "&limit=" + limit);
    } else {
        url = getResourceUrl("revisionjobsinfo");
    }
    checkRevisionJobsInfo(url, expectedIds);
}

From source file:carolina.pegaLatLong.LatLong.java

private void buscaLtLong(List<InformacoesTxt> lista) throws MalformedURLException, IOException, ParseException {
    String status = "Processando...";
    edtEncontrados.setText("Encontrados:");
    edtNaoEncontrados.setText("No encontrados:");
    edtMaisDeUm.setText("Mais de um encontrados:");
    edtProcessados.setText("Processados:");
    edtStatus.setText(status);//from   www .  j a  v a 2 s .  co m
    int processados = 1;

    URL ul;

    for (InformacoesTxt in : lista) {
        if (processados == 2499) {
            break;
        }
        edtProcessados.setText("Processados: " + processados);
        String resto = "";
        String vet[] = in.getEndereco().split(" ");

        for (String vet1 : vet) {
            resto += vet1 + "+";
        }

        //            String vet2[] = in.getBairro().split(" ");
        //            for (String vet21 : vet2) {
        //                resto += vet21 + "+";
        //            }
        //
        //            String vet3[] = in.getCep().split(" ");
        //            for (String vet31 : vet3) {
        //                resto += vet31 + "+";
        //            }
        String vet4[] = in.getCidade().split(" ");
        for (String vet41 : vet4) {
            resto += vet41 + "+";
        }

        ul = new URL("https://maps.googleapis.com/maps/api/geocode/json?address=" + resto
                + "&key=AIzaSyDFg9GJIbgHKbZP3b5H2qRV_cAhhvlBaoE");
        //System.err.println("URL: " + ul);
        HttpURLConnection conn = (HttpURLConnection) ul.openConnection();
        // conn.setRequestMethod("GET");
        //conn.setRequestProperty("Accept", "application/json");

        if (conn.getResponseCode() != 200) {
            listaBadRequest.add(in);
            System.err.println("Codigo: " + conn.getResponseMessage());
            //System.err.println("URL: " + ul);
            //JOptionPane.showMessageDialog(null, "Falha ao obter a localizao!");
            //break;
        } else {
            BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String pega = "";
            String result = "";
            while ((pega = bf.readLine()) != null) {
                result += pega;
            }
            System.err.println(result);

            org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser();
            Object obj = parser.parse(result);

            JSONObject tudo = (JSONObject) obj;

            JSONArray arrayResultado = (JSONArray) tudo.get("results");
            if (arrayResultado.isEmpty()) {
                listaNaoEncontrados.add(in);
                edtNaoEncontrados.setText("No encontrados: " + listaNaoEncontrados.size());
            } else if (arrayResultado.size() == 1) {
                JSONObject primeiro = (JSONObject) arrayResultado.get(0);
                JSONObject jsonObject3 = (JSONObject) primeiro.get("geometry");
                JSONObject location = (JSONObject) jsonObject3.get("location");
                InformacaoGerada gerado = new InformacaoGerada();
                gerado.setEnderecoFormatado(primeiro.get("formatted_address").toString());
                String latitude = location.get("lat").toString().replace(".", ",");
                gerado.setLatitude(latitude);
                String longitude = location.get("lng").toString().replace(".", ",");
                gerado.setLongitude(longitude);
                listaResultado.add(gerado);
                edtEncontrados.setText("Encontrados: " + listaResultado.size());
            } else {
                listaMaisDeUm.add(in);
                edtMaisDeUm.setText("Mais de um encontrados: " + listaMaisDeUm.size());
            }

            //                System.err.println("Endereo Formatado: " + primeiro.get("formatted_address"));
            //                System.out.println("Lat = " + location.get("lat"));
            //                System.out.println("Lng = " + location.get("lng"));
        }

        processados++;
    }

    edtStatus.setForeground(Color.GREEN);
    edtStatus.setText("Concludo");
    btnGerar.setEnabled(true);

}

From source file:at.ac.tuwien.dsg.rSybl.cloudInteractionUnit.enforcementPlugins.dryRun.DryRunEnforcementAPI.java

public void readParameters() {
    JSONParser parser = new JSONParser();

    try {/*from   w ww  . j  a  va  2 s  .c  o m*/
        InputStream inputStream = Configuration.class.getClassLoader()
                .getResourceAsStream("config/resources.json");
        Object obj = parser.parse(new InputStreamReader(inputStream));

        JSONObject jsonObject = (JSONObject) obj;

        for (Object p : jsonObject.keySet()) {
            String pluginName = (String) p;
            JSONObject plugin = (JSONObject) jsonObject.get(pluginName);
            if (pluginName.toLowerCase().contains("dry")) {
                for (Object a : plugin.keySet()) {
                    String actionName = (String) a;
                    JSONObject action = (JSONObject) plugin.get(actionName);
                    JSONArray jSONArray = (JSONArray) action.get("parameters");
                    for (int i = 0; i < jSONArray.size(); i++) {
                        parameters.add((String) jSONArray.get(i));
                    }

                }
            }
        }
    } catch (Exception e) {
        RuntimeLogger.logger.info(e.getMessage());
    }
}

From source file:de.static_interface.sinklibrary.Updater.java

private boolean isUpdateAvailable() {
    try {/*  w w w.  ja  va2s . com*/
        final URLConnection conn = url.openConnection();
        conn.setConnectTimeout(5000);

        String version = SinkLibrary.getInstance().getVersion();

        conn.addRequestProperty("User-Agent", "SinkLibrary/v" + version + " (modified by Trojaner)");

        conn.setDoOutput(true);

        final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        final String response = reader.readLine();

        final JSONArray array = (JSONArray) JSONValue.parse(response);

        if (array.size() == 0) {
            SinkLibrary.getInstance().getLogger()
                    .warning("The updater could not find any files for the project id " + id);
            result = UpdateResult.FAIL_BADID;
            return false;
        }

        versionName = (String) ((JSONObject) array.get(array.size() - 1)).get(Updater.TITLE_VALUE);
        versionLink = (String) ((JSONObject) array.get(array.size() - 1)).get(Updater.LINK_VALUE);
        versionType = (String) ((JSONObject) array.get(array.size() - 1)).get(Updater.TYPE_VALUE);
        versionGameVersion = (String) ((JSONObject) array.get(array.size() - 1)).get(Updater.VERSION_VALUE);

        return true;
    } catch (final IOException e) {
        if (e.getMessage().contains("HTTP response code: 403")) {
            SinkLibrary.getInstance().getLogger()
                    .warning("dev.bukkit.org rejected the API key provided in plugins/Updater/config.yml");
            SinkLibrary.getInstance().getLogger()
                    .warning("Please double-check your configuration to ensure it is correct.");
            result = UpdateResult.FAIL_APIKEY;
        } else {
            SinkLibrary.getInstance().getLogger()
                    .warning("The updater could not contact dev.bukkit.org for updating.");
            SinkLibrary.getInstance().getLogger().warning(
                    "If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime.");
            result = UpdateResult.FAIL_DBO;
        }
        e.printStackTrace();
        return false;
    }
}

From source file:gov.usda.DataCatalogClient.Catalog.java

/**
 * Populates catalog from Project Open Data compliant json object
 * //from w  w  w.j a  va 2  s  .c  om
 * @param catalogObject
 */
public void loadFromProjectOpenDataJSON(JSONObject catalogObject) throws CatalogException {
    if (catalogObject == null) {
        throw (new NullPointerException("catalogObject cannot be null"));
    }
    setConformsTo((String) catalogObject.get(PROJECT_OPEN_DATA_CATALOG_CONFORMS_TO));
    setDescribedBy((String) catalogObject.get(PROJECT_OPEN_DATA_CATALOG_DESCRIBED_BY));
    setContext((String) catalogObject.get(PROJECT_OPEN_DATA_CATALOG_CONTEXT));
    setType((String) catalogObject.get(PROJECT_OPEN_DATA_CATALOG_TYPE));

    final JSONArray dataSetArray = (JSONArray) catalogObject.get(Dataset.PROJECT_OPEN_DATA_DATASET);
    for (int i = 0; i < dataSetArray.size(); i++) {
        final Dataset ds = new Dataset();
        final JSONObject dataSetObject = (JSONObject) dataSetArray.get(i);
        try {
            ds.loadFromProjectOpenDataJSON(dataSetObject);
            dataSetList.add(ds);
        } catch (DatasetException e) {
            catalogException.addError(e.toString());
        }
    }

    addBureauNameToDataset();
    Collections.sort(dataSetList);

    if (!validateCatalog() || catalogException.exceptionSize() > 0) {
        throw (catalogException);
    }
}

From source file:com.net.h1karo.sharecontrol.ShareControl.java

public void updateCheck() {
    String CBuildString = "", NBuildString = "";

    int CMajor = 0, CMinor = 0, CMaintenance = 0, CBuild = 0, NMajor = 0, NMinor = 0, NMaintenance = 0,
            NBuild = 0;/*from   www . jav  a  2 s.c  om*/

    try {
        URL url = new URL("https://api.curseforge.com/servermods/files?projectids=90354");
        URLConnection conn = url.openConnection();
        conn.setReadTimeout(5000);
        conn.addRequestProperty("User-Agent", "ShareControl Update Checker");
        conn.setDoOutput(true);
        final BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        final String response = reader.readLine();
        final JSONArray array = (JSONArray) JSONValue.parse(response);

        if (array.size() == 0) {
            this.getLogger().warning("No files found, or Feed URL is bad.");
            result = UpdateResult.ERROR;
            return;
        }
        String newVersionTitle = ((String) ((JSONObject) array.get(array.size() - 1)).get("name"));
        newVersion = newVersionTitle.replace("ShareControl v", "").trim();

        /**\\**/
        /**\\**//**\\**/
        /**\    GET VERSIONS    /**\
          /**\\**/
        /**\\**//**\\**/

        String[] CStrings = currentVersion.split(Pattern.quote("."));

        CMajor = Integer.parseInt(CStrings[0]);
        if (CStrings.length > 1)
            if (CStrings[1].contains("-")) {
                CMinor = Integer.parseInt(CStrings[1].split(Pattern.quote("-"))[0]);
                CBuildString = CStrings[1].split(Pattern.quote("-"))[1];
                if (CBuildString.contains("b")) {
                    beta = true;
                    CBuildString = CBuildString.replace("b", "");
                    if (CBuildString != "")
                        CBuild = Integer.parseInt(CBuildString) - 1;
                } else if (CBuildString.contains("a")) {
                    alpha = true;
                    CBuildString = CBuildString.replace("a", "");
                    if (CBuildString != "")
                        CBuild = Integer.parseInt(CBuildString) - 10;
                } else
                    CBuild = Integer.parseInt(CBuildString);
            } else {
                CMinor = Integer.parseInt(CStrings[1]);
                if (CStrings.length > 2)
                    if (CStrings[2].contains("-")) {
                        CMaintenance = Integer.parseInt(CStrings[2].split(Pattern.quote("-"))[0]);
                        CBuildString = CStrings[2].split(Pattern.quote("-"))[1];
                        if (CBuildString.contains("b")) {
                            beta = true;
                            CBuildString = CBuildString.replace("b", "");
                            if (CBuildString != "")
                                CBuild = Integer.parseInt(CBuildString) - 1;
                        } else if (CBuildString.contains("a")) {
                            alpha = true;
                            CBuildString = CBuildString.replace("a", "");
                            if (CBuildString != "")
                                CBuild = Integer.parseInt(CBuildString) - 10;
                        } else
                            CBuild = Integer.parseInt(CBuildString);
                    } else
                        CMaintenance = Integer.parseInt(CStrings[2]);
            }

        String[] NStrings = newVersion.split(Pattern.quote("."));

        NMajor = Integer.parseInt(NStrings[0]);
        if (NStrings.length > 1)
            if (NStrings[1].contains("-")) {
                NMinor = Integer.parseInt(NStrings[1].split(Pattern.quote("-"))[0]);
                NBuildString = NStrings[1].split(Pattern.quote("-"))[1];
                if (NBuildString.contains("b")) {
                    beta = true;
                    NBuildString = NBuildString.replace("b", "");
                    if (NBuildString != "")
                        NBuild = Integer.parseInt(NBuildString) - 1;
                } else if (NBuildString.contains("a")) {
                    alpha = true;
                    NBuildString = NBuildString.replace("a", "");
                    if (NBuildString != "")
                        NBuild = Integer.parseInt(NBuildString) - 10;
                } else
                    NBuild = Integer.parseInt(NBuildString);
            } else {
                NMinor = Integer.parseInt(NStrings[1]);
                if (NStrings.length > 2)
                    if (NStrings[2].contains("-")) {
                        NMaintenance = Integer.parseInt(NStrings[2].split(Pattern.quote("-"))[0]);
                        NBuildString = NStrings[2].split(Pattern.quote("-"))[1];
                        if (NBuildString.contains("b")) {
                            beta = true;
                            NBuildString = NBuildString.replace("b", "");
                            if (NBuildString != "")
                                NBuild = Integer.parseInt(NBuildString) - 1;
                        } else if (NBuildString.contains("a")) {
                            alpha = true;
                            NBuildString = NBuildString.replace("a", "");
                            if (NBuildString != "")
                                NBuild = Integer.parseInt(NBuildString) - 10;
                        } else
                            NBuild = Integer.parseInt(NBuildString);
                    } else
                        NMaintenance = Integer.parseInt(NStrings[2]);
            }

        /**\\**/
        /**\\**//**\\**/
        /**\   CHECK VERSIONS   /**\
          /**\\**/
        /**\\**//**\\**/
        if ((CMajor < NMajor) || (CMajor == NMajor && CMinor < NMinor)
                || (CMajor == NMajor && CMinor == NMinor && CMaintenance < NMaintenance)
                || (CMajor == NMajor && CMinor == NMinor && CMaintenance == NMaintenance && CBuild < NBuild))
            result = UpdateResult.UPDATE_AVAILABLE;
        else
            result = UpdateResult.NO_UPDATE;
        return;
    } catch (Exception e) {
        console.sendMessage(" There was an issue attempting to check for the latest version.");
    }
    result = UpdateResult.ERROR;
}

From source file:com.ge.research.semtk.load.utility.ImportSpecHandler.java

/**
 * Populate the texts with the correct instances based on the importspec.
 * @throws Exception //  ww  w  .  j  a  v  a  2  s .com
 */
private void setupColumns() throws Exception {
    // get the texts, if any
    JSONArray colsInfo = (JSONArray) this.importspec.get("columns");
    if (colsInfo == null) {
        return;
    }

    for (int j = 0; j < colsInfo.size(); ++j) {
        JSONObject colsJson = (JSONObject) colsInfo.get(j);
        String colId = (String) colsJson.get("colId");
        String colName = ((String) colsJson.get("colName")).toLowerCase();
        this.colsAvailable.put(colId, colName);
    }
}