Example usage for javax.xml.bind JAXBException JAXBException

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

Introduction

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

Prototype

public JAXBException(Throwable exception) 

Source Link

Document

Construct a JAXBException with a linkedException.

Usage

From source file:partes.refactorRunner.InteractionTreeBuilder.java

/**
 * @throws BPMNmalformedException /*from   w  w w  .j  a  va 2  s . co  m*/
 * @throws FileNotFoundException 
 * @throws JAXBException 
 * @see partes.refactorRunner.InteractionTreeBuilder#getTreesOfInteraction() getTreesOfInteraction()
 */
@Override
public HashMap<String, Tree> buildInteractionTrees(String bpmnFilePath)
        throws BPMNmalformedException, FileNotFoundException, JAXBException {
    bpmnFile = bpmnFilePath;
    List<JAXBElement<? extends TRootElement>> content = null;
    try {
        content = getContent();
    }
    /*!!!!!! TODO: IMPROVE ERROR HANDLING !!!!!*/
    catch (FileNotFoundException e) {
        throw new FileNotFoundException("[" + this.getClass().getName() + "] " + e);
    } catch (JAXBException e) {
        throw new JAXBException("[" + this.getClass().getName() + "] " + e);
    }

    choreography = new TChoreography();
    int contentNumber = 0;
    while (!(content.get(contentNumber).getValue() instanceof TChoreography)) {
        contentNumber++;
    }
    if (contentNumber < content.size()) { // Tchoreography found!

        choreography = (TChoreography) content.get(contentNumber).getValue();
        for (JAXBElement element : content) {
            if (element.getValue() instanceof TMessage) {
                TMessage message = (TMessage) element.getValue();
                messages.put(message.getId(), message);
            } else if (element.getValue() instanceof TItemDefinition) {
                TItemDefinition item = (TItemDefinition) element.getValue();
                items.put(item.getId(), item);
            }
        }

        System.out.println("================ " + choreography.getName() + " ================ ");
        new File(PartesConf.getString("outputPath")).mkdirs();
        long startTime = System.currentTimeMillis();
        log.info("start");
        log.info("running... ");
        log.info("outputPath is " + PartesConf.getString("outputPath"));
        HashMap<String, Tree> treesOfAllConditions = getTreesOfInteraction();
        long endTime = System.currentTimeMillis();
        Log log = LogFactory.getLog(InteractionTreeBuilder.class);
        log.info("total time: " + (endTime - startTime) + " ms");
        log.info("end");
        return treesOfAllConditions;
    } else {
        throw new BPMNmalformedException("Tchoreography not found in: " + bpmnFilePath);
    }
}