Example usage for java.lang Exception getLocalizedMessage

List of usage examples for java.lang Exception getLocalizedMessage

Introduction

In this page you can find the example usage for java.lang Exception getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:com.kylinolap.job.hadoop.dict.CreateInvertedIndexDictionaryJob.java

@Override
public int run(String[] args) throws Exception {
    Options options = new Options();

    try {/*  w ww  .j  a  va2  s  .com*/
        options.addOption(OPTION_CUBE_NAME);
        options.addOption(OPTION_INPUT_PATH);
        parseOptions(options, args);

        String cubeName = getOptionValue(OPTION_CUBE_NAME);
        String factColumnsInputPath = getOptionValue(OPTION_INPUT_PATH);
        KylinConfig config = KylinConfig.getInstanceFromEnv();

        CubeManager mgr = CubeManager.getInstance(config);
        CubeInstance cube = mgr.getCube(cubeName);
        if (cube == null || cube.isInvertedIndex() == false)
            throw new IllegalArgumentException("No Inverted Index Cube found by name " + cubeName);

        mgr.buildInvertedIndexDictionary(cube.getFirstSegment(), factColumnsInputPath);
        return 0;
    } catch (Exception e) {
        printUsage(options);
        e.printStackTrace(System.err);
        log.error(e.getLocalizedMessage(), e);
        return 2;
    }
}

From source file:org.openmrs.module.providermanagement.fragment.controller.SupervisionSuggestionFormFragmentController.java

public FragmentActionResult retireSupervisionSuggestion(
        @RequestParam(value = "supervisionSuggestion", required = true) SupervisionSuggestion supervisionSuggestion) {

    try {/*ww w .  j a  va2  s .c o  m*/
        Context.getService(ProviderSuggestionService.class).retireSupervisionSuggestion(supervisionSuggestion,
                "retired via provider management ui");
        return new SuccessResult();
    } catch (Exception e) {
        return new FailureResult(e.getLocalizedMessage());
    }
}

From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderRoleFormFragmentController.java

public FragmentActionResult saveProviderRole(@BindParams() ProviderRole providerRole) {

    try {//w ww.j av  a2  s  .com
        Context.getService(ProviderManagementService.class).saveProviderRole(providerRole);
        return new SuccessResult();
    } catch (Exception e) {
        return new FailureResult(e.getLocalizedMessage());
    }
}

From source file:com.amalto.core.save.generator.InMemoryAutoIncrementGenerator.java

@Override
public synchronized void init() {
    CONFIGURATION = new Properties();
    try {/* ww  w.j  a  v a2 s.  c  om*/
        ItemPOJOPK pk = new ItemPOJOPK(DC, AUTO_INCREMENT, IDS);
        ItemPOJO itempojo = ItemPOJO.load(pk);
        if (itempojo == null) {
            LOGGER.info("Could not load configuration from database, use default configuration.");
        } else {
            String xml = itempojo.getProjectionAsString();
            if (StringUtils.isNotBlank(xml)) {
                CONFIGURATION = Util.convertAutoIncrement(xml);
            }
        }
    } catch (Exception e) {
        LOGGER.error(e.getLocalizedMessage(), e);
    }
}

From source file:com.kylinolap.rest.service.AdminService.java

public void cleanupStorage() {
    StorageCleanupJob job = new StorageCleanupJob();
    String[] args = new String[] { "-delete", "true" };
    try {//ww  w. j  a  v  a 2 s .c o  m
        ToolRunner.run(job, args);
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException(e);
    }
}

From source file:org.openmrs.module.providermanagement.fragment.controller.SupervisionSuggestionFormFragmentController.java

public FragmentActionResult saveSupervisionSuggestion(@BindParams() SupervisionSuggestion suggestion) {

    // TODO: (PROV-12) add validation to check to make sure criteria is valid Groovy code

    // hard code the evaluator to the groovy evaluator since this is the only type we currently support
    suggestion.setEvaluator("org.openmrs.module.providermanagement.suggestion.GroovySuggestionEvaluator");

    try {//  ww w  . ja v  a  2s . c  o  m
        Context.getService(ProviderSuggestionService.class).saveSupervisionSuggestion(suggestion);
        return new SuccessResult();
    } catch (Exception e) {
        return new FailureResult(e.getLocalizedMessage());
    }
}

