int addedCount = 0;
int updatedCount = 0;
int unchangedCount = 0;
for (Iterator i = defects.iterator(); i.hasNext();) {
Defect newDefect = (Defect) i.next();
Defect oldDefect = defectLog.getDefect(newDefect.number);
if (oldDefect == null) {
addedCount++;
defectLog.writeDefect(newDefect);
} else {
Defect originalDefect = (Defect) oldDefect.clone();
oldDefect.defect_type = merge(oldDefect.defect_type, newDefect.defect_type);
oldDefect.phase_injected = merge(oldDefect.phase_injected, newDefect.phase_injected);
oldDefect.phase_removed = merge(oldDefect.phase_removed, newDefect.phase_removed);
oldDefect.description = merge(oldDefect.description, newDefect.description);
oldDefect.fix_time = merge(oldDefect.fix_time, newDefect.fix_time);
oldDefect.fix_defect = merge(oldDefect.fix_defect, newDefect.fix_defect);
if (originalDefect.equals(oldDefect)) {
unchangedCount++;
} else {
updatedCount++;
defectLog.writeDefect(oldDefect);
}