jpountz commented on a change in pull request #1444: URL: https://github.com/apache/lucene-solr/pull/1444#discussion_r412947903
########## File path: lucene/expressions/src/java/org/apache/lucene/expressions/ExpressionValueSource.java ########## @@ -42,13 +42,17 @@ this.expression = Objects.requireNonNull(expression); variables = new DoubleValuesSource[expression.variables.length]; boolean needsScores = false; - for (int i = 0; i < variables.length; i++) { - DoubleValuesSource source = bindings.getDoubleValuesSource(expression.variables[i]); - if (source == null) { - throw new RuntimeException("Internal error. Variable (" + expression.variables[i] + ") does not exist."); + try { + for (int i = 0; i < variables.length; i++) { + DoubleValuesSource source = bindings.getDoubleValuesSource(expression.variables[i]); + if (source == null) { + throw new RuntimeException("Internal error. Variable (" + expression.variables[i] + ") does not exist."); + } + needsScores |= source.needsScores(); + variables[i] = source; } - needsScores |= source.needsScores(); - variables[i] = source; + } catch (StackOverflowError e) { Review comment: Hmm this is a pre-existing issues but catching stack overflows is usually a bad idea as it might leave objects in an inconsistent state. I wonder if it could be checked differently. Also is it ok to move the catch from validate() to here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org