Skip to content

The source Bean is cloned twice when computing the modification #461

@elecharny

Description

@elecharny

The code in BeanComparator.calculateModifications() create a clone of the source bean:

	public static LscModifications calculateModifications(
					Task task, IBean srcBean, IBean dstBean) 
					throws LscServiceException {

		LscModifications lm = null;

		// clone the source bean to work on it
		IBean itmBean = cloneSrcBean(task, srcBean, dstBean);

		// get modification type to perform
		LscModificationType modificationType = calculateModificationType(task, srcBean, dstBean);
...

and just afterward, we also clone the source bean a second time in the calculateModificationType call:

	public static LscModificationType calculateModificationType(Task task,
					IBean srcBean, IBean dstBean) throws LscServiceException {
...
		// we have the object in the source and the destination
		// this must be either a MODIFY or MODRDN operation
		// clone the source bean to calculate modifications on the DN
		IBean itmBean = cloneSrcBean(task, srcBean, dstBean);
...

We can spare on of those two clones.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions