Example usage for java.lang Integer getInteger

List of usage examples for java.lang Integer getInteger

Introduction

In this page you can find the example usage for java.lang Integer getInteger.

Prototype

public static Integer getInteger(String nm) 

Source Link

Document

Determines the integer value of the system property with the specified name.

Usage

From source file:com.mark.test.framework.core.service.impl.CreateAccountImpl.java

private IomRequest generateIomRequest(CreateAccDto createAccDto) {
    String serialno = CommUtils.getRandomNo("sn");
    String customerid = CommUtils.getRandomNo("cu");
    String cardId = CommUtils.getRandomNo("ca");
    String addressId = CommUtils.getRandomNo("ad");
    String TelId = CommUtils.getRandomNo("tel");
    String ContactId = CommUtils.getRandomNo("ct");
    String today = CommUtils.getNowDate(5);

    IomReqApplicationDomain iomReqApplicationDomain = new IomReqApplicationDomain();
    IomCustomerInfoDomain iomCustomerInfoDomain = new IomCustomerInfoDomain();
    IomCardInfoDomain iomCardInfoDomain = new IomCardInfoDomain();
    IomAddressDomain iomAddressDomain = new IomAddressDomain();
    IomTelInfoDomain iomTelInfoDomain = new IomTelInfoDomain();
    IomContactInfoDomain iomContactInfoDomain = new IomContactInfoDomain();

    iomReqApplicationDomain.setInDate(today);
    iomReqApplicationDomain.setSerialno(serialno);
    iomReqApplicationDomain.setCustId(customerid);
    iomReqApplicationDomain.setTerm((short) createAccDto.getTerm());
    iomReqApplicationDomain.setApplDate(today);
    iomReqApplicationDomain.setContractAmt(new BigDecimal(10000));
    iomReqApplicationDomain.setLoanDate(today);
    iomReqApplicationDomain.setLoanAmt(new BigDecimal(9000));
    iomReqApplicationDomain.setPrincipal(new BigDecimal(10000));
    iomReqApplicationDomain.setFee01(new BigDecimal(1000));
    iomReqApplicationDomain.setFee02(new BigDecimal(0));
    iomReqApplicationDomain.setFee03(new BigDecimal(0));
    iomReqApplicationDomain.setGpsFee(new BigDecimal(0));
    iomReqApplicationDomain.setAssessFee(new BigDecimal(0));
    iomReqApplicationDomain.setViolateDeposit(new BigDecimal(0));
    iomReqApplicationDomain.setConsultFee(new BigDecimal(0));
    iomReqApplicationDomain.setDeposits(new BigDecimal(0));
    iomReqApplicationDomain.setLoanPenalty(new BigDecimal(0));
    iomReqApplicationDomain.setOtFee01(new BigDecimal(0));
    iomReqApplicationDomain.setOtFee02(new BigDecimal(0));
    iomReqApplicationDomain.setOtFee03(new BigDecimal(0));
    iomReqApplicationDomain.setOtFee04(new BigDecimal(0));
    iomReqApplicationDomain.setOtFee05(new BigDecimal(0));
    iomReqApplicationDomain.setIntRate(new BigDecimal(9));
    iomReqApplicationDomain.setPenaltyIntRate(new BigDecimal(0.15).setScale(2, RoundingMode.HALF_UP));
    iomReqApplicationDomain.setGraceDays((short) 1);
    iomReqApplicationDomain.setMaxPutoutDays("3");
    iomReqApplicationDomain.setRepayMethod("RPT000010");
    iomReqApplicationDomain.setMethodFlag("0");
    iomReqApplicationDomain.setBusinessType("A0007");
    //      ? FK011  FK012
    iomReqApplicationDomain.setProductName("");
    iomReqApplicationDomain.setPayLoanBrh(createAccDto.getPayLoanBrh());
    iomReqApplicationDomain.setBusinessResource("1");
    iomReqApplicationDomain.setInputOrgId("2015072200000003");
    iomReqApplicationDomain.setProcFlg("0");
    iomReqApplicationDomain.setInputOrgName("");
    iomReqApplicationDomain.setContractOrgId("2015072200000003");
    iomReqApplicationDomain.setContractOrgName("");
    iomReqApplicationDomain.setOwnerOrgId("2015072200000003");
    iomReqApplicationDomain.setOwnerOrgName("");
    iomReqApplicationDomain.setPlatDamagesFee((Map) new HashMap().put("1", "1.5"));
    iomReqApplicationDomain.setInvestorDamagesFee((Map) new HashMap().put("1", "1.5"));
    iomReqApplicationDomain.setOtherFeesList((Map) new HashMap().put("businessRiskSum", ".00"));
    businessapplyList.add(iomReqApplicationDomain);

    iomCustomerInfoDomain.setInDate(today);
    iomCustomerInfoDomain.setCustId(customerid);
    iomCustomerInfoDomain.setName("");
    iomCustomerInfoDomain.setIdType("01");
    iomCustomerInfoDomain.setIdNum("51152619911214091X");
    iomCustomerInfoDomain.setSex("1");
    iomCustomerInfoDomain.setBirthday("1988/02/02");
    iomCustomerInfoDomain.setMarried("20");
    iomCustomerInfoDomain.setEdLevel("3");
    iomCustomerInfoDomain.setCaCompany("");
    iomCustomerInfoDomain.setCaType("40");
    iomCustomerInfoDomain.setCaIndustryType("G");
    iomCustomerInfoDomain.setCaDepartment("");
    iomCustomerInfoDomain.setCaDuty("");
    iomCustomerInfoDomain.setCaOfficialRank("10");
    iomCustomerInfoDomain.setCaEnterTime("1991/09/12");
    iomCustomerInfoDomain.setCaPayType("PT0002");
    iomCustomerInfoDomain.setCaPayDay("15");
    iomCustomerInfoDomain.setCaWage(new BigDecimal(30000));
    iomCustomerInfoDomain.setCompType("40");
    iomCustomerInfoDomain.setCompTimeFounded("2009/05/25");
    iomCustomerInfoDomain.setCompShareholdingRatio("100");
    iomCustomerInfoDomain.setCompPremisesType("???");
    iomCustomerInfoDomain.setCompEmployeeAmount(Integer.getInteger("20"));
    iomCustomerInfoDomain.setCompProfits(new BigDecimal("800000"));
    iomCustomerInfoDomain.setCarPrice(new BigDecimal("203800"));
    iomCustomerInfoDomain.setCarLicense("Q39815");
    iomCustomerInfoDomain.setHouseType("LS0004");
    iomCustomerInfoDomain.setHouseAddress("beijing");
    iomCustomerInfoDomain.setHouseHasLoan("1");
    iomCustomerInfoDomain.setHouseBuildingArea(new BigDecimal("86"));
    iomCustomerInfoDomain.setHouseBuyTime("2008/08/01");
    iomCustomerInfoDomain.setHousePrice(new BigDecimal("50"));
    iomCustomerInfoDomain.setMemo("?");
    customerList.add(iomCustomerInfoDomain);

    iomCardInfoDomain.setInDate(today);/*from w ww. j  a  v  a 2  s  .co  m*/
    iomCardInfoDomain.setCustId(customerid);
    iomCardInfoDomain.setCardId(cardId);
    iomCardInfoDomain.setCardNo("622908553566782415");
    iomCardInfoDomain.setAliasCode("3091000");
    iomCardInfoDomain.setAgmtType(Integer.valueOf("1"));
    iomCardInfoDomain.setTreatyNo("20160729558882");
    iomCardInfoDomain.setAgmtStartDate("20170501");
    iomCardInfoDomain.setAgmtEndDate("20180501");
    iomCardInfoDomain.setPayLoanBrh("0");
    bankcardList.add(iomCardInfoDomain);

    iomAddressDomain.setInDate(today);
    iomAddressDomain.setCustId(customerid);
    iomAddressDomain.setAddressId(addressId);
    iomAddressDomain.setObjectType("");
    iomAddressDomain.setAddressType("02");
    iomAddressDomain.setAddress("");
    iomAddressDomain.setValid("0");
    addressDomainList.add(iomAddressDomain);

    iomTelInfoDomain.setInDate(today);
    iomTelInfoDomain.setTelId(TelId);
    iomTelInfoDomain.setObjectType("?");
    iomTelInfoDomain.setObjectId(customerid);
    iomTelInfoDomain.setTelType("01");
    iomTelInfoDomain.setTel("18604722914");
    telephoneList.add(iomTelInfoDomain);

    iomContactInfoDomain.setInDate(today);
    iomContactInfoDomain.setCustId(customerid);
    iomContactInfoDomain.setContactId(ContactId);
    iomContactInfoDomain.setRelation("0503");
    iomContactInfoDomain.setName("1");
    contractList.add(iomContactInfoDomain);

    List<IomRepayPlanDomain> repayplanList = this.genRepayPlanList(serialno, today);

    IomRequest iomRequest = new IomRequest();
    iomRequest.setAddress(addressDomainList);
    iomRequest.setBusinessapply(businessapplyList);
    iomRequest.setCustomer(customerList);
    iomRequest.setBankcard(bankcardList);
    iomRequest.setTelephone(telephoneList);
    iomRequest.setRepayplan(repayplanList);
    iomRequest.setContract(contractList);

    return iomRequest;
}

