renatoh commented on code in PR #3235:
URL: https://github.com/apache/solr/pull/3235#discussion_r1980187064
##########
solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java:
##########
@@ -69,18 +69,16 @@ public String get(String param, String def) {
@Override
public void writeMap(EntryWriter ew) throws IOException {
- // TODO don't call toNamedList; more efficiently implement here
- // note: multiple values, if present, are a String[] under 1 key
- toNamedList()
- .forEach(
- (k, v) -> {
- if (v == null || "".equals(v)) return;
- try {
- ew.put(k, v);
- } catch (IOException e) {
- throw new RuntimeException("Error serializing", e);
- }
- });
+ for (Entry<String, String[]> entry : this) {
+ String[] value = entry.getValue();
+ // if only one value, don't wrap in an array
+ if (value.length == 1) {
+ assert value[0] != null;
Review Comment:
this 'assert' looks a bit out of place to me. if value.lenght > 1, we do
not care about null-values in the array, but if we have only one we do check
for null. Also wouldn't it be better to just ignore the null value ?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]