Example usage for org.w3c.dom.ls LSException LSException

List of usage examples for org.w3c.dom.ls LSException LSException

Introduction

In this page you can find the example usage for org.w3c.dom.ls LSException LSException.

Prototype

public LSException(short code, String message) 

Source Link

Usage

From source file:org.apache.cocoon.components.validation.jaxp.JaxpResolver.java

/**
 * <p>Resolve a resource into a {@link LSInput} from the provided location
 * information.</p>/*from  w ww.  j  a  va  2s  . c  o  m*/
 * 
 * <p>This method will obtain a {@link InputSource} instance invoking the
 * {@link ValidationResolver#resolveEntity(String, String, String)} method
 * return it wrapped in a {@link JaxpInput} instance.</p>
 *
 * @param type the type of the resource being resolved.
 * @param namespace the namespace of the resource being resolved.
 * @param systemId the system identifier of the resource being resolved.
 * @param publicId the public identifier of the resource being resolved.
 * @param base the base uri against wich relative resolution should happen. 
 * @return a <b>non null</b> {@link LSInput} instance.
 * @throws LSException wrapping another {@link Exception}.
 */
public LSInput resolveResource(String type, String namespace, String systemId, String publicId, String base)
        throws LSException {
    try {
        final InputSource source = this.resolveEntity(base, publicId, systemId);
        return new JaxpInput(source);
    } catch (Exception exception) {
        String message = "Exception resolving resource " + systemId;
        Throwable err = new LSException(DOMError.SEVERITY_FATAL_ERROR, message);
        throw new NestableRuntimeException(message, err);
    }
}