Program: 70053
Project: 70053
Buggy source:
/** 
 * @see org.olat.core.util.vfs.version.VersionsManager#addToRevisions(org.olat.core.util.vfs.version.Versionable,org.olat.core.id.Identity,java.lang.String)
 */
@Override public boolean addToRevisions(Versionable currentVersion,Identity identity,String comment){
  VFSLeaf currentFile=(VFSLeaf)currentVersion;
  VFSLeaf versionFile=getCanonicalVersionXmlFile(currentFile,true);
  if (versionFile == null) {
    return false;
  }
  VFSContainer versionContainer=versionFile.getParentContainer();
  String name=currentFile.getName();
  Versions v=readVersions(currentFile,versionFile);
  if (!(v instanceof VersionsFileImpl)) {
    log.error("String_Node_Str" + v);
    return false;
  }
  VersionsFileImpl versions=(VersionsFileImpl)v;
  String uuid=UUID.randomUUID().toString() + "String_Node_Str" + name;
  String versionNr=getNextRevisionNr(versions);
  String currentAuthor=versions.getAuthor();
  long lastModifiedDate=0;
  if (currentFile instanceof MetaTagged) {
    MetaInfo metaInfo=((MetaTagged)currentFile).getMetaInfo();
    if (metaInfo != null) {
      metaInfo.clearThumbnails();
      if (currentAuthor == null) {
        currentAuthor=metaInfo.getAuthor();
      }
      lastModifiedDate=metaInfo.getLastModified();
    }
  }
  if (lastModifiedDate <= 0) {
    Calendar cal=Calendar.getInstance();
    cal.setTime(new Date());
    lastModifiedDate=cal.getTimeInMillis();
  }
  RevisionFileImpl newRevision=new RevisionFileImpl();
  newRevision.setName(name);
  newRevision.setFilename(uuid);
  newRevision.setRevisionNr(versionNr);
  newRevision.setComment(versions.getComment());
  newRevision.setAuthor(currentAuthor);
  newRevision.setLastModified(lastModifiedDate);
  if (versions.getRevisions().isEmpty() && currentVersion instanceof MetaTagged) {
    MetaTagged metaTagged=(MetaTagged)currentVersion;
    versions.setCreator(metaTagged.getMetaInfo().getAuthor());
  }
  VFSLeaf target=versionContainer.createChildLeaf(uuid);
  if (VFSManager.copyContent(currentFile,target)) {
    if (identity != null) {
      versions.setAuthor(identity.getName());
    }
    versions.setComment(comment);
    versions.getRevisions().add(newRevision);
    versions.setRevisionNr(getNextRevisionNr(versions));
    XStreamHelper.writeObject(mystream,versionFile,versions);
    if (currentVersion.getVersions() instanceof VersionsFileImpl) {
      ((VersionsFileImpl)currentVersion.getVersions()).update(versions);
    }
    return true;
  }
 else {
    log.error("String_Node_Str" + currentVersion);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @see org.olat.core.util.vfs.version.VersionsManager#addToRevisions(org.olat.core.util.vfs.version.Versionable,org.olat.core.id.Identity,java.lang.String)
 */
@Override public boolean addToRevisions(Versionable currentVersion,Identity identity,String comment){
  VFSLeaf currentFile=(VFSLeaf)currentVersion;
  VFSLeaf versionFile=getCanonicalVersionXmlFile(currentFile,true);
  if (versionFile == null) {
    return false;
  }
  VFSContainer versionContainer=versionFile.getParentContainer();
  String name=currentFile.getName();
  Versions v=readVersions(currentFile,versionFile);
  if (!(v instanceof VersionsFileImpl)) {
    log.error("String_Node_Str" + v);
    return false;
  }
  VersionsFileImpl versions=(VersionsFileImpl)v;
  String uuid=UUID.randomUUID().toString() + "String_Node_Str" + name;
  String versionNr=getNextRevisionNr(versions);
  String currentAuthor=versions.getAuthor();
  long lastModifiedDate=0;
  if (currentFile instanceof MetaTagged) {
    MetaInfo metaInfo=((MetaTagged)currentFile).getMetaInfo();
    if (metaInfo != null) {
      metaInfo.clearThumbnails();
      if (currentAuthor == null) {
        currentAuthor=metaInfo.getAuthor();
      }
      lastModifiedDate=metaInfo.getLastModified();
    }
  }
  if (lastModifiedDate <= 0) {
    Calendar cal=Calendar.getInstance();
    cal.setTime(new Date());
    lastModifiedDate=cal.getTimeInMillis();
  }
  RevisionFileImpl newRevision=new RevisionFileImpl();
  newRevision.setUuid(UUID.randomUUID().toString());
  newRevision.setName(name);
  newRevision.setFilename(uuid);
  newRevision.setRevisionNr(versionNr);
  newRevision.setComment(versions.getComment());
  newRevision.setAuthor(currentAuthor);
  newRevision.setLastModified(lastModifiedDate);
  if (versions.getRevisions().isEmpty() && currentVersion instanceof MetaTagged) {
    MetaTagged metaTagged=(MetaTagged)currentVersion;
    versions.setCreator(metaTagged.getMetaInfo().getAuthor());
  }
  VFSLeaf target=versionContainer.createChildLeaf(uuid);
  if (VFSManager.copyContent(currentFile,target)) {
    if (identity != null) {
      versions.setAuthor(identity.getName());
    }
    versions.setComment(comment);
    versions.getRevisions().add(newRevision);
    versions.setRevisionNr(getNextRevisionNr(versions));
    XStreamHelper.writeObject(mystream,versionFile,versions);
    if (currentVersion.getVersions() instanceof VersionsFileImpl) {
      ((VersionsFileImpl)currentVersion.getVersions()).update(versions);
    }
    return true;
  }
 else {
    log.error("String_Node_Str" + currentVersion);
  }
  return false;
}