Program: 52578
Project: 52578
Buggy source:
/** 
 * Create a new workspace item, with a new ID.  An Item is also created.  The submitter is the current user in the context.
 * @param context   DSpace context object
 * @param coll      Collection being submitted to
 * @param template  if <code>true</code>, the workspace item starts as a copy of the collection's template item
 * @return  the newly created workspace item
 */
public static WorkspaceItem create(Context c,Collection coll,boolean template) throws AuthorizeException, SQLException {
  AuthorizeManager.authorizeAction(c,coll,Constants.ADD);
  Item i=Item.create(c);
  i.setSubmitter(c.getCurrentUser());
  Group step1group=coll.getWorkflowGroup(1);
  Group step2group=coll.getWorkflowGroup(2);
  Group step3group=coll.getWorkflowGroup(3);
  EPerson e=c.getCurrentUser();
  AuthorizeManager.addPolicy(c,i,Constants.READ,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.WRITE,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.ADD,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.REMOVE,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step3group);
  Item templateItem=coll.getTemplateItem();
  if (template && templateItem != null) {
    DCValue[] dc=templateItem.getDC(Item.ANY,Item.ANY,Item.ANY);
    for (int n=0; n < dc.length; n++) {
      i.addDC(dc[n].element,dc[n].qualifier,dc[n].language,dc[n].value);
    }
  }
 else {
    i.addDC("String_Node_Str","String_Node_Str",null,ConfigurationManager.getProperty("String_Node_Str"));
  }
  i.update();
  TableRow row=DatabaseManager.create(c,"String_Node_Str");
  row.setColumn("String_Node_Str",i.getID());
  row.setColumn("String_Node_Str",coll.getID());
  log.info(LogManager.getHeader(c,"String_Node_Str","String_Node_Str" + row.getIntColumn("String_Node_Str") + "String_Node_Str"+ i.getID()+ "String_Node_Str"+ coll.getID()));
  DatabaseManager.update(c,row);
  WorkspaceItem wi=new WorkspaceItem(c,row);
  HistoryManager.saveHistory(c,wi,HistoryManager.CREATE,c.getCurrentUser(),c.getExtraLogInfo());
  return wi;
}

Fixed version (ground truth):
/** 
 * Create a new workspace item, with a new ID.  An Item is also created.  The submitter is the current user in the context.
 * @param context   DSpace context object
 * @param coll      Collection being submitted to
 * @param template  if <code>true</code>, the workspace item starts as a copy of the collection's template item
 * @return  the newly created workspace item
 */
public static WorkspaceItem create(Context c,Collection coll,boolean template) throws AuthorizeException, SQLException {
  AuthorizeManager.authorizeAction(c,coll,Constants.ADD);
  Item i=Item.create(c);
  i.setSubmitter(c.getCurrentUser());
  Group step1group=coll.getWorkflowGroup(1);
  Group step2group=coll.getWorkflowGroup(2);
  Group step3group=coll.getWorkflowGroup(3);
  EPerson e=c.getCurrentUser();
  AuthorizeManager.addPolicy(c,i,Constants.READ,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.READ,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.WRITE,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.WRITE,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.ADD,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.ADD,step3group);
  AuthorizeManager.addPolicy(c,i,Constants.REMOVE,e);
  if (step1group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step1group);
  if (step2group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step2group);
  if (step3group != null)   AuthorizeManager.addPolicy(c,i,Constants.REMOVE,step3group);
  Item templateItem=coll.getTemplateItem();
  if (template && templateItem != null) {
    DCValue[] dc=templateItem.getDC(Item.ANY,Item.ANY,Item.ANY);
    for (int n=0; n < dc.length; n++) {
      i.addDC(dc[n].element,dc[n].qualifier,dc[n].language,dc[n].value);
    }
  }
 else {
  }
  i.update();
  TableRow row=DatabaseManager.create(c,"String_Node_Str");
  row.setColumn("String_Node_Str",i.getID());
  row.setColumn("String_Node_Str",coll.getID());
  log.info(LogManager.getHeader(c,"String_Node_Str","String_Node_Str" + row.getIntColumn("String_Node_Str") + "String_Node_Str"+ i.getID()+ "String_Node_Str"+ coll.getID()));
  DatabaseManager.update(c,row);
  WorkspaceItem wi=new WorkspaceItem(c,row);
  HistoryManager.saveHistory(c,wi,HistoryManager.CREATE,c.getCurrentUser(),c.getExtraLogInfo());
  return wi;
}