protected StatementBase( ModelCom model ) { if (model == null) throw new JenaException( "Statement models must no be null" ); this.model = model; }
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 "+zipFileName, ex) ; } }
protected IStream(Reader in) { try { this.in = in; eof = (in.read(thisChar, 0, 1) == -1); } catch (IOException e) { throw new JenaException(e); } }
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 ); } }
/** 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 print(String s) { try { writer.write(s); column += s.length() ; } catch (java.io.IOException ex) { throw new JenaException(ex) ; } }
protected static String gp( String name ) { String answer = gp( name, null ); if (answer == null) throw new JenaException( "no binding for " + name ); return answer; }
/** We object strongly to null labels: for example, they make .equals flaky. @deprecated Use specific {@link NodeFactory} functions. */ @Deprecated public static Node create( NodeMaker maker, Object label ) { if (label == null) throw new JenaException( "Node.make: null label" ); return maker.construct( label ) ; }
public void println() { try { writer.write(lineSeparator); writer.flush() ; column = 0 ; row++ ; padTo() ; } catch (java.io.IOException ex) { throw new JenaException(ex) ; } }
/** 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; }
@Override public void fatalError(Exception e) { if (!silent) logger.error(ParseException.formatMessage(e)); throw e instanceof RuntimeException ? (RuntimeException) e : new JenaException( e ); } }
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 ); }
@Override public Object open( Assembler a, Resource root, Mode mode ) { throw new JenaException( "shan't" ); }
private static Class<?> loadClassNamedBy( Statement s ) { String x = getString( s ) ; // Jena2 -> Jena3 transition if ( x.startsWith("com.hp.hpl.jena") ) { String x1 = x.replaceFirst("com.hp.hpl.jena", "org.apache.jena") ; Log.warnOnce(AssemblerHelp.class, "ja:loadClass: Migration to Jena3: Converting "+x+" to "+x1, x) ; x = x1 ; } try { return Class.forName(x); } catch (Exception e) { throw new JenaException( e ); } }
/** report a warning * @param e an exception representing the error */ @Override public void warning(Exception e) { // logger.warn( toString() + " " + e.getMessage(), e ); System.out.println(new String(tmpOut.toString())); throw new JenaException( e ); }
@Override public void fatalError(Exception e) { error(e); throw new JenaException(e); }
public void testRethrownMessage() { Exception e = new Exception( "kings and queens" ); JenaException j = new JenaException( e ); assertTrue( j.getMessage().endsWith( e.getMessage() ) ); } }
@Override public void delete(Quad quad) { Graph g = fetchGraph(quad.getGraph()) ; if ( g == null ) throw new JenaException("No such graph: "+quad.getGraph()) ; g.delete(quad.asTriple()) ; }