use of org.apache.jena.riot.system.ErrorHandler in project jena by apache.
the class TestTriXBad method trix_bad.
@Test(expected = RiotException.class)
public void trix_bad() {
ErrorHandler err = ErrorHandlerFactory.getDefaultErrorHandler();
try {
ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerSimple());
InputStream in = IO.openFile(fInput);
StreamRDF sink = StreamRDFLib.sinkNull();
RDFParser.source(in).lang(Lang.TRIX).parse(sink);
} finally {
ErrorHandlerFactory.setDefaultErrorHandler(err);
}
}
use of org.apache.jena.riot.system.ErrorHandler in project jena by apache.
the class TestReadData method load_18.
// Load quads into graph - warning on named graphs
@Test
public void load_18() {
ErrorHandler err = ErrorHandlerFactory.getDefaultErrorHandler();
try {
ErrorHandlerFactory.setDefaultErrorHandler(new ErrorHandlerTestLib.ErrorHandlerEx());
try {
Graph g = RDFDataMgr.loadGraph(filename("D.trig"));
fail("No expection generated");
} catch (ErrorHandlerTestLib.ExWarning e) {
}
ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerNoLogging);
Graph g = RDFDataMgr.loadGraph(filename("D.trig"));
assertFalse(g.isEmpty());
assertEquals(1, g.size());
} finally {
ErrorHandlerFactory.setDefaultErrorHandler(err);
}
}
use of org.apache.jena.riot.system.ErrorHandler in project jena by apache.
the class BaseTest2 method unsetTestLogging.
public static void unsetTestLogging() {
if (errorHandlers.size() == 0) {
Log.warn(BaseTest.class, "ErrorHandler not set for testing");
// Panic measures
ErrorHandlerFactory.setDefaultErrorHandler(ErrorHandlerFactory.errorHandlerStd);
return;
}
ErrorHandler errHandler = errorHandlers.pop();
ErrorHandlerFactory.setDefaultErrorHandler(errHandler);
}
use of org.apache.jena.riot.system.ErrorHandler in project jena by apache.
the class ActionSPARQL method parse.
public static void parse(HttpAction action, StreamRDF dest, InputStream input, Lang lang, String base) {
try {
if (!RDFParserRegistry.isRegistered(lang))
ServletOps.errorBadRequest("No parser for language '" + lang.getName() + "'");
ErrorHandler errorHandler = ErrorHandlerFactory.errorHandlerStd(action.log);
RDFParser.create().errorHandler(errorHandler).source(input).lang(lang).base(base).parse(dest);
} catch (RiotException ex) {
ServletOps.errorBadRequest("Parse error: " + ex.getMessage());
}
}
Aggregations