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:GenerateTwoPDFAndHTMLRTF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from w ww .j av  a2s  .  co m
        PdfWriter.getInstance(document, new FileOutputStream("AHrefForAWebsite.pdf"));
        HtmlWriter.getInstance(document, new FileOutputStream("AHrefForAWebsite.html"));
        RtfWriter2.getInstance(document, new FileOutputStream("AHrefForAWebsite.html"));

        document.open();

        Paragraph paragraph = new Paragraph("Please visit my ");
        Anchor anchor1 = new Anchor("website (external reference)",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)));
        anchor1.setReference("http://www.java2s.com");
        paragraph.add(anchor1);

        document.add(paragraph);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:AHrefForAWebsitePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {//from www  .  j a  v  a 2 s  .  co m
        PdfWriter.getInstance(document, new FileOutputStream("AHrefForAWebsitePDF.pdf"));
        HtmlWriter.getInstance(document, new FileOutputStream("AHrefForAWebsite.html"));

        document.open();

        Paragraph paragraph = new Paragraph("Please visit my ");
        Anchor anchor1 = new Anchor("website (external reference)",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)));
        anchor1.setReference("http://www.java2s.com");
        paragraph.add(anchor1);

        document.add(paragraph);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:Main.java

public static void main(String[] args) {
    Connection conn = null;//from   w ww .ja  va 2s. c  om
    try {
        conn = getConnection("jdbc:mysql://localhost/empDB", "root", "pass");
    } catch (Exception ex) {
        System.out.println("SQLException: " + ex.getMessage());
    }
}

From source file:UsingFontFactoryPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  ww w. j a va2 s  .  c  o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("UsingFontFactoryPDF.pdf"));
        document.open();

        Paragraph p = new Paragraph("Font Families", FontFactory.getFont(FontFactory.HELVETICA, 16f));
        document.add(p);
        FontFactory.registerDirectories();
        TreeSet families = new TreeSet(FontFactory.getRegisteredFamilies());

        for (Iterator i = families.iterator(); i.hasNext();) {
            p = new Paragraph((String) i.next());
            document.add(p);
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }

    document.close();
}

From source file:NestedTablesWithoutPointPositionPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from w  ww  .  j a v  a 2  s. c  o  m*/
        PdfWriter.getInstance(document, new FileOutputStream("NestedTablesWithoutPointPositionPDF.pdf"));
        document.open();

        Table aTable = new Table(2, 2); // 4 rows, 4 columns
        aTable.setAutoFillEmptyCells(true);
        aTable.addCell("2.2");
        aTable.addCell("2.1");

        Table secondTable = new Table(2);
        secondTable.addCell("0.0");
        secondTable.addCell("0.1");
        aTable.insertTable(secondTable);

        aTable.addCell("2.2");

        document.add(aTable);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:netload.Application.java

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
    Logger log = Logger.getLogger(Application.class.getName());

    Scheduler s = new Scheduler();
    s.schedule("0 * * * *", () -> {
        try {/*www.  j a v  a  2 s.c  om*/
            new UpdateController().update();
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    });

    s.start();
    log.info("Scheduler and application started");
}

From source file:piazza.services.ingest.IngestServiceApplication.java

public static void main(String[] args) {

    ConfigurableApplicationContext context = SpringApplication.run(IngestServiceApplication.class, args); //NOSONAR
    //Controller cont = new Controller();
    try {/*from www  .ja v a  2  s . c om*/
        context.getBean(Controller.class).init();
        //cont.init();
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}

From source file:TableCellBorderColorPDF.java

public static void main(String[] args) {
    Document.compress = false;/*from w ww  .jav  a  2  s . c o m*/
    Document document = new Document();
    try {
        PdfWriter.getInstance(document, new FileOutputStream("TableCellBorderColorPDF.pdf"));

        document.open();

        PdfPTable table = new PdfPTable(3);
        PdfPCell cell = new PdfPCell();
        cell.addElement(new Chunk("cell "));
        cell.setBorderColor(new Color(0xFF, 0x00, 0x00));

        table.addCell("a cell");
        table.addCell(cell);
        table.addCell("a cell");

        document.add(table);
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    document.close();
}

From source file:OutlineWithStylePDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from  www.j  a  va  2  s  .  c  om*/
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("OutlineWithStylePDF.pdf"));
        writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
        document.open();
        document.add(new Paragraph("Outline action example"));

        PdfContentByte cb = writer.getDirectContent();
        PdfOutline root = cb.getRootOutline();
        PdfOutline links = new PdfOutline(root, new PdfAction("http://www.java2s.com"), "Useful links");
        links.setColor(new Color(0xFF, 0x00, 0x00));
        links.setStyle(Font.BOLD);

    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}

From source file:SubSupScriptPDF.java

public static void main(String[] args) {
    Document document = new Document();
    try {/*from   ww  w  .  j ava 2 s .  c  o m*/
        PdfWriter.getInstance(document, new FileOutputStream("SubSupScriptPDF.pdf"));
        document.open();
        String s = "Text Text Text Text Text Text Text Text Text Text Text Text Text Text ";
        StringTokenizer st = new StringTokenizer(s, " ");
        float textrise = 6.0f;
        Chunk c;
        while (st.hasMoreTokens()) {
            c = new Chunk(st.nextToken());
            c.setTextRise(textrise);
            c.setUnderline(new Color(0xC0, 0xC0, 0xC0), 0.2f, 0.0f, 0.0f, 0.0f, PdfContentByte.LINE_CAP_BUTT);
            document.add(c);
            textrise -= 2.0f;
        }
    } catch (Exception ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();
}