Search in sources :

Example 51 with JenaException

use of org.apache.jena.shared.JenaException in project jena by apache.

the class N3IndentedWriter method println.

public void println(String s) {
    try {
        writer.write(s);
        println();
    } catch (java.io.IOException ex) {
        throw new JenaException(ex);
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) java.io(java.io)

Example 52 with JenaException

use of org.apache.jena.shared.JenaException in project jena by apache.

the class ExceptionTests method testDefaultDemotedFatal.

public void testDefaultDemotedFatal() {
    RDFDefaultErrorHandler.silent = true;
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setProperty("ERR_SAX_FATAL_ERROR", "EM_ERROR");
        rdr.read(m, "file:testing/arp/error-msgs/test06.rdf");
    } catch (JenaException e) {
        System.err.println(e.getMessage());
        e.printStackTrace();
        fail("Demoted.error error threw an exception");
    } finally {
        RDFDefaultErrorHandler.silent = false;
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 53 with JenaException

use of org.apache.jena.shared.JenaException in project jena by apache.

the class ExceptionTests method testDefaultPromotedWarning.

public void testDefaultPromotedWarning() {
    RDFDefaultErrorHandler.silent = true;
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setProperty("WARN_BAD_NAME", "EM_FATAL");
        rdr.read(m, "file:testing/arp/qname-in-ID/bug74_0.rdf");
        fail("Promoted warning did not throw exception");
    } catch (JenaException e) {
    } finally {
        RDFDefaultErrorHandler.silent = false;
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Example 54 with JenaException

use of org.apache.jena.shared.JenaException in project jena by apache.

the class ExceptionTests method testDefaultFatal.

public void testDefaultFatal() {
    //E301
    RDFDefaultErrorHandler.silent = true;
    try {
        Model m = ModelFactory.createDefaultModel();
        m.read("file:testing/arp/error-msgs/test06.rdf");
        fail("Fatal error did not throw exception");
    } catch (JenaException e) {
    } finally {
        RDFDefaultErrorHandler.silent = false;
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model)

Example 55 with JenaException

use of org.apache.jena.shared.JenaException in project jena by apache.

the class ExceptionTests method testNonExceptionFatal.

public void testNonExceptionFatal() {
    try {
        Model m = ModelFactory.createDefaultModel();
        RDFReader rdr = m.getReader();
        rdr.setErrorHandler(this);
        rdr.read(m, "file:testing/arp/error-msgs/test06.rdf");
    } catch (JenaException e) {
        fail("Fatal error threw an exception with non-exception handler");
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) Model(org.apache.jena.rdf.model.Model) RDFReader(org.apache.jena.rdf.model.RDFReader)

Aggregations

JenaException (org.apache.jena.shared.JenaException)70 Model (org.apache.jena.rdf.model.Model)12 RDFReader (org.apache.jena.rdf.model.RDFReader)8 IOException (java.io.IOException)7 QueryException (org.apache.jena.query.QueryException)5 QueryParseException (org.apache.jena.query.QueryParseException)5 java.io (java.io)4 InputStream (java.io.InputStream)4 Reader (java.io.Reader)4 StringReader (java.io.StringReader)4 Graph (org.apache.jena.graph.Graph)4 ServletOutputStream (javax.servlet.ServletOutputStream)3 CmdException (jena.cmd.CmdException)3 AmbiguousSpecificTypeException (org.apache.jena.assembler.exceptions.AmbiguousSpecificTypeException)3 MediaType (org.apache.jena.atlas.web.MediaType)3 Triple (org.apache.jena.graph.Triple)3 BadDescriptionMultipleRootsException (org.apache.jena.shared.BadDescriptionMultipleRootsException)3 BadDescriptionNoRootException (org.apache.jena.shared.BadDescriptionNoRootException)3 ARQParser (org.apache.jena.sparql.lang.arq.ARQParser)3 FileNotFoundException (java.io.FileNotFoundException)2