Program: 51540
Project: 51540
Buggy source:
/** 
 * Takes the Event form pulled from the scala.html and crafts
 * @param newEventForm - the wrapper from the scala.html form for EiEvent
 * @return the EiEvent built from the Event wrapper
 */
public static EiEvent buildEventFromForm(Event newEventForm){
  Date currentDate=new Date();
  GregorianCalendar calendar=new GregorianCalendar();
  calendar.setTime(currentDate);
  XMLGregorianCalendar xCalendar=datatypeFactory.newXMLGregorianCalendar(calendar);
  xCalendar.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
  JAXBElement<SignalPayload> signalPayload=objectFactory.createSignalPayload(new SignalPayload(new PayloadFloat(1)));
  String contextName=JPA.em().find(Program.class,Long.parseLong(newEventForm.getMarketContext())).getProgramName();
  Intervals intervals=new Intervals();
  ArrayList<Interval> intervalList=new ArrayList<Interval>();
  EiEvent newEvent=newEventForm.toEiEvent();
  for (int i=0; i < newEventForm.getIntervals(); i++) {
    intervalList.add(new Interval().withDuration(new DurationPropType().withDuration(new DurationValue().withValue(formatDuration(getDuration(newEvent.getEiActivePeriod().getProperties().getDuration().getDuration().getValue()))))).withUid(new Uid().withText("String_Node_Str" + i)).withStreamPayloadBase(signalPayload));
  }
  intervals.setIntervals(intervalList);
  newEvent.withEiActivePeriod(new EiActivePeriod().withProperties(new Properties().withDtstart(new Dtstart().withDateTime(new DateTime().withValue(newEvent.getEiActivePeriod().getProperties().getDtstart().getDateTime().getValue().normalize()))).withDuration(new DurationPropType().withDuration(new DurationValue().withValue(formatDuration(getDuration(newEvent.getEiActivePeriod().getProperties().getDuration().getDuration().getValue(),(int)newEventForm.getIntervals()))))).withTolerance(new Tolerance().withTolerate(new Tolerate().withStartafter(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str"))))))).withXEiNotification(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))).withXEiRampUp(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))).withXEiRecovery(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))))).withEiTarget(new EiTarget()).withEventDescriptor(new EventDescriptor().withCreatedDateTime(new DateTime().withValue(xCalendar)).withEiMarketContext(new EiMarketContext().withMarketContext(new MarketContext().withValue(contextName))).withEventID(newEventForm.getEventID()).withEventStatus(updateStatus(newEvent,(int)newEventForm.getIntervals())).withModificationNumber(0).withPriority(newEventForm.getPriority()).withTestEvent("String_Node_Str").withVtnComment("String_Node_Str")).withEiEventSignals(new EiEventSignals().withEiEventSignals(new EiEventSignal().withCurrentValue(new CurrentValue().withPayloadFloat(new PayloadFloat().withValue(updateSignalPayload(newEvent)))).withIntervals(new Intervals().withIntervals(intervalList)).withSignalID("String_Node_Str").withSignalName("String_Node_Str").withSignalType(SignalTypeEnumeratedType.LEVEL)));
  return newEvent;
}

Fixed version (ground truth):
/** 
 * Takes the Event form pulled from the scala.html and crafts
 * @param newEventForm - the wrapper from the scala.html form for EiEvent
 * @return the EiEvent built from the Event wrapper
 */
public static EiEvent buildEventFromForm(Event newEventForm){
  Date currentDate=new Date();
  GregorianCalendar calendar=new GregorianCalendar();
  calendar.setTime(currentDate);
  XMLGregorianCalendar xCalendar=datatypeFactory.newXMLGregorianCalendar(calendar);
  xCalendar.setTimezone(DatatypeConstants.FIELD_UNDEFINED);
  JAXBElement<SignalPayload> signalPayload=objectFactory.createSignalPayload(new SignalPayload(new PayloadFloat(1)));
  String contextName=JPA.em().find(Program.class,Long.parseLong(newEventForm.getMarketContext())).getProgramName();
  Intervals intervals=new Intervals();
  ArrayList<Interval> intervalList=new ArrayList<Interval>();
  EiEvent newEvent=newEventForm.toEiEvent();
  for (int i=0; i < newEventForm.getIntervals(); i++) {
    intervalList.add(new Interval().withDuration(new DurationPropType().withDuration(new DurationValue().withValue(formatDuration(getDuration(newEvent))))).withUid(new Uid().withText("String_Node_Str" + i)).withStreamPayloadBase(signalPayload));
  }
  intervals.setIntervals(intervalList);
  Logger.info("String_Node_Str" + newEvent.getEiActivePeriod().getProperties().getDuration().getDuration().getValue());
  newEvent.withEiActivePeriod(new EiActivePeriod().withProperties(new Properties().withDtstart(new Dtstart().withDateTime(new DateTime().withValue(newEvent.getEiActivePeriod().getProperties().getDtstart().getDateTime().getValue().normalize()))).withDuration(new DurationPropType().withDuration(new DurationValue().withValue(formatDuration(getDuration(newEvent,(int)newEventForm.getIntervals()))))).withTolerance(new Tolerance().withTolerate(new Tolerate().withStartafter(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str"))))))).withXEiNotification(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))).withXEiRampUp(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))).withXEiRecovery(new DurationPropType().withDuration(new DurationValue().withValue((formatDuration(getDuration("String_Node_Str")))))))).withEiTarget(new EiTarget()).withEventDescriptor(new EventDescriptor().withCreatedDateTime(new DateTime().withValue(xCalendar)).withEiMarketContext(new EiMarketContext().withMarketContext(new MarketContext().withValue(contextName))).withEventID(newEventForm.getEventID()).withEventStatus(updateStatus(newEvent,(int)newEventForm.getIntervals())).withModificationNumber(0).withPriority(newEventForm.getPriority()).withTestEvent("String_Node_Str").withVtnComment("String_Node_Str")).withEiEventSignals(new EiEventSignals().withEiEventSignals(new EiEventSignal().withCurrentValue(new CurrentValue().withPayloadFloat(new PayloadFloat().withValue(updateSignalPayload(newEvent)))).withIntervals(new Intervals().withIntervals(intervalList)).withSignalID("String_Node_Str").withSignalName("String_Node_Str").withSignalType(SignalTypeEnumeratedType.LEVEL)));
  return newEvent;
}