From source file:com.kylinolap.job.hadoop.invertedindex.IICreateHFileJob.java

public int run(String[] args) throws Exception {
    Options options = new Options();

    try {// ww w .  j a v  a 2 s  .  c o m
        options.addOption(OPTION_JOB_NAME);
        options.addOption(OPTION_CUBE_NAME);
        options.addOption(OPTION_INPUT_PATH);
        options.addOption(OPTION_OUTPUT_PATH);
        options.addOption(OPTION_HTABLE_NAME);
        parseOptions(options, args);

        Path output = new Path(getOptionValue(OPTION_OUTPUT_PATH));

        job = Job.getInstance(getConf(), getOptionValue(OPTION_JOB_NAME));

        File JarFile = new File(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
        if (JarFile.exists()) {
            job.setJar(KylinConfig.getInstanceFromEnv().getKylinJobJarPath());
        } else {
            job.setJarByClass(this.getClass());
        }

        addInputDirs(getOptionValue(OPTION_INPUT_PATH), job);
        FileOutputFormat.setOutputPath(job, output);

        job.setInputFormatClass(SequenceFileInputFormat.class);
        job.setMapperClass(IICreateHFileMapper.class);
        job.setMapOutputKeyClass(ImmutableBytesWritable.class);
        job.setMapOutputValueClass(KeyValue.class);

        String tableName = getOptionValue(OPTION_HTABLE_NAME);
        HTable htable = new HTable(getConf(), tableName);
        HFileOutputFormat.configureIncrementalLoad(job, htable);

        this.deletePath(job.getConfiguration(), output);

        return waitForCompletion(job);
    } catch (Exception e) {
        printUsage(options);
        log.error(e.getLocalizedMessage(), e);
        return 2;
    }
}

From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderRoleFormFragmentController.java

public FragmentActionResult deleteProviderRole(
        @RequestParam(value = "providerRoleId", required = true) Integer providerRoleId) {

    ProviderManagementService providerManagementService = Context.getService(ProviderManagementService.class);

    try {//from  www.  ja va 2 s  . com
        providerManagementService.purgeProviderRole(providerManagementService.getProviderRole(providerRoleId));
        return new SuccessResult();
    } catch (Exception e) {
        return new FailureResult(e.getLocalizedMessage());
    }
}

From source file:com.amalto.core.save.generator.InMemoryAutoIncrementGenerator.java

@Override
public void saveState(XmlServer server) {
    if (NEED_TO_SAVE.getAndSet(false)) {
        try {//from  w w  w .j a v a2 s  .  c o  m
            String xmlString = Util.convertAutoIncrement(CONFIGURATION);
            ItemPOJO pojo = new ItemPOJO(DC, // cluster
                    AUTO_INCREMENT, // concept name
                    IDS, System.currentTimeMillis(), // insertion time
                    xmlString // actual data
            );
            pojo.setDataModelName(XSystemObjects.DM_CONF.getName());
            pojo.store();
        } catch (Exception e) {
            LOGGER.error(e.getLocalizedMessage(), e);
        }
    }
}

From source file:org.openmrs.module.providermanagement.fragment.controller.ProviderRoleFormFragmentController.java

public FragmentActionResult retireProviderRole(
        @RequestParam(value = "providerRoleId", required = true) Integer providerRoleId) {

    ProviderManagementService providerManagementService = Context.getService(ProviderManagementService.class);

    try {/*from  w w w  .jav  a2 s .c  o  m*/
        providerManagementService.retireProviderRole(providerManagementService.getProviderRole(providerRoleId),
                "retired via provider management ui");
        return new SuccessResult();
    } catch (Exception e) {
        return new FailureResult(e.getLocalizedMessage());
    }
}