THashMap.keySet().toArray(T[ ] array) doesn't follow SUN spec --------------------------------------------------------------
Key: CDV-911 URL: https://jira.terracotta.org/jira//browse/CDV-911 Project: Community Development Issue Type: Bug Components: DSO:L1 Affects Versions: 2.6.4, 2.7.0-stable1, trunk-nightly Reporter: Hung Huynh Assignee: Issue Review Board According to Sun's spec http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray(T[]) array with bigger size than the collection in call toArray(T[] a) will be null terminated. We are not following that spec. The output does show the array in local VM is null terminated but the (third) value on the server isn't null (see screen shot) public class Test { // Roots private Map<String, String> map = new ConcurrentHashMap<String, String>(); private Object[] array = new Object[4]; public void run() { map.put("key1", "value1"); map.put("key2", "value2"); synchronized (array) { Arrays.fill(array, "filler"); System.out.println("before: " + Arrays.asList(array)); array = map.entrySet().toArray(array); System.out.println("after: " + Arrays.asList(array)); } } public static void main(String[] args) { new Test().run(); } } ================================================================================================= Output: before: [filler, filler, filler, filler] after: [key1=value1, key2=value2, null, filler] -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://jira.terracotta.org/jira//secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira _______________________________________________ tc-dev mailing list tc-dev@lists.terracotta.org http://lists.terracotta.org/mailman/listinfo/tc-dev