I just wrote this test:
public void testStripOpOfListOfListsWithNulls() throws Exception {
StringTemplate e = new StringTemplate(
"$strip(data):{list | $strip(list)$}; separator=\",\"$"
);
e = e.getInstanceOf();
List data = new ArrayList();
List dataOne = new ArrayList();
dataOne.add("Hi");
dataOne.add(null);
dataOne.add("mom");
data.add(dataOne);
data.add(null);
List dataTwo = new ArrayList();
dataTwo.add("Hi");
dataTwo.add(null);
dataTwo.add("dad");
dataTwo.add(null);
data.add(dataTwo);
e.setAttribute("data", data);
String expecting = "Himom,HiDad"; // nulls are skipped
assertEqual(e.toString(), expecting);
}
and it fails:
TEST: testStripOpOfListOfListsWithNulls
testStripOpOfListOfListsWithNulls failed: expecting "Himom,HiDad";
found "Hi"
successes: 0
failures: 1
It appears that everything past the first null is truncated. This
doesn't happen with flat lists, there are test cases for that which
pass.
The inner strip makes it trip. Weird. Could this be related to
Iterator sharing in nested ArrayLists? Can't imagine, but it surely
is weird.
Smells like a bug...I don't have time to investigate right now, but
I'll add the test to the testsuite and to the wiki.