Example usage for java.lang Exception getMessage

List of usage examples for java.lang Exception getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:dm.gen.DmGenerator.java

public static void main(String[] args) {
    try {/*  w w  w . j a  v a 2s .com*/
        DmGenerator dmGenerator = new DmGenerator();

        // *** Modelibra ***

        // *** 1. Generate all ***
        // dmGenerator.getDmModelibraGenerator().generate();

        // *** 2. Generate new with preserving specific ***
        // dmGenerator.getDmModelibraGenerator().generateModelibraGenClasses();
        // OR
        // *** All for an additional model
        // dmGenerator.getDmModelibraGenerator().generateDomainGenClass();
        // dmGenerator.getDmModelibraGenerator().generateModel("NewModel");
        // OR
        // *** Model changes
        // dmGenerator.getDmModelibraGenerator()
        // .generateModelGenClass("Model");
        // dmGenerator.getDmModelibraGenerator().generateConceptGenClasses(
        // "Model", "UpdatedConcept");
        // dmGenerator.getDmModelibraGenerator().generateConceptGenClasses(
        // "Model", "NewConceptNeighbor");
        // dmGenerator.getDmModelibraGenerator().generateConceptClasses(
        // "Model", "NewEntryConcept");
        // dmGenerator.getDmModelibraGenerator().generateConceptClasses(
        // "Model", "NewConcept");
        // dmGenerator.getDmModelibraGenerator()
        // .generateEntryConceptEmptyXmlDataFile("Model",
        // "NewEntryConcept");

        // *** Optional: If done, be sure to have a backup of
        // specific-domain-config.xml ***
        // dmGenerator.getDmModelibraGenerator()
        // .generateSpecificDomainConfig();

        // *** 3. Generate what you do not want by using comments ***
        // dmGenerator.getDmModelibraGenerator().generateModelibraPartially();

        // *** ModelibraSwing ***

        // *** 1. Generate all ***
        dmGenerator.getDmModelibraSwingGenerator().generate();
    } catch (Exception e) {
        log.error("Error in DmGenerator.main: " + e.getMessage());
    }
}

From source file:DataLoader.java

public static void main(String[] args)
        throws IOException, ValidationException, LicenseException, JobExecutionAlreadyRunningException,
        JobRestartException, JobInstanceAlreadyCompleteException, JobParametersInvalidException {

    System.out.println(/*from ww w.j av  a2  s . c o m*/
            "System is initialising. Please wait for a few seconds then type your queries below once you see the prompt (->)");

    C24.init().withLicence("/biz/c24/api/license-ads.dat");

    // Create our application context - assumes the Spring configuration is in the classpath in a file called spring-config.xml
    ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");

    // ========================================================================
    // DEMO
    // A simple command-line interface to allow us to query the GemFire regions
    // ========================================================================

    GemfireTemplate template = context.getBean(GemfireTemplate.class);

    BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));

    boolean writePrompt = true;

    try {
        while (true) {
            if (writePrompt) {
                System.out.print("-> ");
                System.out.flush();
                writePrompt = false;
            }
            if (br.ready()) {
                try {

                    String request = br.readLine();
                    System.out.println("Running: " + request);
                    SelectResults<Object> results = template.find(request);
                    System.out.println();
                    System.out.println("Result:");
                    for (Object result : results.asList()) {
                        System.out.println(result.toString());
                    }
                } catch (Exception ex) {
                    System.out.println("Error executing last command " + ex.getMessage());
                    //ex.printStackTrace();
                }

                writePrompt = true;

            } else {
                // Wait for a second and try again
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ioEx) {
                    break;
                }
            }
        }
    } catch (IOException ioe) {
        // Write any exceptions to stderr
        System.err.print(ioe);
    }

}

From source file:com.apexxs.neonblack.setup.Setup.java

