use of org.apache.jena.shared.JenaException in project jena by apache.
the class HttpQuery method exec.
/**
* Execute the operation
*
* @return Model The resulting model
* @throws QueryExceptionHTTP
*/
public InputStream exec() throws QueryExceptionHTTP {
// Select the appropriate HttpClient to use
HttpClientContext hcc = HttpClientContext.adapt(getContext());
RequestConfig.Builder builder = RequestConfig.copy(hcc.getRequestConfig());
contextualizeCompressionSettings(builder);
contextualizeTimeoutSettings(builder);
hcc.setRequestConfig(builder.build());
try {
if (usesPOST())
return execPost();
return execGet();
} catch (QueryExceptionHTTP httpEx) {
log.trace("Exception in exec", httpEx);
throw httpEx;
} catch (JenaException jEx) {
log.trace("JenaException in exec", jEx);
throw jEx;
}
}
use of org.apache.jena.shared.JenaException in project jena by apache.
the class DOM2Model method load.
/**
* Parse a DOM Node with the RDF/XML parser, loading the triples into the
* associated Model. Known not to work with Java 1.4.1.
*
* @param document
*/
public void load(Node document) {
Source input = new DOMSource(document);
// Make a SAXResult object using this handler
SAXResult output = new SAXResult(this);
output.setLexicalHandler(this);
// Run transform
TransformerFactory xformFactory = TransformerFactory.newInstance();
try {
Transformer idTransform = xformFactory.newTransformer();
idTransform.transform(input, output);
} catch (FatalParsingErrorException e) {
// Old code ignored this,
// given difficult bug report, don't be silent.
logger.error("Unexpected exception in DOM2Model", e);
} catch (RuntimeException rte) {
throw rte;
} catch (Exception nrte) {
throw new JenaException(nrte);
} finally {
close();
}
}
use of org.apache.jena.shared.JenaException in project jena by apache.
the class JenaHandler method statement.
@Override
public void statement(AResource subj, AResource pred, ALiteral lit) {
try {
Triple t = JenaReader.convert(subj, pred, lit);
graph.add(t);
} catch (JenaException e) {
errorHandler.error(e);
}
}
use of org.apache.jena.shared.JenaException in project jena by apache.
the class JenaReader method read.
private synchronized void read(final Graph g, InputSource inputS, String xmlBase, Model m) {
try {
g.getEventManager().notifyEvent(g, GraphEvents.startRead);
inputS.setSystemId(xmlBase);
handler = new JenaHandler(g, m, errorHandler);
handler.useWith(arpf.getHandlers());
arpf.parse(inputS, xmlBase);
} catch (IOException e) {
throw new WrappedIOException(e);
} catch (SAXException e) {
throw new JenaException(e);
} finally {
g.getEventManager().notifyEvent(g, GraphEvents.finishRead);
handler = null;
}
}
use of org.apache.jena.shared.JenaException in project jena by apache.
the class Unparser method error.
/*
* Unexpected error.
*/
private void error(String msg) {
JenaException e = new BrokenException("Internal error in Unparser: " + msg);
this.prettyWriter.fatalError(e);
// Just in case.
throw e;
}
Aggregations