From source file:com.gnadenheimer.mg3.utils.Utils.java

public void printFactura(TblFacturas factura) {
    try {/*from  ww w.jav  a 2 s  . com*/

        Map parameters = new HashMap();
        parameters.put("factura_id", factura.getNro());
        parameters.put("fechahora", java.sql.Date.valueOf(factura.getFechahora().toLocalDate()));
        parameters.put("razon_social", factura.getRazonSocial());
        parameters.put("ruc", factura.getRuc());
        parameters.put("domicilio", factura.getDomicilio());
        parameters.put("box",
                factura.getCasillaDeCorreo() == null ? "" : factura.getCasillaDeCorreo().toString());
        parameters.put("usuario", factura.getIdUser().getNombrecompleto());
        parameters.put("importe_aporte", factura.getImporteAporte());
        parameters.put("importe_donacion", factura.getImporteDonacion());

        parameters.put("logo", getClass().getResourceAsStream("/reports/cclogo200.png"));
        parameters.put("logo2", getClass().getResourceAsStream("/reports/cclogo200.png"));
        parameters.put("logo3", getClass().getResourceAsStream("/reports/cclogo200.png"));

        parameters.put(JRParameter.REPORT_LOCALE, Locale.forLanguageTag("es"));

        //JOptionPane.showMessageDialog(null, getClass().getResource("/reports/cclogo200.png").getPath());
        String reportFactura = Preferences.userRoot().node("MG").get("formatoFactura",
                "Preimpreso sin rejilla");
        if (reportFactura.equals("Preimpreso sin rejilla")) {
            reportFactura = "factura_con_rejilla";
        } else if (reportFactura.equals("Preimpreso con rejilla")) {
            reportFactura = "factura";
        } else if (reportFactura.equals("Preimpreso con rejilla modelo especial Bethel Theodor")) {
            reportFactura = "factura_bethel";
        }
        JasperReport report = JasperCompileManager
                .compileReport(getClass().getResourceAsStream("/reports/" + reportFactura + ".jrxml"));

        JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));

        //JasperViewer jReportsViewer = new JasperViewer(jasperPrint, false);
        //jReportsViewer.setVisible(true);
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));
        JasperPrintManager.printReport(jasperPrint, false);
    } catch (Exception ex) {
        App.showException(Thread.currentThread().getStackTrace()[1].getMethodName(), ex.getMessage(), ex);
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
    }
}

