Example usage for javax.xml.bind JAXBException getStackTrace

List of usage examples for javax.xml.bind JAXBException getStackTrace

Introduction

In this page you can find the example usage for javax.xml.bind JAXBException getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:org.springside.examples.oadata.service.TenderViewService.java

public Result synTenderProccess(TenderView tenderView) {

    boolean result = false;
    //??//from  w w w  .  j a v a  2 s.  co m
    StringWriter writer = new StringWriter();

    BodyXml<TenderView> bodyXml = new BodyXml<TenderView>();
    bodyXml.setProjectInfo(tenderView);
    ;
    SupplierXml supplierXml = new SupplierXml();
    supplierXml.setBody(bodyXml);
    try {
        marshaller.marshal(supplierXml, writer);
    } catch (JAXBException e) {
        logger.error("{}|{}XML?:" + e.getStackTrace(), tenderView.getTenderId(),
                tenderView.getTenderName());
    }
    try {
        HttpPost httpPost = new HttpPost(propertiesLoader.getProperty("syn.synSupplierUrl"));
        // ??/  
        List<NameValuePair> parameters = new ArrayList<NameValuePair>();

        String xmlContent = writer.toString();

        parameters.add(new BasicNameValuePair("xmlContent", xmlContent));
        // UrlEncodedFormEntity  
        UrlEncodedFormEntity formEntiry = new UrlEncodedFormEntity(parameters, "UTF-8");
        httpPost.setEntity(formEntiry);

        // ?connection poolclient
        CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
        closeableHttpResponse.getEntity().getContent();
        String xmlContentresp = IOUtils.toString(closeableHttpResponse.getEntity().getContent());
        if (xmlContentresp.contains("operTag")) {
            String operTag = StringUtils.substringBetween(xmlContentresp, "<operTag>", "</operTag>");
            String operDesc = StringUtils.substringBetween(xmlContentresp, "<operDesc>", "</operDesc>");
            if ("Y".equals(operTag)) {//?   
                result = true;
            } else {
                logger.error("?{}|{}??{}", tenderView.getTenderId(),
                        tenderView.getTenderName(), operDesc);
            }
        }
        closeableHttpResponse.close();
    } catch (IOException e) {
        e.printStackTrace();
        logger.error("?{}|{}??:" + e.getStackTrace(),
                tenderView.getTenderId(), tenderView.getTenderName());
    }
    return new Result(result, null);
}

From source file:org.springside.examples.quickstart.service.BulletinDataService.java

public boolean sysBulletinProccess(ProjectData projectData) {
    boolean result = false;

    BulletinData bulletinData = projectData.getBulletinDataSelected();

    //bulletinData 
    //bulletinData.setBulletinUrl("http://gxoa.cc/attachmentDownload.do?filePath="+bulletinData.getAttachmentPath()+"&amp;fileName="+bulletinData.getAttachmentName());

    //??/* www .  ja va  2  s.  c o m*/
    StringWriter writer = new StringWriter();

    BodyXml<BulletinData> bodyXml = new BodyXml<BulletinData>();
    bodyXml.setProjectInfo(bulletinData);
    BulletinXml bulletinXml = new BulletinXml();
    bulletinXml.setBody(bodyXml);

    try {
        marshaller.marshal(bulletinXml, writer);
    } catch (JAXBException e) {
        logger.error("{}|{}XML?:" + e.getStackTrace(), bulletinData.getId(),
                bulletinData.getAnnouncementDate());
    }
    try {

        HttpPost httpPost = new HttpPost(propertiesLoader.getProperty("syn.synBulletinUrl"));
        // ??/  
        List<NameValuePair> parameters = new ArrayList<NameValuePair>();

        parameters.add(new BasicNameValuePair("xmlContent", writer.toString()));
        // UrlEncodedFormEntity  
        UrlEncodedFormEntity formEntiry = new UrlEncodedFormEntity(parameters, "UTF-8");
        httpPost.setEntity(formEntiry);

        // ?connection poolclient
        CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
        closeableHttpResponse.getEntity().getContent();
        String xmlContentresp = IOUtils.toString(closeableHttpResponse.getEntity().getContent());
        if (xmlContentresp.contains("operTag")) {
            String operTag = StringUtils.substringBetween(xmlContentresp, "<operTag>", "</operTag>");
            if ("Y".equals(operTag)) {//?   
                //?? 
                bulletinData.setSynStatus(BulletinData.SYNSTATUS_SUCCESS);
                bulletinDataDao.save(bulletinData);
                //???
                projectData.setSynStatus(ProjectData.SYNSTATUS_BULLETIN_SUCCESS);
                projectDataDao.save(projectData);
                result = true;
            } else {
                logger.error("?{}|{}??", bulletinData.getId(),
                        bulletinData.getAnnouncementDate());
            }
        }
        closeableHttpResponse.close();
        //httpClient.close();
    } catch (IOException e) {
        e.printStackTrace();
        logger.error("?{}|{}??:" + e.getStackTrace(),
                bulletinData.getId(), bulletinData.getAnnouncementDate());
    }
    return result;
}

