public String runQuery(String q) throws JsonGenerationException, JsonMappingException
{
Graph g = null;
try {
g = jdbcTemplate.query(q, new Neo4jGraphResultSetExtractor());
} catch (DataAccessException e) {
if (e instanceof UncategorizedSQLException)
{
//Invalid cypher query
throw (UncategorizedSQLException)e;
}
else throw e;
}
json = g.toJson(); //throws JsonGenerationException, JsonMappingException
return json;
}
Shouldn't the compiler require that this method also throws UncategorizedSQLException
, DataAccessException
?
Because they are runtime exceptions, which are unchecked meaning that the compiler does not require explicit catching of them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.