From source file:org.apache.hadoop.hive.metastore.MetaStoreServer.java

public static void main(String[] args) {
    int port = 9082;

    if (args.length > 0) {
        port = Integer.getInteger(args[0]);
    }/*  w  w  w.  j  a v  a  2  s . c  o  m*/
    try {
        TServerTransport serverTransport = new TServerSocket(port);
        Iface handler = new ThriftMetaStoreHandler("hello");
        FacebookService.Processor processor = new ThriftMetaStore.Processor(handler);

        TThreadPoolServer.Options options = new TThreadPoolServer.Options();
        options.minWorkerThreads = 100;
        TServer server = new TThreadPoolServer(processor, serverTransport, new TTransportFactory(),
                new TTransportFactory(), new TBinaryProtocol.Factory(), new TBinaryProtocol.Factory(), options);

        ThriftMetaStoreHandler.LOG.info("Starting the metaserver on port [" + port + "]...");

        server.serve();

    } catch (Exception x) {
        x.printStackTrace();
    }
}

From source file:org.dataone.proto.trove.mn.http.client.HttpExceptionHandler.java

private static ErrorElements deserializeXml(HttpResponse response) throws IllegalStateException, IOException //    throws NotFound, InvalidToken, ServiceFailure, NotAuthorized,
//    NotFound, IdentifierNotUnique, UnsupportedType,
//    InsufficientResources, InvalidSystemMetadata, NotImplemented,
//    InvalidCredentials, InvalidRequest, IOException {
{
    ErrorElements ee = new ErrorElements();

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    Document doc;// w  w  w  .  ja  va 2  s .c o m

    int httpCode = response.getStatusLine().getStatusCode();
    if (response.getEntity() != null) {
        BufferedInputStream bErrorStream = new BufferedInputStream(response.getEntity().getContent());
        bErrorStream.mark(5000); // good for resetting up to 5000 bytes

        String detailCode = null;
        String description = null;
        String name = null;
        int errorCode = -1;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(bErrorStream);
            Element root = doc.getDocumentElement();
            root.normalize();
            if (root.getNodeName().equalsIgnoreCase("error")) {
                if (root.hasAttribute("errorCode")) {
                    try {
                        errorCode = Integer.getInteger(root.getAttribute("errorCode"));
                    } catch (NumberFormatException nfe) {
                        System.out.println("errorCode unexpectedly not able to parse to int,"
                                + " using http status for creating exception");
                        errorCode = httpCode;
                    }
                }
                if (errorCode != httpCode) //            throw new ServiceFailure("1000","errorCode in message body doesn't match httpStatus");
                {
                    System.out.println("errorCode in message body doesn't match httpStatus,"
                            + " using errorCode for creating exception");
                }
                if (root.hasAttribute("detailCode")) {
                    detailCode = root.getAttribute("detailCode");
                } else {
                    detailCode = "detail code is Not Set!";
                }
                if (root.hasAttribute("name")) {
                    name = root.getAttribute("name");
                } else {
                    name = "Exception";
                }
                Node child = root.getFirstChild();
                do {
                    if (child.getNodeType() == Node.ELEMENT_NODE) {
                        if (child.getNodeName().equalsIgnoreCase("description")) {
                            Element element = (Element) child;
                            description = element.getTextContent();
                            break;
                        }
                    }
                } while ((child = child.getNextSibling()) != null);
            } else {
                description = domToString(doc);
                detailCode = "detail code was never Set!";
            }
        } catch (TransformerException e) {
            description = deserializeNonXMLErrorStream(bErrorStream, e);
        } catch (SAXException e) {
            description = deserializeNonXMLErrorStream(bErrorStream, e);
        } catch (IOException e) {
            description = deserializeNonXMLErrorStream(bErrorStream, e);
        } catch (ParserConfigurationException e) {
            description = deserializeNonXMLErrorStream(bErrorStream, e);
        }

        ee.setCode(errorCode);
        ee.setName(name);
        ee.setDetailCode(detailCode);
        ee.setDescription(description);
    }
    return ee;
}

