Program: 70052
Project: 70052
Buggy source:
/** 
 * Binds a name to an object, along with associated attributes, overwriting any existing binding. If attrs is null and obj is a DirContext, the attributes from obj are used. If attrs is null and obj is not a DirContext, any existing attributes associated with the object already bound in the directory remain unchanged. If attrs is non-null, any existing attributes associated with the object already bound in the directory are removed and attrs is associated with the named object. If obj is a DirContext and attrs is non-null, the attributes of obj are ignored.
 * @param name the name to bind; may not be empty
 * @param obj the object to bind; possibly null
 * @param attrs the attributes to associate with the binding
 * @exception InvalidAttributesException if some "mandatory" attributes of thebinding are not supplied
 * @exception NamingException if a naming exception is encountered
 */
public void rebind(String name,Object obj,Attributes attrs) throws NamingException {
  VFSItem vfsItem=resolveFile(name);
  if (vfsItem == null || (!(vfsItem instanceof VFSLeaf)))   throw new NamingException(smgr.getString("String_Node_Str",name));
  VFSLeaf file=(VFSLeaf)vfsItem;
  if (file instanceof Versionable && ((Versionable)file).getVersions().isVersioned()) {
    VersionsManager.getInstance().addToRevisions((Versionable)file,identity,"String_Node_Str");
  }
  copyVFS(file,name,obj,attrs);
  if (file instanceof MetaTagged) {
    MetaInfo infos=((MetaTagged)file).getMetaInfo();
    if (infos != null && infos.getAuthorIdentity() == null) {
      infos.setAuthor(userSession.getIdentity().getName());
      infos.clearThumbnails();
      infos.write();
    }
  }
  if (obj instanceof VFSResource) {
    VFSResource vfsResource=(VFSResource)obj;
    if (vfsResource.vfsItem instanceof Versionable && ((Versionable)vfsResource.vfsItem).getVersions().isVersioned()) {
      Versionable currentVersion=(Versionable)vfsResource.vfsItem;
      VersionsManager.getInstance().move(currentVersion,file.getParentContainer());
    }
  }
}

Fixed version (ground truth):
/** 
 * Binds a name to an object, along with associated attributes, overwriting any existing binding. If attrs is null and obj is a DirContext, the attributes from obj are used. If attrs is null and obj is not a DirContext, any existing attributes associated with the object already bound in the directory remain unchanged. If attrs is non-null, any existing attributes associated with the object already bound in the directory are removed and attrs is associated with the named object. If obj is a DirContext and attrs is non-null, the attributes of obj are ignored.
 * @param name the name to bind; may not be empty
 * @param obj the object to bind; possibly null
 * @param attrs the attributes to associate with the binding
 * @exception InvalidAttributesException if some "mandatory" attributes of thebinding are not supplied
 * @exception NamingException if a naming exception is encountered
 */
public void rebind(String name,Object obj,Attributes attrs) throws NamingException {
  VFSItem vfsItem=resolveFile(name);
  if (vfsItem == null || (!(vfsItem instanceof VFSLeaf))) {
    throw new NamingException(smgr.getString("String_Node_Str",name));
  }
  VFSLeaf file=(VFSLeaf)vfsItem;
  if (file instanceof Versionable && ((Versionable)file).getVersions().isVersioned()) {
    if (file.getSize() == 0) {
      VersionsManager.getInstance().createVersionsFor(file,true);
    }
 else {
      VersionsManager.getInstance().addToRevisions((Versionable)file,identity,"String_Node_Str");
    }
  }
  copyVFS(file,name,obj,attrs);
  if (file instanceof MetaTagged) {
    MetaInfo infos=((MetaTagged)file).getMetaInfo();
    if (infos != null && infos.getAuthorIdentity() == null) {
      infos.setAuthor(userSession.getIdentity().getName());
      infos.clearThumbnails();
      infos.write();
    }
  }
  if (obj instanceof VFSResource) {
    VFSResource vfsResource=(VFSResource)obj;
    if (vfsResource.vfsItem instanceof Versionable && ((Versionable)vfsResource.vfsItem).getVersions().isVersioned()) {
      Versionable currentVersion=(Versionable)vfsResource.vfsItem;
      VersionsManager.getInstance().move(currentVersion,file.getParentContainer());
    }
  }
}