Example usage for java.lang NumberFormatException getMessage

List of usage examples for java.lang NumberFormatException getMessage

Introduction

In this page you can find the example usage for java.lang NumberFormatException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.ephesoft.dcma.da.common.UpgradePatchPreparation.java

private static void createPatch(String pluginId, String pluginConfigId, BatchClassService batchClassService) {
    try {//w w  w  .j ava2  s. c o m
        Plugin plugin = pluginService.getPluginPropertiesForPluginId(Long.valueOf(pluginId));
        ArrayList<BatchClassPluginConfig> newPluginConfigs = pluginNameVsBatchPluginConfigList
                .get(plugin.getPluginName());
        if (newPluginConfigs == null) {
            newPluginConfigs = new ArrayList<BatchClassPluginConfig>();
            pluginNameVsBatchPluginConfigList.put(plugin.getPluginName(), newPluginConfigs);
        }
        int plgId = Integer.parseInt(pluginId);
        int plgConfId = Integer.parseInt(pluginConfigId);
        boolean bcpcFound = false;
        BatchClassPluginConfig createdBatchClassPluginConfig = null;
        List<BatchClass> batchClasses = batchClassService.getAllLoadedBatchClassExcludeDeleted();
        for (BatchClass batchClass : batchClasses) {
            BatchClass loadedBatchClass = batchClassService
                    .getLoadedBatchClassByIdentifier(batchClass.getIdentifier());
            List<BatchClassModule> batchClassModules = loadedBatchClass.getBatchClassModules();
            for (BatchClassModule bcm : batchClassModules) {
                List<BatchClassPlugin> batchClassPlugins = bcm.getBatchClassPlugins();
                for (BatchClassPlugin bcp : batchClassPlugins) {
                    if (bcp.getPlugin().getId() == plgId) {
                        List<BatchClassPluginConfig> batchClassPluginConfigs = bcp.getBatchClassPluginConfigs();
                        bcpcFound = false;
                        for (BatchClassPluginConfig bcpc : batchClassPluginConfigs) {
                            if (bcpc.getId() == plgConfId) {
                                createdBatchClassPluginConfig = bcpc;
                                bcpcFound = true;
                                break;
                            }
                        }

                        if (bcpcFound) {
                            createdBatchClassPluginConfig.setId(0);
                            createdBatchClassPluginConfig.setBatchClassPlugin(null);
                            newPluginConfigs.add(createdBatchClassPluginConfig);
                            ArrayList<KVPageProcess> newKVPageProcess = new ArrayList<KVPageProcess>();
                            for (KVPageProcess kv : createdBatchClassPluginConfig.getKvPageProcesses()) {
                                kv.setId(0);
                                kv.setBatchClassPluginConfig(null);
                                newKVPageProcess.add(kv);
                            }
                            createdBatchClassPluginConfig.setKvPageProcesses(newKVPageProcess);
                        }
                    }
                }
            }
        }

    } catch (NumberFormatException e) {
        LOG.error("Plugin Id and Plugin Config Id should be numeric." + e.getMessage(), e);
    }

}

From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java

public static ArrayList<String> loadStringData(InputStream stream) {
    ArrayList<String> mlist = new ArrayList<String>(150);
    int line = 0;

    try {/*w w w  . j  ava2s  .  com*/
        InputStreamReader is = new InputStreamReader(stream);
        BufferedReader in = new BufferedReader(is);
        CSVReader csv = new CSVReader(in, ';', '\"', 0);
        String data[];

        while ((data = csv.readNext()) != null) {
            line++;
            mlist.add(data[1]);
        }

        in.close();

    } catch (IOException ioe) {
        Log.e("Read CSV Error mypapit", "Some CSV Error: ", ioe.getCause());

    } catch (NumberFormatException nfe) {
        Log.e("Number error", "parse number error - line: " + line + "  " + nfe.getMessage(), nfe.getCause());
    } catch (Exception ex) {
        Log.e("Some Exception", "some exception at line :" + line + " \n " + ex.getCause());
        ex.printStackTrace(System.err);
    }
    // Collections.sort(mlist);

    return mlist;

}

From source file:controllers.api.v1.Dataset.java

public static Result getPagedDatasetColumnComments(int datasetId, int columnId) {
    ObjectNode result = Json.newObject();

    String username = session("user");
    if (username == null) {
        username = "";
    }//  ww  w .j  ava  2s  .c o  m

    int page = 1;
    String pageStr = request().getQueryString("page");
    if (StringUtils.isBlank(pageStr)) {
        page = 1;
    } else {
        try {
            page = Integer.parseInt(pageStr);
        } catch (NumberFormatException e) {
            Logger.error(
                    "Dataset Controller getPagedDatasetColumnComments wrong page parameter. Error message: "
                            + e.getMessage());
            page = 1;
        }
    }

    int size = 10;
    String sizeStr = request().getQueryString("size");
    if (StringUtils.isBlank(sizeStr)) {
        size = 10;
    } else {
        try {
            size = Integer.parseInt(sizeStr);
        } catch (NumberFormatException e) {
            Logger.error(
                    "Dataset Controller getPagedDatasetColumnComments wrong size parameter. Error message: "
                            + e.getMessage());
            size = 10;
        }
    }

    result.put("status", "ok");
    result.set("data", DatasetsDAO.getPagedDatasetColumnComments(username, datasetId, columnId, page, size));
    return ok(result);
}

From source file:org.openmrs.module.webservices.rest.web.RestUtil.java

/**
 * Looks up the admin defined global property for the system limit
 * // w  ww.j a v  a2s .  c o m
 * @return Integer limit
 * @see #getLimit(WebRequest)
 * @see RestConstants#MAX_RESULTS_DEFAULT_GLOBAL_PROPERTY_NAME
 */