public static void main(String[] args) {
    Configuration config = Configuration.getInstance();
    SolrLoader solrLoader = null;// www .j a  v  a2s . c o  m
    int count = 0;

    SolrUtilities solrUtilities = new SolrUtilities();
    if (!solrUtilities.checkCoreStatus("geonames")) {
        logger.error("Unable to establish connection to geonames core - Application terminated");
        System.exit(-1);
    }

    if (!solrUtilities.checkCoreStatus("geodata")) {
        logger.error("Unable to establish connection to geodata core - Application terminated");
        System.exit(-1);
    }

    logger.warn("Solr geonames and geodata indices will be cleared...");
    SolrUtilities sutil = new SolrUtilities();
    //        sutil.clearSolrIndices();

    long startTime = System.currentTimeMillis();

    try {
        SolrServerFactory solrServerFactory = new SolrServerFactory();
        SolrServer server = solrServerFactory.getConcurrentSolrServer("geonames");

        //            GeoNamesLoader geoNamesLoader = new GeoNamesLoader();
        //            System.out.println("***Loading Geonames gazetteer***");
        //            count = geoNamesLoader.load(server);
        //            System.out.println("Committing and optimizing Geonames index....");
        //            server.commit();
        //            server.optimize();
        //
        //            System.out.println("Geonames index complete - inserted " + count + " documents.");

        server = solrServerFactory.getHTTPServer("geodata");
        if (StringUtils.equalsIgnoreCase(config.getPolygonType(), "gadm")) {
            System.out.println("***Loading GADM Border polygons***");
            solrLoader = new GADMBorderLoader();
            count = solrLoader.load(server);
        } else if (StringUtils.equalsIgnoreCase(config.getPolygonType(), "ne")) {
            System.out.println("***Loading Natural Earth Border polygons***");
            solrLoader = new NaturalEarthLoader();
            count = solrLoader.load(server);
        } else {
            System.out.println("***Loading Thematicmapping polygons***");
            solrLoader = new TMBorderLoader();
            count = solrLoader.load(server);
            solrLoader = new StateBorderLoader();
            count += solrLoader.load(server);
        }
        System.out.println("Committing and optimizing Geodata index....");
        server.commit();
        server.optimize();
        server.shutdown();
        System.out.println("***Loaded " + count + " polygons***");
    } catch (Exception ex) {
        logger.error("Error loading SOLR indices - " + ex.getMessage());
    }

    long endTime = System.currentTimeMillis();
    System.out.println("***Solr Index load complete***");
    System.out.println("Elapsed time: " + (endTime - startTime) / 60000 + " minutes");
}

From source file:math2605.gn_qua.java

/**
 * @param args the command line arguments
 *///from  w  ww  . ja va  2 s  .  c o  m
