Skip to content

Commit

Permalink
info: Fix HashMap ordering assumption in unit test
Browse files Browse the repository at this point in the history
The unit test assumes a particular serialized form of the state tree
nodes, which isn't guaranteed when iterating over a HashMap. This causes
the unit tests to fail with some JDKs, in particular JDK 8.

Target: trunk
Request: 2.10
Request: 2.9
Request: 2.8
Request: 2.7
Request: 2.6
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7198/
(cherry picked from commit 14797dd)
  • Loading branch information
gbehrmann committed Aug 19, 2014
1 parent d1b4f36 commit 4abcbb3
Showing 1 changed file with 3 additions and 3 deletions.
@@ -1,5 +1,6 @@
package org.dcache.services.info.base;

import com.google.common.collect.Ordering;
import org.junit.Assert;

import java.util.HashMap;
Expand Down Expand Up @@ -125,9 +126,8 @@ public void visit( StateVisitor visitor, StatePath ourPath) {

visitor.visitCompositePreDescend( ourPath, visitMetadata);

for( Map.Entry<String, Node> entry : _children.entrySet()) {
String childName = entry.getKey();
Node child = entry.getValue();
for (String childName : Ordering.natural().sortedCopy(_children.keySet())) {
Node child = _children.get(childName);

StatePath childPath = (ourPath == null)
? new StatePath( childName)
Expand Down

0 comments on commit 4abcbb3

Please sign in to comment.