@Override public void warning(Exception e) { if (!silent) logger.warn(ParseException.formatMessage(e)); }
SAXParseException rootCause() { Exception e = getException(); return e == null ? this : (SAXParseException) e; }
private void oneProperty(ARPOptions options, String pName, Object value) { if (! pName.startsWith("ERR_") && ! pName.startsWith("IGN_") && ! pName.startsWith("WARN_")) return ; int cond = ParseException.errorCode(pName); if (cond == -1) throw new RiotException("No such ARP property: '"+pName+"'"); int val; if (value instanceof String) { if (!((String) value).startsWith("EM_")) throw new RiotException("Value for ARP property does not start EM_: '"+pName+"' = '"+value+"'" ); val = ParseException.errorCode((String) value); if (val == -1 ) throw new RiotException("Illegal value for ARP property: '"+pName+"' = '"+value+"'" ); } else if (value instanceof Integer) { val = ((Integer) value).intValue(); switch (val) { case ARPErrorNumbers.EM_IGNORE: case ARPErrorNumbers.EM_WARNING: case ARPErrorNumbers.EM_ERROR: case ARPErrorNumbers.EM_FATAL: break; default: throw new RiotException("Illegal value for ARP property: '"+pName+"' = '"+value+"'" ); } } else { throw new RiotException("Property \"" + pName + "\" cannot have value: " + value.toString()); } options.setErrorMode(cond, val); }
private void checkExpected() { for ( int anExpected : expected ) { if ( anExpected != 0 ) { fail( "Expected error: " + ParseException.errorCodeName( anExpected ) + " but it did not occur." ); } } }
@Override public void warning(SAXParseException e) { int eNo =((ParseException)e).getErrorNumber(); if (!seen[eNo]) { seen[((ParseException)e).getErrorNumber()] = true; System.out.print(eNo+", "); System.err.println(e.getMessage()); } }
void generalError( int id, Exception e) throws SAXParseException { ARPLocation where = new ARPLocation(locator); // System.err.println(e.getMessage()); warning(null, id, new ParseException(id, where, e)); }
void warning(Taint taintMe, int id, SAXParseException e) throws SAXParseException { try { switch (options.getErrorMode(id)) { case EM_IGNORE: break; case EM_WARNING: handlers.getErrorHandler().warning(e); break; case EM_ERROR: if (taintMe != null) taintMe.taint(); handlers.getErrorHandler().error(e); break; case EM_FATAL: handlers.getErrorHandler().fatalError(e); break; } } catch (SAXParseException xx) { throw xx; } catch (SAXException ee) { throw new WrappedException(ee); } if (e instanceof ParseException && ((ParseException) e).isPromoted()) throw e; if (options.getErrorMode(id) == EM_FATAL) { // If we get here, we shouldn't go on // throw an error into Jena. throw new FatalParsingErrorException(); } }
void initExpectedFromModel() { StmtIterator si = testID.listProperties(errorCodes); if (si.hasNext()) { expected = new HashSet<>(); while (si.hasNext()) { String uri = si.nextStatement().getResource().getURI(); String fieldName = uri.substring(uri.lastIndexOf('#') + 1); expected.add(new Integer(ParseException.errorCode(fieldName))); } } } void initExpected() {
private void checkExpected() { for ( int anExpected : expected ) { if ( anExpected != 0 ) { fail( "Expected error: " + ParseException.errorCodeName( anExpected ) + " but it did not occur." ); } } }
@Override public void warning(SAXParseException e) { int eNo =((ParseException)e).getErrorNumber(); if (!seen[eNo]) { seen[((ParseException)e).getErrorNumber()] = true; System.out.print(eNo+", "); System.err.println(e.getMessage()); } }
void generalError( int id, Exception e) throws SAXParseException { ARPLocation where = new ARPLocation(locator); // System.err.println(e.getMessage()); warning(null, id, new ParseException(id, where, e)); }
void warning(Taint taintMe, int id, SAXParseException e) throws SAXParseException { try { switch (options.getErrorMode(id)) { case EM_IGNORE: break; case EM_WARNING: handlers.getErrorHandler().warning(e); break; case EM_ERROR: if (taintMe != null) taintMe.taint(); handlers.getErrorHandler().error(e); break; case EM_FATAL: handlers.getErrorHandler().fatalError(e); break; } } catch (SAXParseException xx) { throw xx; } catch (SAXException ee) { throw new WrappedException(ee); } if (e instanceof ParseException && ((ParseException) e).isPromoted()) throw e; if (options.getErrorMode(id) == EM_FATAL) { // If we get here, we shouldn't go on // throw an error into Jena. throw new FatalParsingErrorException(); } }
@Override public void fatalError(org.xml.sax.SAXParseException e) throws org.xml.sax.SAXException { System.err.println("Fatal Error: " + ParseException.formatMessage(e)); throw e; }
@Override void onError(int level, int id) { Integer err = new Integer(id); found.add(err); errorCnt[level]++; if (expected != null) { if (!expected.contains(err)) super.onError(level, id); } else if (inDevelopment) { System.err.println( "<rdf:Description rdf:about='" + testID.getURI() + "'>\n" + "<jjc:error rdf:resource='" + jjcNS + ParseException.errorCodeName(id) + "'/>\n</rdf:Description>"); } } }
private void error(int level, Exception e) { //System.err.println(e.getMessage()); if (e instanceof ParseException) { int eCode = ((ParseException) e).getErrorNumber(); onError(level, eCode); } else { fail("Not expecting an Exception: " + e.getMessage()); } }
void warning(Taint taintMe, int id, ARPLocation loc, String msg) throws SAXParseException { if (options.getErrorMode(id) != EM_IGNORE) warning(taintMe, id, new ParseException(id, loc, msg) { private static final long serialVersionUID = 1990910846204964756L; }); }
SAXParseException rootCause() { Exception e = getException(); return e == null ? this : (SAXParseException) e; }