SessionInfoCompositeData: to support null values

This patch allows the SessionInfoCompositeData to accept null values.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
This commit is contained in:
Amnon Heiman 2015-12-31 12:16:46 +02:00
parent 36c4a7df27
commit 2840880e95

View File

@ -33,6 +33,7 @@ import com.google.common.base.Function;
import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.cassandra.streaming.ProgressInfo;
import org.apache.cassandra.streaming.SessionInfo;
@ -175,6 +176,9 @@ public class SessionInfoCompositeData
private static <T> CompositeData[] toArrayOfCompositeData(Collection<T> toConvert, Function<T, CompositeData> func)
{
if (toConvert == null) {
toConvert = Sets.newHashSet();
}
CompositeData[] composites = new CompositeData[toConvert.size()];
return Lists.newArrayList(Iterables.transform(toConvert, func)).toArray(composites);
}