public static void main(String[] args) {
    //get file name
    System.out.println("Please enter a file name:");
    Scanner scanner = new Scanner(System.in);
    String fileName = scanner.nextLine();
    List<String[]> pairs = new ArrayList<>();
    //get coordinate pairs and add to arraylist
    try {
        BufferedReader br = new BufferedReader(new FileReader(fileName));
        String line;
        while ((line = br.readLine()) != null) {
            String[] pair = line.split(",");
            pairs.add(pair);
        }
        br.close();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

    System.out.println("Please enter the value of a:");
    double a = scanner.nextInt();
    System.out.println("Please enter the value of b:");
    double b = scanner.nextInt();
    System.out.println("Please enter the value of c:");
    double c = scanner.nextInt();
    //init B, vector with 3 coordinates
    RealMatrix B = new Array2DRowRealMatrix(3, 1);
    B.setEntry(0, 0, a);
    B.setEntry(1, 0, b);
    B.setEntry(2, 0, c);

    System.out.println("Please enter the number of iteration for the Gauss-newton:");
    //init N, number of iterations
    int N = scanner.nextInt();

    //init r, vector of residuals
    RealMatrix r = new Array2DRowRealMatrix(pairs.size(), 1);
    setR(pairs, a, b, c, r);

    //init J, Jacobian of r
    RealMatrix J = new Array2DRowRealMatrix(pairs.size(), 3);
    setJ(pairs, a, b, c, r, J);

    System.out.println("J");
    System.out.println(J);
    System.out.println("r");
    System.out.println(r);

    RealMatrix sub = findQR(J, r);

    for (int i = N; i > 0; i--) {
        B = B.subtract(sub);
        double B0 = B.getEntry(0, 0);
        double B1 = B.getEntry(1, 0);
        double B2 = B.getEntry(2, 0);
        //CHANGE ABC TO USE B0, B1, B2
        setR(pairs, B0, B1, B2, r);
        setJ(pairs, B0, B1, B2, r, J);
    }
    System.out.println("B");
    System.out.println(B.toString());
}

From source file:com.sketchy.server.HttpServer.java

public static void main(String[] args) throws Exception {
    try {/*  w w  w  .j  ava  2 s.c om*/
        SketchyContext.load(SKETCHY_PROPERTY_FILE);
    } catch (Exception e) {
        System.out.println("Error Loading Sketchy Property file! " + e.getMessage());
    }
    HttpServer server = new HttpServer();
    server.start();
}

From source file:edu.harvard.med.iccbl.screensaver.io.libraries.CreateLibraryWells.java

@SuppressWarnings("static-access")
public static void main(String[] args) {
    final CommandLineApplication app = new CommandLineApplication(args);
    app.addCommandLineOption(OptionBuilder.hasArgs().isRequired().withArgName("short name")
            .withLongOpt("short-name").withDescription("a short name for identifying the library").create("l"));

    app.processOptions(true, false);/*from w w w.j  a  v  a  2  s.co  m*/

    final GenericEntityDAO dao = (GenericEntityDAO) app.getSpringBean("genericEntityDao");
    dao.doInTransaction(new DAOTransaction() {

        @Override
        public void runTransaction() {
            try {
                LibraryCreator libraryCreator = (LibraryCreator) app.getSpringBean("libraryCreator");
                List<String> libraryShortNames = app.getCommandLineOptionValues("l");
                for (String libraryShortName : libraryShortNames) {
                    libraryCreator.createWells(
                            dao.findEntityByProperty(Library.class, "shortName", libraryShortName));
                }
            } catch (Exception e) {
                e.printStackTrace();
                log.error(e.toString());
                System.err.println("error: " + e.getMessage());
                System.exit(1);
            }
        }

    });
}

From source file:medcheck.Medcheck.java

/**
 * @param args the command line arguments
 *//*from  ww  w  . j a va  2 s.  com*/
public static void main(String[] args) {
    String jsonFileLocation = "meddata.json";
    File jsonTxt = new File(jsonFileLocation);

    String xmlFileLocation = "XML Files";
    File xmlDirectory = new File(xmlFileLocation);

    String jsonString = getJSONString(jsonTxt);

    PrintWriter csvWriter;
    try {
        csvWriter = new PrintWriter("meddata.csv", "UTF-8");
    } catch (Exception e) {
        System.out.println("ERROR: " + e.getMessage());
        e.printStackTrace();
        return;
    }

    Drug[] csvArray = convertToDrugArrayFromJSON(jsonString);
    Drug[] xmlArray = convertToDrugArrayFromXML(xmlDirectory);
    String csvString = convertToCsvString(csvArray, xmlArray);
    csvWriter.print(csvString);
    csvWriter.close();
}

From source file:com.genentech.struchk.OEMDLPercieveChecker.java

public static void main(String[] args) throws ParseException, JDOMException, IOException {
    // create command line Options object
    Options options = new Options();
    Option opt = new Option("i", true, "input file [.ism,.sdf,...]");
    opt.setRequired(true);/*from  w ww.j a v a 2 s  .  c  o m*/
    options.addOption(opt);

    opt = new Option("o", true, "output file");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("d", false, "debug: wait for user to press key at startup.");
    opt.setRequired(false);
    options.addOption(opt);

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;
    try {
        cmd = parser.parse(options, args);
    } catch (Exception e) {
        System.err.println(e.getMessage());
        exitWithHelp(options);
    }
    args = cmd.getArgs();

    if (cmd.hasOption("d")) {
        System.err.println("Start debugger and press return:");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }

    if (args.length != 0) {
        exitWithHelp(options);
    }

    String inFile = cmd.getOptionValue("i");
    String outFile = cmd.getOptionValue("o");

    OEMDLPercieveChecker checker = null;
    try {
        checker = new OEMDLPercieveChecker();

        oemolostream out = new oemolostream(outFile);
        oemolistream in = new oemolistream(inFile);

        OEGraphMol mol = new OEGraphMol();
        while (oechem.OEReadMolecule(in, mol)) {
            if (!checker.checkMol(mol))
                oechem.OEWriteMolecule(out, mol);
        }
        checker.delete();
        in.close();
        in.delete();

        out.close();
        out.delete();

    } catch (Exception e) {
        throw new Error(e);
    }
    System.err.println("Done:");
}

From source file:com.github.brosander.java.performance.sampler.analysis.PerformanceSampleAnalyzer.java

public static void main(String[] args) {
    Options options = new Options();
    options.addOption("i", FILE_OPT, true, "The file to analyze.");
    options.addOption("o", OUTPUT_FILE_OPT, true, "The output file (default json to stdout).");
    options.addOption("p", RELEVANT_PATTERN_OPT, true,
            "Pattern(s) to include as roots in the output (default: " + DEFAULT_PATTERN + ")");
    CommandLineParser parser = new DefaultParser();
    try {/*from  www .  j a  va  2s  .  co m*/
        CommandLine commandLine = parser.parse(options, args);
        String file = commandLine.getOptionValue(FILE_OPT);
        if (StringUtils.isEmpty(file)) {
            printUsageAndExit("Must specify file", options, 1);
        }
        Pattern relevantPattern = Pattern
                .compile(commandLine.getOptionValue(RELEVANT_PATTERN_OPT, DEFAULT_PATTERN));
        PerformanceSampleElement performanceSampleElement = relevantElements(relevantPattern,
                new ObjectMapper().readValue(new File(file), PerformanceSampleElement.class));
        updateCounts(performanceSampleElement);
        String outputFile = commandLine.getOptionValue(OUTPUT_FILE_OPT);
        if (StringUtils.isEmpty(outputFile)) {
            new ObjectMapper().writerWithDefaultPrettyPrinter().writeValue(System.out,
                    new OutputPerformanceSampleElement(performanceSampleElement));
        } else {
            new ObjectMapper().writerWithDefaultPrettyPrinter().writeValue(new File(outputFile),
                    new OutputPerformanceSampleElement(performanceSampleElement));
        }
    } catch (Exception e) {
        e.printStackTrace();
        printUsageAndExit(e.getMessage(), options, 2);
    }
}

From source file:net.palette_software.pet.restart.Main.java

public static void main(String[] args) {
    //if true, help will shown
    boolean need_help = true;

    //fast&dirty cli implementation
    CommandLineParser parser = new GnuParser();
    Options options = new Options();

    //create the command line options
    CliControl.createCommandLineOptions(options);

    try {/*from   w ww  .j ava2s  .c o m*/

        // parse the command line arguments
        CommandLine line = parser.parse(options, args);

        //Turn simulation on if the simulation cli flag is set.
        CliControl.useCommandLineOptionSimulation(line);

        if (CliControl.isSimulation()) {
            HelperLogger.loggerStdOut.info("Running simulation.");
        }

        //check if tabsvc is running
        if (HelperWindowsTask.isTabsvcRunning()) {

            HelperLogger.loggerStdOut.info("tabsvc.exe not ruinning...");

        } else {

            //Turn force-restart on if the force cli flag is set.
            CliControl.useCommandLineOptionForce(line);

            //change tabsvc config dir if it has been set in command line.
            CliControl.useCommandLineOptionTabsvcConfigDir(line);

            //change tableau installation dir if it has been set in command line.
            CliControl.useCommandLineOptionTableauInstallationDir(line);

            //change force restart timeout if it has been set in command line.
            CliControl.useCommandLineOptionForceRestartTimeout(line);

            //change JMX polling timeout if it has been set in command line.
            CliControl.useCommandLineOptionJmxPollingTime(line);

            //change wait time between pet-restart operations if it has been set in command line.
            CliControl.useCommandLineOptionWait(line);

            //change wait time after something went wrong if it has been set in command line.
            CliControl.useCommandLineOptionWaitErrors(line);

            need_help = CliControl.runCliControlledTasks(line);
        }

        //Show CLI help if it is needed
        CliControl.showCommandLineHelp(need_help, options, line);

    } catch (Exception e) {
        //e.printStackTrace();
        HelperLogger.loggerStdOut.info(e.getMessage());
        HelperLogger.loggerFile.fatal("fatal:", e);
    }
}