OpenTreeOfLife / taxomachine

taxonomy graphdb
Other
7 stars 4 forks source link

internal server error when name of length < 2 sent to match_names #82

Closed mtholder closed 8 years ago

mtholder commented 10 years ago

obviously not a big deal, because this is not a real query (found it by accident):

curl -X POST -H "Content-Type":"application/json" -H "Accept":"application/json" http://devapi.opentreeoflife.org/v2/tnrs/match_names --data '{"names": ["z"]}'

produces:

{
  "message" : "minimumSimilarity < 0",
  "exception" : "IllegalArgumentException",
  "fullname" : "java.lang.IllegalArgumentException",
  "stacktrace" : [ "org.apache.lucene.search.FuzzyQuery.<init>(FuzzyQuery.java:76)", "org.apache.lucene.search.FuzzyQuery.<init>(FuzzyQuery.java:103)", "org.opentree.tnrs.queries.MultiNameContextQuery.getApproxTaxnameOrSynonymMatches(MultiNameContextQuery.java:549)", "org.opentree.tnrs.queries.MultiNameContextQuery.runQuery(MultiNameContextQuery.java:208)", "org.opentree.taxonomy.plugins.tnrs_v2.match_names(tnrs_v2.java:254)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:57)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:300)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:122)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)" ]
}

we might want to catch such queries earlier and reject them with a more specific err message.

jar398 commented 8 years ago

Cannot reproduce in v3