public static Integer getDefaultLimit() {
    String limit = Context.getAdministrationService()
            .getGlobalProperty(RestConstants.MAX_RESULTS_DEFAULT_GLOBAL_PROPERTY_NAME);
    if (StringUtils.isNotEmpty(limit)) {
        try {
            return Integer.parseInt(limit);
        } catch (NumberFormatException nfex) {
            log.error(RestConstants.MAX_RESULTS_DEFAULT_GLOBAL_PROPERTY_NAME + " must be an integer. "
                    + nfex.getMessage());
            return RestConstants.MAX_RESULTS_DEFAULT;
        }
    } else {
        return RestConstants.MAX_RESULTS_DEFAULT;
    }
}

From source file:net.mypapit.mobile.myrepeater.RepeaterListActivity.java

public static RepeaterList loadData(int resource, Activity activity) {
    RepeaterList mlist = new RepeaterList(150);
    int line = 0;
    try {//  w w w.  j  a  v  a 2  s.c  o m

        InputStreamReader is = new InputStreamReader(activity.getResources().openRawResource(resource));
        BufferedReader in = new BufferedReader(is);
        CSVReader csv = new CSVReader(in, ';', '\"', 0);
        String data[];

        while ((data = csv.readNext()) != null) {
            line++;
            mlist.add(new Repeater("", data[1], data[2], data[3], data[9], Double.parseDouble(data[4]),
                    Double.parseDouble(data[5]), Double.parseDouble(data[6]), Double.parseDouble(data[7]),
                    Double.parseDouble(data[8])));

        }

        in.close();

    } catch (IOException ioe) {
        Log.e("Read CSV Error mypapit", "Some CSV Error: ", ioe.getCause());

    } catch (NumberFormatException nfe) {
        Log.e("Number error", "parse number error - line: " + line + "  " + nfe.getMessage(), nfe.getCause());
    } catch (Exception ex) {
        Log.e("Some Exception", "some exception at line :" + line + " \n " + ex.getCause());
        ex.printStackTrace(System.err);
    }

    return mlist;

}

From source file:org.openmrs.module.webservices.rest.web.RestUtil.java

/**
 * Looks up the admin defined global property for the absolute limit to results of REST calls
 * //from   w  w  w.ja v a  2s . c  o m
 * @return Integer limit
 * @see #getLimit(WebRequest)
 * @see RestConstants#MAX_RESULTS_ABSOLUTE_GLOBAL_PROPERTY_NAME
 */
public static Integer getAbsoluteLimit() {
    String limit = Context.getAdministrationService()
            .getGlobalProperty(RestConstants.MAX_RESULTS_ABSOLUTE_GLOBAL_PROPERTY_NAME);
    if (StringUtils.isNotEmpty(limit)) {
        try {
            return Integer.parseInt(limit);
        } catch (NumberFormatException nfex) {
            log.error(RestConstants.MAX_RESULTS_ABSOLUTE_GLOBAL_PROPERTY_NAME + " must be an integer. "
                    + nfex.getMessage());
            return RestConstants.MAX_RESULTS_ABSOLUTE;
        }
    } else {
        return RestConstants.MAX_RESULTS_ABSOLUTE;
    }
}

From source file:cryptohelper.data.CalcolatoreCesare.java

@Override
public Mappatura calcola(String chiave) {
    int key = 0;//from   ww  w  . j a  va2  s. c  o  m
    try {
        key = Integer.parseInt(chiave);
    } catch (NumberFormatException e) {
        log.fatal(e.getMessage());
    }
    Mappatura map = new Mappatura();
    char[] mappaInversa = new char[26];
    for (int i = 0; i < 26; i++) {
        mappaInversa[i] = map.getChar((i + key) % 26);
    }
    map.setMappaInversa(mappaInversa);
    return map;
}

From source file:de.berlios.jhelpdesk.web.taglib.AuthorizeTag.java

public void setRequiredRole(String role) {
    try {/*from w w  w.  j  av a 2  s  .c  o m*/
        this.userRole = Role.fromInt(Integer.parseInt(role));
    } catch (NumberFormatException nfe) {
        log.error(nfe.getMessage());
        throw new RuntimeException(nfe);
    }
}

From source file:ru.retbansk.utils.scheduled.ScheduleChanger.java

/**
 * Scheduled task with fixed delay - 3 seconds
 * @see ru.retbansk.utils.scheduled.DynamicSchedule#setDelay(int)
 *///from   w ww . j a  va  2s .co  m
@Scheduled(fixedDelay = 3000)
public void change() {
    try {
        dynamicSchedule
                .setDelay(Integer.valueOf(UsefulMethods.loadProperties().getProperty("schedule")).intValue());
    } catch (NumberFormatException e) {
        logger.error(e.getMessage());
    } catch (Exception e) {
        logger.error(e.getMessage());
    }

}

From source file:com.project.atm.http.util.HttpExecutor.java

public HttpExecutor(ThreadPoolTaskExecutor taskExecutor) {
    this.taskExecutor = taskExecutor;

    String httpThread = ResourceHelper.getAppResource("httpThread");
    if (httpThread.isEmpty() || httpThread.equals("")) {
        taskExecutor.setCorePoolSize(Runtime.getRuntime().availableProcessors() / 2);
    } else {//  ww  w.j a va  2  s .  com
        try {
            taskExecutor.setCorePoolSize(Integer.parseInt(httpThread));
        } catch (NumberFormatException nfe) {
            logger.error(nfe.getMessage() + ", set to default configuration");
            taskExecutor.setCorePoolSize(Runtime.getRuntime().availableProcessors() / 2);
        }
    }
}