1
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?

dwjohnston
  • 11,163
  • 32
  • 99
  • 194

1 Answers1

0

Because they are runtime exceptions, which are unchecked meaning that the compiler does not require explicit catching of them.

See this question for more details.

Community
  • 1
  • 1
dwjohnston
  • 11,163
  • 32
  • 99
  • 194