From source file:com.gnadenheimer.mg.utils.Utils.java

public void printFactura(TblFacturas factura) {
    try {//w  ww .  ja  v  a 2 s .  c  o  m

        Map parameters = new HashMap();
        parameters.put("factura_id", factura.getNro());
        parameters.put("fechahora", java.sql.Date.valueOf(factura.getFechahora().toLocalDate()));
        parameters.put("razon_social", factura.getRazonSocial());
        parameters.put("ruc", factura.getRuc());
        parameters.put("domicilio", factura.getDomicilio());
        parameters.put("box",
                factura.getCasillaDeCorreo() == null ? "" : factura.getCasillaDeCorreo().toString());
        parameters.put("usuario", factura.getIdUser().getNombrecompleto());
        parameters.put("importe_aporte", factura.getImporteAporte());
        parameters.put("importe_donacion", factura.getImporteDonacion());

        parameters.put("logo", getClass().getResourceAsStream("/reports/cclogo200.png"));
        parameters.put("logo2", getClass().getResourceAsStream("/reports/cclogo200.png"));
        parameters.put("logo3", getClass().getResourceAsStream("/reports/cclogo200.png"));
        parameters.put("logo-bethel", getClass().getResourceAsStream("/images/logo-bethel.png"));
        parameters.put("logo-bethel2", getClass().getResourceAsStream("/images/logo-bethel.png"));
        parameters.put("logo-friesen", getClass().getResourceAsStream("/images/logo-friesen.png"));

        parameters.put(JRParameter.REPORT_LOCALE, Locale.forLanguageTag("es"));

        //JOptionPane.showMessageDialog(null, getClass().getResource("/reports/cclogo200.png").getPath());
        String reportFactura = Preferences.userRoot().node("MG").get("formatoFactura",
                "Preimpreso sin rejilla");
        if (reportFactura.equals("Preimpreso sin rejilla")) {
            reportFactura = "factura_con_rejilla";
        } else if (reportFactura.equals("Preimpreso sin rejilla - CREDITO")) {
            reportFactura = "factura_con_rejilla_credito";
        } else if (reportFactura.equals("Preimpreso con rejilla")) {
            reportFactura = "factura";
        } else if (reportFactura.equals("Preimpreso con rejilla modelo especial Bethel Theodor")) {
            reportFactura = "factura_bethel";
        } else if (reportFactura.equals("Preimpreso sin rejilla Bethel")) {
            reportFactura = "factura_con_rejilla_bethel_full";
        }
        JasperReport report = JasperCompileManager
                .compileReport(getClass().getResourceAsStream("/reports/" + reportFactura + ".jrxml"));

        JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));

        //JasperViewer jReportsViewer = new JasperViewer(jasperPrint, false);
        //jReportsViewer.setVisible(true);
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));
        JasperPrintManager.printReport(jasperPrint, false);
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(null,
                Thread.currentThread().getStackTrace()[1].getMethodName() + " - " + ex.getMessage());
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
    }
}

