Example usage for javax.xml.crypto URIReferenceException URIReferenceException

List of usage examples for javax.xml.crypto URIReferenceException URIReferenceException

Introduction

In this page you can find the example usage for javax.xml.crypto URIReferenceException URIReferenceException.

Prototype

public URIReferenceException(Throwable cause) 

Source Link

Document

Constructs a new URIReferenceException with the specified cause and a detail message of (cause==null ?

Usage

From source file:be.fedict.eid.applet.service.signer.asic.ASiCURIDereferencer.java

public Data dereference(URIReference uriReference, XMLCryptoContext context) throws URIReferenceException {
    if (null == uriReference) {
        throw new URIReferenceException("URIReference cannot be null");
    }//from   w  w w .  j  av  a2 s.com
    if (null == context) {
        throw new URIReferenceException("XMLCrytoContext cannot be null");
    }

    String uri = uriReference.getURI();
    try {
        uri = URLDecoder.decode(uri, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        LOG.warn("could not URL decode the uri: " + uri);
    }
    LOG.debug("dereference: " + uri);

    InputStream zipInputStream;
    if (null != this.tmpFile) {
        try {
            zipInputStream = new FileInputStream(this.tmpFile);
        } catch (FileNotFoundException e) {
            throw new URIReferenceException("file not found error: " + e.getMessage(), e);
        }
    } else {
        zipInputStream = new ByteArrayInputStream(this.data);
    }
    InputStream dataInputStream;
    try {
        dataInputStream = ODFUtil.findDataInputStream(zipInputStream, uri);
    } catch (IOException e) {
        throw new URIReferenceException("I/O error: " + e.getMessage(), e);
    }
    if (null == dataInputStream) {
        return this.baseUriDereferener.dereference(uriReference, context);
    }
    return new OctetStreamData(dataInputStream, uri, null);
}