This is an automated email from the ASF dual-hosted git repository. abenedetti pushed a commit to branch branch_9_9 in repository https://gitbox.apache.org/repos/asf/solr.git
commit 038bec9e6d7b5786ec24083927fee315daac7ac3 Author: Alessandro Benedetti <[email protected]> AuthorDate: Mon Jul 14 15:28:57 2025 +0100 minors, java 11 switch case --- .../model/SolrTextToVectorModel.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/SolrTextToVectorModel.java b/solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/SolrTextToVectorModel.java index 9a22087b990..fc529a6336f 100644 --- a/solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/SolrTextToVectorModel.java +++ b/solr/modules/llm/src/java/org/apache/solr/llm/textvectorisation/model/SolrTextToVectorModel.java @@ -85,20 +85,27 @@ public class SolrTextToVectorModel implements Accountable { * support, some of them may require to be handled in here as separate switch cases */ switch (paramName) { - case TIMEOUT_PARAM -> { + case TIMEOUT_PARAM: Duration timeOut = Duration.ofSeconds((Long) params.get(paramName)); builder.getClass().getMethod(paramName, Duration.class).invoke(builder, timeOut); - } - case MAX_SEGMENTS_PER_BATCH_PARAM, MAX_RETRIES_PARAM -> builder - .getClass() - .getMethod(paramName, Integer.class) - .invoke(builder, ((Long) params.get(paramName)).intValue()); - + break; + case MAX_SEGMENTS_PER_BATCH_PARAM: + builder + .getClass() + .getMethod(paramName, Integer.class) + .invoke(builder, ((Long) params.get(paramName)).intValue()); + break; + case MAX_RETRIES_PARAM: + builder + .getClass() + .getMethod(paramName, Integer.class) + .invoke(builder, ((Long) params.get(paramName)).intValue()); + break; /* * For primitive params if there's only one setter available, we call it. * If there's choice we default to the string one */ - default -> { + default: ArrayList<Method> paramNameMatches = new ArrayList<>(); for (var method : builder.getClass().getMethods()) { if (paramName.equals(method.getName()) && method.getParameterCount() == 1) { @@ -106,7 +113,7 @@ public class SolrTextToVectorModel implements Accountable { } } if (paramNameMatches.size() == 1) { - paramNameMatches.getFirst().invoke(builder, params.get(paramName)); + paramNameMatches.get(0).invoke(builder, params.get(paramName)); } else { try { builder @@ -118,7 +125,6 @@ public class SolrTextToVectorModel implements Accountable { throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e); } } - } } } }
