i have this weird problem: iterating over the keyset of a linkedhashmap, the get returns null on certain keys:
...
System.out.println("Map: "+wildCardSummaryKey);
try {
rowKeys = wildCardSummaryKey.keySet().iterator();
while (rowKeys.hasNext()) {
String rowKey = (String) rowKeys.next();
ProcessTables.Counter counter = (ProcessTables.Counter) wildCardSummary.get(rowKey);
System.out.println("key='"+rowKey+"', containsKey="+wildCardSummaryKey.containsKey(rowKey)+", value="+counter);
System.out.println("count: "+counter.getCount());
}
} catch(NullPointerException e) {
e.printStackTrace();
}
the output is (manually formatted for better readability):
Map: {
abc:abc vpn:Klant:Stichting BlaBla College:Stichting BlaBla College=com.my.ProcessTables$Counter@54deac,
abc:abc uni/nni:Klant:CA BlaBla F & O BV:CA BlaBla F & O BV=com.my.ProcessTables$Counter@43e6ee5f,
abc:abc vpn:Klant:CA BlaBla F & O BV:CA BlaBla F & O BV=com.my.ProcessTables$Counter@6e2bc1cc,
abc:abc uni/nni:Klant:Stichting BlaBla College:Stichting BlaBla College=com.my.ProcessTables$Counter@7ac07095
}
key='abc:abc vpn:Klant:Stichting BlaBla College:Stichting BlaBla College', containsKey=true, value=null
java.lang.NullPointerException
at com.my.ProcessTables.getData(ProcessTables.java:1166)
at com.my.ProcessTables.processRequest_getData(ProcessTables.java:1629)
at com.my.ProcessTables.processRequest(ProcessTables.java:81)
line 1166 is this line: System.out.println("count: "+counter.getCount());
so: although the iterator gives me the key i cannot get the value object from the map! what is going on? any ideas?
thanks! frank