开发者

NamedList problem in solr

开发者 https://www.devze.com 2023-03-12 07:16 出处:网络
Here i had added code below in which i had ArrayList Which contains valuesand then i am adding that values to my named list

Here i had added code below in which i had ArrayList Which contains values and then i am adding that values to my named list

NamedList final1 =开发者_运维知识库 null;
NamedList<ArrayList<String>> result = null;
ArrayList<String> data=\\ It has values
result.add("Gender",data);
ArrayList<String> data1=\\ It has values 
result.add("Group ID",data1);
final1.add("Query",result);

But the code is not working. I don't know why this code is not working. CAN Any one guide me.

Thanks in advance


You declared final1 to be null and didn't initialize it before using it.

So, when the code:

final1.add("Query",result);

executes, it throws a NullPointerException.

To fix this, you should initialize final1 before using it. Something like:

NamedList final1 = new NamedList();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号