protected StatementBase( ModelCom model ) { if (model == null) throw new JenaException( "Statement models must no be null" ); this.model = model; }
protected void mustRename( File from, File to ) { if (from.renameTo( to ) == false) throw new JenaException( "could not rename " + from + " to " + to ); }
protected IStream(Reader in) { try { this.in = in; eof = (in.read(thisChar, 0, 1) == -1); } catch (IOException e) { throw new JenaException(e); } }
private int parseInt( String digits ) { try { return Integer.parseInt( digits );} catch (NumberFormatException e) { throw new JenaException( "checkOrdinal fails on " + digits, e ); } }
public LocatorZip(String zfn) { try { zipFileName = zfn ; zipFile = new ZipFile(zipFileName) ; } catch (IOException ex) { throw new JenaException("Problems accessing "+zfn, ex) ; } }
public LocatorZip(String zfn) { try { zipFileName = zfn ; zipFile = new ZipFile(zipFileName) ; } catch (IOException ex) { throw new JenaException("Problems accessing "+zipFileName, ex) ; } }
public void print(String s) { try { writer.write(s); column += s.length() ; } catch (java.io.IOException ex) { throw new JenaException(ex) ; } }
/** Throw an exception if <code>uri</code> doesn't start with "java:", otherwise answer the string beyond the ":". */ private static String mustBeJava( String uri ) { // TODO replace JenaException if (uri.startsWith( "java:" )) return uri.substring( 5 ); throw new JenaException( "class name URI must start with 'java:': " + uri ); } }
public void println(String s) { try { writer.write(s); println() ; } catch (java.io.IOException ex) { throw new JenaException(ex) ; } }
private static Boolean getBooleanValue( Object propValue, Boolean theDefault ) { if (propValue == null) return theDefault; else if (propValue instanceof Boolean) return (Boolean) propValue; else if (propValue instanceof String) return stringToBoolean( (String) propValue, theDefault ); else throw new JenaException( "cannot treat as boolean: " + propValue ); }
private static Class<?> loadClassNamedBy( Statement s ) { try { return Class.forName( getString( s ) ); } catch (Exception e) { throw new JenaException( e ); } }
public void println() { try { writer.write(lineSeparator); writer.flush() ; column = 0 ; row++ ; padTo() ; } catch (java.io.IOException ex) { throw new JenaException(ex) ; } }
@Override public void fatalError(Exception e) { if (!silent) logger.error(ParseException.formatMessage(e)); throw e instanceof RuntimeException ? (RuntimeException) e : new JenaException( e ); } }
/** Answer the OntModelSpec described using the Jena Assembler vocabulary properties of <code>root</code>. If the assembled resource is not an OntModelSpec, throw an exception reporting the constructed class. */ public static OntModelSpec assemble( Resource root ) { Object assembled = Assembler.general.open( root ); if (!(assembled instanceof OntModelSpec)) throw new JenaException( "assemble: expected an OntModelSpec, but got a " + assembled.getClass().getName() ); return (OntModelSpec) assembled; }
/** We object strongly to null labels: for example, they make .equals flaky. */ public static Node create( NodeMaker maker, Object label ) { if (label == null) throw new JenaException( "Node.make: null label" ); return maker.construct( label ) ; }
private static void establish( AssemblerGroup group, Resource type, Object x ) { if (x instanceof Assembler) group.implementWith( type, (Assembler) x ); else throw new JenaException( "constructed entity is not an Assembler: " + x ); }
@Override public void begin() { if (inTransaction) throw new JenaException( "nested transactions not supported" ); else { checkPointFile = new File( checkPointName( fileGraph.name ) ); checkPointFile.deleteOnExit(); fileGraph.saveContents( checkPointFile ); inTransaction = true; } }
@Override @Deprecated public Resource getResource(String uri, ResourceF f) { try { return f.createResource(getResource(uri)); } catch (Exception e) { throw new JenaException(e); } }
protected final String target(Node name) { if ( !name.isURI() ) throw new JenaException("Not a URI: " + name) ; String guri = name.getURI() ; // Encode guri = IRILib.encodeUriComponent(guri) ; return remote + "?" + HttpNames.paramGraph + "=" + guri ; }
@Override public void add(Quad quad) { Graph g = fetchGraph(quad.getGraph()) ; if ( g == null ) throw new JenaException("No such graph: "+quad.getGraph()) ; g.add(quad.asTriple()) ; }