java: fixes CollectionTemplate

This commit is contained in:
frsyuki 2010-10-24 20:16:37 +09:00
parent 19ff0dd17f
commit 0a345cb12b

View File

@ -31,10 +31,11 @@ public class CollectionTemplate implements Template {
}
public void pack(Packer pk, Object target) throws IOException {
if(target instanceof Collection) {
if(!(target instanceof Collection)) {
throw new MessageTypeException();
}
Collection<Object> collection = (Collection<Object>)target;
pk.packArray(collection.size());
for(Object element : collection) {
elementTemplate.pack(pk, element);
}