if (aggregates == null) {
// we have read the binary data, but not yet turned into the objects
final int num = aggNames.length;
aggregates = new Value[num];
for (int i = 0; i < num; i++) {
Value v;
try {
Class<? extends Value> valClass = Class.forName(classNames[i], true, classResolver).asSubclass(Value.class);
v = InstantiationUtil.instantiate(valClass, Value.class);
}
catch (ClassNotFoundException e) {
throw new RuntimeException("Could not load user-defined class '" + classNames[i] + "'.", e);
}
catch (ClassCastException e) {
throw new RuntimeException("User-defined aggregator class is not a value sublass.");
}
DataInputStream in = new DataInputStream(new ByteArrayInputStream(serializedData[i]));
try {
v.read(in);
in.close();
} catch (IOException e) {
throw new RuntimeException("Error while deserializing the user-defined aggregate class.", e);
}