Example usage for javax.xml.registry RegistryException initCause

List of usage examples for javax.xml.registry RegistryException initCause

Introduction

In this page you can find the example usage for javax.xml.registry RegistryException initCause.

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:it.cnr.icar.eric.server.interfaces.soap.RegistryBSTServlet.java

private RepositoryItem processIncomingAttachment(AttachmentPart ap) throws RegistryException {
    RepositoryItem ri = null;//ww w . j  av  a  2 s . c  o  m

    try {
        //ContentId is the id of the repositoryItem
        String id = WSS4JSecurityUtilBST.convertContentIdToUUID(ap.getContentId());
        if (log.isInfoEnabled()) {
            log.info(ServerResourceBundle.getInstance().getString("message.ProcessingAttachmentWithContentId",
                    new Object[] { id }));
        }

        if (log.isDebugEnabled()) {
            log.debug("Processing attachment (RepositoryItem):\n" + ap.getContent().toString());
        }

        DataHandler dh = ap.getDataHandler();
        ri = new RepositoryItemImpl(id, dh);
    } catch (SOAPException e) {
        RegistryException toThrow = new RegistryException(e);
        toThrow.initCause(e);
        throw toThrow;
    }

    return ri;
}

From source file:it.cnr.icar.eric.server.interfaces.soap.RegistrySAMLServlet.java

/**
 * This method is a copy of the respective method from RegistrySOAPServlet.
 *///from   ww  w. j av  a 2s  . c o m

private RepositoryItem processIncomingAttachment(AttachmentPart ap) throws RegistryException {

    RepositoryItem ri = null;
    try {
        // ContentId is the id of the repositoryItem
        String id = WSS4JSecurityUtilSAML.convertContentIdToUUID(ap.getContentId());
        if (log.isInfoEnabled()) {
            log.info(ServerResourceBundle.getInstance().getString("message.ProcessingAttachmentWithContentId",
                    new Object[] { id }));
        }

        if (log.isDebugEnabled()) {
            log.debug("Processing attachment (RepositoryItem):\n" + ap.getContent().toString());
        }

        DataHandler dh = ap.getDataHandler();
        ri = new RepositoryItemImpl(id, dh);

    } catch (SOAPException e) {

        RegistryException toThrow = new RegistryException(e);
        toThrow.initCause(e);
        throw toThrow;

    }

    return ri;
}