From source file:org.entermedia.email.PostMail.java

public int getPort() {
    if (fieldPort == null) {
        fieldPort = Integer.getInteger("mail.smtp.port");
        if (fieldPort == null) {
            fieldPort = new Integer(25);
        }/*from   www  . j a  va  2s  . c  o m*/
    }
    return fieldPort;
}

From source file:com.gnadenheimer.mg3.utils.Utils.java

public void printAutofactura(TblAutofacturas factura) {
    try {/*from   w w  w . ja v a  2 s .  c o  m*/

        Map parameters = new HashMap();
        parameters.put("factura_nro", factura.getNro());
        parameters.put("fechahora", java.sql.Date.valueOf(factura.getFechahora().toLocalDate()));
        parameters.put("nombre", factura.getNombre());
        parameters.put("ci", factura.getCi());
        parameters.put("domicilio", factura.getDomicilio());
        parameters.put("direccionDeTransaccion", factura.getDireccionDeTransaccion());
        parameters.put("cantidad", factura.getCantidad());
        parameters.put("concepto", factura.getConcepto());
        parameters.put("precioUnitario", factura.getPrecioUnitario());
        parameters.put("monto", factura.getMonto());
        parameters.put("usuario", factura.getIdUser().getNombrecompleto());

        String reportFactura = Preferences.userRoot().node("MG").get("formateFactura", "Preimpreso sin rejilla")
                .equals("Preimpreso sin rejilla") ? "autofactura_con_rejilla" : "autofactura";
        JasperReport report = JasperCompileManager
                .compileReport(getClass().getResourceAsStream("/reports/" + reportFactura + ".jrxml"));

        JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));

        //JasperViewer jReportsViewer = new JasperViewer(jasperPrint, false);
        //jReportsViewer.setVisible(true);
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));
        JasperPrintManager.printReport(jasperPrint, false);
    } catch (Exception ex) {
        App.showException(Thread.currentThread().getStackTrace()[1].getMethodName(), ex.getMessage(), ex);
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
    }
}

