Program: 89321
Project: 89321
Buggy source:
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
 */
@Override protected void executePatch() throws Throwable {
  if (!nodeService.exists(RM_CONFIG)) {
    return;
  }
  if (!nodeService.exists(newBehaviorScriptsFolder)) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    String newBehaviorScriptsFolderName="String_Node_Str";
    String newBehaviorScriptsNodeUUID="String_Node_Str";
    String newBehaviorScriptsAssocQName="String_Node_Str";
    Map<QName,Serializable> newBehaviorScriptsFolderProps=new HashMap<QName,Serializable>();
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_NODE_UUID,newBehaviorScriptsNodeUUID);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_NAME,newBehaviorScriptsFolderName);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_TITLE,newBehaviorScriptsFolderName);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_DESCRIPTION,"String_Node_Str");
    newBehaviorScriptsFolder=nodeService.createNode(RM_CONFIG,ContentModel.ASSOC_CONTAINS,QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX,newBehaviorScriptsAssocQName),ContentModel.TYPE_FOLDER,newBehaviorScriptsFolderProps).getChildRef();
  }
  if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER)) {
    AuthenticationUtil.runAs(new RunAsWork<Object>(){
      public Object doWork(){
        RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
          public Void execute() throws Throwable {
            nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER,ContentModel.PROP_DESCRIPTION,"String_Node_Str");
            List<FileInfo> oldBehaviorScripts=fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER);
            if (oldBehaviorScripts != null && oldBehaviorScripts.isEmpty() != true) {
              if (logger.isDebugEnabled()) {
                logger.debug("String_Node_Str");
              }
              for (              FileInfo script : oldBehaviorScripts) {
                fileFolderService.moveFrom(script.getNodeRef(),OLD_BEHAVIOR_SCRIPTS_FOLDER,RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder,script.getName());
                if (logger.isDebugEnabled()) {
                  logger.debug("String_Node_Str" + script.getName());
                }
              }
            }
            return null;
          }
        }
;
        retryingTransactionHelper.doInTransaction(callback);
        return null;
      }
    }
,AuthenticationUtil.getSystemUserName());
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.patch.compatibility.ModulePatchComponent#executePatch()
 */
@Override protected void executePatch() throws Throwable {
  if (!nodeService.exists(RM_CONFIG)) {
    return;
  }
  if (!nodeService.exists(newBehaviorScriptsFolder)) {
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    String newBehaviorScriptsFolderName="String_Node_Str";
    String newBehaviorScriptsNodeUUID="String_Node_Str";
    String newBehaviorScriptsAssocQName="String_Node_Str";
    Map<QName,Serializable> newBehaviorScriptsFolderProps=new HashMap<QName,Serializable>();
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_NODE_UUID,newBehaviorScriptsNodeUUID);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_NAME,newBehaviorScriptsFolderName);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_TITLE,newBehaviorScriptsFolderName);
    newBehaviorScriptsFolderProps.put(ContentModel.PROP_DESCRIPTION,"String_Node_Str");
    newBehaviorScriptsFolder=nodeService.createNode(RM_CONFIG,ContentModel.ASSOC_CONTAINS,QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX,newBehaviorScriptsAssocQName),ContentModel.TYPE_FOLDER,newBehaviorScriptsFolderProps).getChildRef();
  }
  if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER)) {
    AuthenticationUtil.runAs(new RunAsWork<Object>(){
      public Object doWork(){
        RetryingTransactionCallback<Void> callback=new RetryingTransactionCallback<Void>(){
          public Void execute() throws Throwable {
            nodeService.setProperty(OLD_BEHAVIOR_SCRIPTS_FOLDER,ContentModel.PROP_DESCRIPTION,"String_Node_Str");
            List<FileInfo> oldBehaviorScripts=fileFolderService.listFiles(OLD_BEHAVIOR_SCRIPTS_FOLDER);
            if (oldBehaviorScripts != null && !oldBehaviorScripts.isEmpty()) {
              if (logger.isDebugEnabled()) {
                logger.debug("String_Node_Str");
              }
              for (              FileInfo script : oldBehaviorScripts) {
                fileFolderService.moveFrom(script.getNodeRef(),OLD_BEHAVIOR_SCRIPTS_FOLDER,RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder,script.getName());
                if (logger.isDebugEnabled()) {
                  logger.debug("String_Node_Str" + script.getName());
                }
              }
            }
            return null;
          }
        }
;
        retryingTransactionHelper.doInTransaction(callback);
        return null;
      }
    }
,AuthenticationUtil.getSystemUserName());
  }
}