From source file:org.springside.examples.quickstart.service.BulletinDataService.java

/**
 * ????/*from www  . ja v a  2s .  com*/
 * @param ids
 */
public boolean synBulletin(Long[] ids) {
    //
    boolean result = false;
    List<Long> idls = new ArrayList<Long>();
    CollectionUtils.addAll(idls, ids);
    Iterable<BulletinData> bulletinDatas = bulletinDataDao.findAll(idls);
    for (BulletinData bulletinData : bulletinDatas) {

        //bulletinData
        //         bulletinData.setBulletinUrl("http://gxoa.cc/attachmentDownload.do?filePath="+bulletinData.getAttachmentPath()+"&amp;fileName="+bulletinData.getAttachmentId());

        //??
        StringWriter writer = new StringWriter();

        BodyXml<BulletinData> bodyXml = new BodyXml<BulletinData>();
        bodyXml.setProjectInfo(bulletinData);
        BulletinXml bulletinXml = new BulletinXml();
        bulletinXml.setBody(bodyXml);

        try {
            marshaller.marshal(bulletinXml, writer);
        } catch (JAXBException e) {
            logger.error("{}|{}XML?:" + e.getStackTrace(), bulletinData.getId(),
                    bulletinData.getAnnouncementDate());
        }
        try {

            HttpPost httpPost = new HttpPost(propertiesLoader.getProperty("syn.synBulletinUrl"));
            // ??/  
            List<NameValuePair> parameters = new ArrayList<NameValuePair>();

            parameters.add(new BasicNameValuePair("xmlContent", writer.toString()));
            // UrlEncodedFormEntity  
            UrlEncodedFormEntity formEntiry = new UrlEncodedFormEntity(parameters, "UTF-8");
            httpPost.setEntity(formEntiry);

            // ?connection poolclient
            CloseableHttpResponse closeableHttpResponse = httpClient.execute(httpPost);
            closeableHttpResponse.getEntity().getContent();
            String xmlContentresp = IOUtils.toString(closeableHttpResponse.getEntity().getContent());
            if (xmlContentresp.contains("operTag")) {
                String operTag = StringUtils.substringBetween(xmlContentresp, "<operTag>", "</operTag>");
                if ("Y".equals(operTag)) {//?   
                    //?? 
                    bulletinData.setSynStatus(BuyerData.SYNSTATUS_SUCCESS);
                    bulletinDataDao.save(bulletinData);
                    result = true;
                } else {

                    logger.error("?{}|{}??", bulletinData.getId(),
                            bulletinData.getAnnouncementDate());
                }
            }
            //httpClient.close();
        } catch (IOException e) {
            e.printStackTrace();
            logger.error("?{}|{}??:" + e.getStackTrace(),
                    bulletinData.getId(), bulletinData.getAnnouncementDate());
        }
    }
    return result;
}

From source file:at.ac.tuwien.dsg.comot.orchestrator.interraction.rsybl.rSYBLInterraction.java

public CompositionRulesConfiguration loadMetricCompositionRules(String serviceID, String path) {
    CompositionRulesConfiguration compositionRulesConfiguration = null;
    try {/*w ww.jav a 2 s .c o m*/
        JAXBContext a = JAXBContext.newInstance(CompositionRulesConfiguration.class);
        Unmarshaller u = a.createUnmarshaller();

        Object object = u.unmarshal(new FileReader(new File(path)));
        compositionRulesConfiguration = (CompositionRulesConfiguration) object;

    } catch (JAXBException e) {
        log.error(e.getStackTrace().toString());
    } catch (FileNotFoundException ex) {
        java.util.logging.Logger.getLogger(rSYBLInterraction.class.getName()).log(Level.SEVERE, null, ex);
    }
    compositionRulesConfiguration.setTargetServiceID(serviceID);

    return compositionRulesConfiguration;
}