Project

General

Profile

« Previous | Next » 

Revision 5e97e1b2

Added by Andreas Müller over 12 years ago

bugfix for #2558 (concurrent modification in TaxonNodeServiceImpl.makeTaxonNodeASynonymOfAnotherTaxonNode(...) )

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImpl.java
46 46
@Service
47 47
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
48 48
public class TaxonNodeServiceImpl extends AnnotatableServiceBase<TaxonNode, ITaxonNodeDao> implements ITaxonNodeService{
49
	private static final Logger logger = Logger
50
			.getLogger(TaxonNodeServiceImpl.class);
49
	private static final Logger logger = Logger.getLogger(TaxonNodeServiceImpl.class);
51 50

  
52 51
	@Autowired
53 52
	private BeanInitializer defaultBeanInitializer;
......
146 145
		}
147 146
		
148 147
		//Move descriptions to new taxon
149
		for(TaxonDescription description : oldTaxon.getDescriptions()){
150
			description.setTitleCache("Description copied from former accepted taxon: " + oldTaxon.getTitleCache() + "(Old title: " + description.getTitleCache()  + ")");
148
		List<TaxonDescription> descriptions = new ArrayList<TaxonDescription>( oldTaxon.getDescriptions()); //to avoid concurrent modification errors (newAcceptedTaxon.addDescription() modifies also oldtaxon.descritpions()) 
149
		for(TaxonDescription description : descriptions){
150
			String message = "Description copied from former accepted taxon: %s (Old title: %s)"; 
151
			message = String.format(message, oldTaxon.getTitleCache(), description.getTitleCache());
152
			description.setTitleCache(message, true);
151 153
			newAcceptedTaxon.addDescription(description);
152 154
		}
153 155
				

Also available in: Unified diff