From source file:com.gnadenheimer.mg.utils.Utils.java

public void printAutofactura(TblAutofacturas factura) {
    try {/*from  w ww  .  j  ava  2s  . com*/

        Map parameters = new HashMap();
        parameters.put("factura_nro", factura.getNro());
        parameters.put("fechahora", java.sql.Date.valueOf(factura.getFechahora().toLocalDate()));
        parameters.put("nombre", factura.getNombre());
        parameters.put("ci", factura.getCi());
        parameters.put("domicilio", factura.getDomicilio());
        parameters.put("direccionDeTransaccion", factura.getDireccionDeTransaccion());
        parameters.put("cantidad", factura.getCantidad());
        parameters.put("concepto", factura.getConcepto());
        parameters.put("precioUnitario", factura.getPrecioUnitario());
        parameters.put("monto", factura.getMonto());
        parameters.put("usuario", factura.getIdUser().getNombrecompleto());

        String reportFactura = Preferences.userRoot().node("MG").get("formatoFactura",
                "Preimpreso sin rejilla");
        switch (reportFactura) {
        case "Preimpreso sin rejilla":
            reportFactura = "autofactura_con_rejilla";
            break;
        case "Preimpreso con rejilla":
            reportFactura = "autofactura";
            break;
        case "Preimpreso sin rejilla Bethel":
            reportFactura = "autofactura_con_rejilla_bethel";
            break;
        default:
            break;
        }

        JasperReport report = JasperCompileManager
                .compileReport(getClass().getResourceAsStream("/reports/" + reportFactura + ".jrxml"));

        JasperPrint jasperPrint = JasperFillManager.fillReport(report, parameters, new JREmptyDataSource());
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));

        //JasperViewer jReportsViewer = new JasperViewer(jasperPrint, false);
        //jReportsViewer.setVisible(true);
        jasperPrint.setLeftMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaLeftMargin", "0")));
        jasperPrint.setTopMargin(
                Integer.getInteger(Preferences.userRoot().node("MG").get("facturaTopMargin", "0")));
        JasperPrintManager.printReport(jasperPrint, false);
    } catch (Exception ex) {
        JOptionPane.showMessageDialog(null,
                Thread.currentThread().getStackTrace()[1].getMethodName() + " - " + ex.getMessage());
        LOGGER.error(Thread.currentThread().getStackTrace()[1].getMethodName(), ex);
    }
}

From source file:org.opennms.systemreport.AbstractSystemReportPlugin.java

private MBeanServerConnection getConnection() {
    final List<Integer> ports = new ArrayList<Integer>();
    Integer p = Integer.getInteger("com.sun.management.jmxremote.port");
    if (p != null)
        ports.add(p);/*  w  w w .j  a v a2 s. com*/
    ports.add(18980);
    ports.add(1099);
    for (final Integer port : ports) {
        LOG.trace("Trying JMX at localhost:{}/jmxrmi", port);
        try {
            JMXServiceURL url = new JMXServiceURL(
                    String.format("service:jmx:rmi:///jndi/rmi://localhost:%d/jmxrmi", port));
            JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
            return jmxc.getMBeanServerConnection();
        } catch (final Exception e) {
            LOG.debug("Unable to get JMX connection to OpenNMS on port {}.", port, e);
        }
    }
    return null;
}