Buggy code:
public class _Control implements _IXMLContent { private Control control ; private _Session ses ; public _Control ( _Session ses ) { } _Control ( _Session ses , Date c , boolean sixWorkdays , Date pcd ) { } _Control ( _Session ses , Date c , boolean sixWorkdays , double priority , double complication ) { } _Control ( _Session ses , Date c , boolean sixWorkdays , double priority , double complication , double coefficient ) { } _Control ( _Session ses , Date c , boolean sixWorkdays , int days ) { } public _Control ( _Session ses , Control control ) { } public void setBaseExecDate ( Date d ) { } public void setWeight ( double priority , double complication ) { } public void addProlongation ( int days , String reason ) { } public Date getPrimaryCtrlDate ( ) { } public Date getStartDate ( ) { } public Date getResettDate ( ) { } public void setStartDate ( Date startDate ) { } public void setResetDate ( Date resetDate ) { } public Date getCtrlDate ( ) { } public int getDiffBetweenDays ( Date c ) { } public int getDiffBetweenDays ( ) { } public void setAllControl ( _AllControlType ac ) { } public int getAllControl ( ) { } @ Deprecated public int getAllContr ( ) { } public void setCycle ( int cycle ) { } public void setOld ( int isOld ) { } public String toXML ( ) throws _Exception { StringBuffer xmlContent = new StringBuffer ( 10000 ) ; xmlContent . append ( ( ( "<primaryctrldate>" + ( dateTimeFormat . format ( control . getPrimaryCtrlDate ( ) . getTime ( ) ) ) ) + "<//primaryctrldate>" ) ) ; xmlContent . append ( ( ( "<ctrldate>" + ( dateTimeFormat . format ( getCtrlDate ( ) . getTime ( ) ) ) ) + "<//ctrldate>" ) ) ; xmlContent . append ( ( ( "<startdate>" + ( ( getStartDate ( ) ) != null ? dateTimeFormat . format ( getStartDate ( ) ) : "" ) ) + "<//startdate>" ) ) ; xmlContent . append ( ( ( "<cyclecontrol>" + ( control . getCycle ( ) ) ) + "<//cyclecontrol>" ) ) ; xmlContent . append ( ( ( "<allcontrol>" + ( getAllContr ( ) ) ) + "<//allcontrol>" ) ) ; xmlContent . append ( ( ( "<isold>" + ( control . getOld ( ) ) ) + "<//isold>" ) ) ; xmlContent . append ( ( ( "<priority>" + ( control . getPriority ( ) ) ) + "<//priority>" ) ) ; xmlContent . append ( ( ( "<complication>" + ( control . getComplication ( ) ) ) + "<//complication>" ) ) ; <START_BUG> xmlContent . append ( ( ( "<diff>" + ( control . getDiffBetweenDays ( ( ( control . getAllControl ( ) ) == 0 ? control . getResetDate ( ) : Calendar . getInstance ( ) ) ) ) ) + "<//diff>" ) ) ; <END_BUG> if ( ! ( control . getShifts ( ) . isEmpty ( ) ) ) { xmlContent . append ( "<shift>" ) ; ArrayList < Shift > shiftList = control . getShifts ( ) ; for ( int i = 0 ; i < ( shiftList . size ( ) ) ; i ++ ) { Shift s = shiftList . get ( i ) ; xmlContent . append ( ( ( "<entry><days>+" + ( s . days ) ) + "<//days>" ) ) ; _Database currentDb = ses . getCurrentDatabase ( ) ; try { _Document doc = currentDb . getDocumentByID ( s . reason ) ; xmlContent . append ( ( ( "<reason>" + ( doc . getValueString ( "name" ) ) ) + "<//reason>" ) ) ; } catch ( Exception e ) { xmlContent . append ( ( ( "<reason>" + ( s . reason ) ) + "<//reason>" ) ) ; } try { Employer emp = currentDb . getBaseObject ( ) . getStructure ( ) . getAppUser ( s . author ) ; xmlContent . append ( ( ( ( ( "<author<seq2seq4repair_space>attrval=\"" + ( s . author ) ) + "\">" ) + ( emp . getFullName ( ) ) ) + "<//author>" ) ) ; } catch ( Exception e ) { xmlContent . append ( ( ( "<author>" + ( s . author ) ) + "<//author>" ) ) ; } xmlContent . append ( ( ( "<date>" + ( Util . convertDataTimeToString ( s . date ) ) ) + "<//date><//entry>" ) ) ; } xmlContent . append ( "<//shift>" ) ; } return xmlContent . toString ( ) ; } public Control getBaseObject ( ) { } public String toString ( ) { } }

Fix:
xmlContent . append ( ( ( "<diff>" + ( control . getDiffBetweenDays ( ( ( ( control . getAllControl ( ) ) == 0 ) && ( ( control . getResetDate ( ) ) != null ) ? control . getResetDate ( ) : Calendar . getInstance ( ) ) ) ) ) + "<//diff>" ) ) ;