NamedList problem in solr
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();
精彩评论