Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8950

Re: extract data from hash map for target structure mapping

$
0
0

Hi Mike,

 

Ok, the only possible place I can see for a NullPointerException is the for loop with this code based on what you have included:

ArrayList<String> al = matmap1.get(coreid[i]);  
matmap1.remove(coreid[i]);  
for(int j = 0; j<al.size(); j++)  
{  
result.addValue(al.get(j));  
}  

It looks like you have hard-coded a test key of "A" with an ArrayList of one value.  If you test with a payload that includes any material that is not equal to "A" then you will get a NullPointerExeption in the for loop processing.  The reason why is that the HashMap will pass back a null value for ArrayList<String> al when the key doesn't exist so you cannot call al.size() on your check condition for a null value.  Can you confirm that you are only testing this with a payload materialID of "A" in your sample?

 

 

 

Regards,

Ryan Crosby


Viewing all articles
Browse latest Browse all 8950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>