Buggy code:
public class OpenRosaXmlGenerator { private XMLContext xmlContext = null ; private DataSource dataSource = null ; protected final Logger log = LoggerFactory . getLogger ( OpenRosaXmlGenerator . class ) ; CoreResources coreResources ; private RuleActionPropertyDao ruleActionPropertyDao ; private ItemDAO idao ; private ItemGroupDAO igdao ; private ItemGroupMetadataDAO igmdao ; private ItemFormMetadataDAO itemFormMetadataDAO ; private SectionDAO sdao ; protected final Logger logger = LoggerFactory . getLogger ( getClass ( ) . getName ( ) ) ; public OpenRosaXmlGenerator ( CoreResources core , DataSource dataSource , RuleActionPropertyDao ruleActionPropertyDao ) throws Exception { } public String buildForm ( String formId ) throws Exception { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private ArrayList < ItemGroupBean > getItemGroupBeans ( SectionBean section ) throws Exception { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private ArrayList < ItemGroupBean > getItemGroupBeansByCrfVersion ( CRFVersionBean crfVersion ) throws Exception { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private ItemGroupBean getItemGroupBeanByItemId ( Integer itemId ) { } private SectionBean getSectionBean ( Integer ID ) { } @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private ItemBean getItemBean ( String itemOid ) { } private ItemBean getItemBean ( int itemId ) { } @ SuppressWarnings ( { "unused" , "rawtypes" } ) private ItemFormMetadataBean getItemFormMetadataBeanById ( Integer id ) throws OpenClinicaException { } @ SuppressWarnings ( "rawtypes" ) private ItemFormMetadataBean getItemFormMetadata ( ItemBean item , CRFVersionBean crfVersion ) throws Exception { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) private ItemGroupMetadataBean getItemGroupMetadata ( ItemGroupBean itemGroupBean , CRFVersionBean crfVersion , SectionBean section ) throws Exception { } @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) private ItemGroupMetadataBean getItemGroupMetadataByGroup ( ItemGroupBean itemGroupBean , CRFVersionBean crfVersion ) throws Exception { } private ArrayList < PropertyBean > getItemGroupPropertyBean ( String itemOid , String groupOid ) { } private ArrayList < PropertyBean > getGroupPropertyBean ( String groupOid ) { } private ExpressionExpressionEvaluate getSkipPattern ( ItemBean itemBean , ItemGroupBean itemGroupBean ) { } private HashMap < String , Object > getGroupInfo ( ItemGroupBean itemGroupBean , CRFVersionBean crfVersion , SectionBean section , WidgetFactory factory , ArrayList < Bind > bindList ) throws Exception { } private void setFormPaging ( Html html ) { } private Integer mapBeansToDTO ( Html html , CRFBean crf , CRFVersionBean crfVersion , ArrayList < SectionBean > crfSections ) throws Exception { } private String buildInstance ( Model model , CRFVersionBean crfVersion , ArrayList < SectionBean > crfSections ) throws Exception { } private void setDefaultElement ( ItemBean item , CRFVersionBean crfVersion , Element question ) throws Exception { } private Html buildJavaXForm ( String content ) throws Exception { } private String buildStringXForm ( Html html ) throws Exception { } private String getFullExpressionToParse ( String expression , CRFVersionBean version , boolean expressionEvaluates ) throws Exception { String result = "" ; expression = "<seq2seq4repair_space>" + expression ; expression = expression . replaceAll ( "\\(" , "\\(<seq2seq4repair_space>" ) ; <START_BUG> expression = expression . replaceAll ( "_CURRENT_DATE" , "<seq2seq4repair_space>format-date(today(),<seq2seq4repair_space>\"%Y-%n-%e\")<seq2seq4repair_space>" ) ; <END_BUG> expression = expression . replaceAll ( "<seq2seq4repair_space>I_" , "<seq2seq4repair_space>..//I_" ) ; expression = expression . replaceAll ( "\\S*//I_" , "<seq2seq4repair_space>..//I_" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>eq<seq2seq4repair_space>" , "<seq2seq4repair_space>=<seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>ct<seq2seq4repair_space>" , "<seq2seq4repair_space>=<seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>ne<seq2seq4repair_space>" , "<seq2seq4repair_space>!=<seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>gt<seq2seq4repair_space>" , "<seq2seq4repair_space>><seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>gte<seq2seq4repair_space>" , "<seq2seq4repair_space>>=<seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>lt<seq2seq4repair_space>" , "<seq2seq4repair_space><<seq2seq4repair_space>" ) ; expression = expression . replaceAll ( "<seq2seq4repair_space>lte<seq2seq4repair_space>" , "<seq2seq4repair_space><=<seq2seq4repair_space>" ) ; if ( expressionEvaluates == false ) { expression = ( "not(" + expression ) + ")" ; } String [ ] exprs = expression . split ( "<seq2seq4repair_space>" ) ; for ( String expr : exprs ) { if ( expr . contains ( "..//I_" ) ) { String itemOid = expr . substring ( 3 ) ; logger . info ( ( "itemOid:<seq2seq4repair_space>" + itemOid ) ) ; ItemBean itemBean = getItemBean ( itemOid ) ; ItemGroupBean itemGroupBean = getItemGroupBeanByItemId ( itemBean . getId ( ) ) ; expr = ( ( ( ( "//" + ( version . getOid ( ) ) ) + "//" ) + ( itemGroupBean . getOid ( ) ) ) + "//" ) + itemOid ; } result = ( result + "<seq2seq4repair_space>" ) + expr ; } logger . info ( ( "Full<seq2seq4repair_space>Expression<seq2seq4repair_space>is:<seq2seq4repair_space>" + result ) ) ; return result ; } private void setHeaderWidget ( ItemBean item , ItemFormMetadataBean itemFormMetadataBean , ItemGroupBean itemGroupBean , ArrayList < Bind > bindList , WidgetFactory factory , boolean isGroupRepeating , Repeat repeat , Group group , String itemExpression ) { } private void setSubHeaderWidget ( ItemBean item , ItemFormMetadataBean itemFormMetadataBean , ItemGroupBean itemGroupBean , ArrayList < Bind > bindList , WidgetFactory factory , boolean isGroupRepeating , Repeat repeat , Group group , String itemExpression ) { } private void setItemWidget ( ItemBean item , int responseTypeId , ItemFormMetadataBean itemFormMetadataBean , ItemGroupBean itemGroupBean , ArrayList < Bind > bindList , WidgetFactory factory , boolean isGroupRepeating , Repeat repeat , Group group , boolean isItemRequired , String responseLayout , String itemExpression ) { } private void setSectionWidget ( SectionBean section , CRFVersionBean crfVersion , String sectionExpression , ArrayList < Bind > bindList , WidgetFactory factory , Group singleSection ) { } private void setGroupWidget ( SectionBean section , CRFVersionBean crfVersion , String groupExpression , ArrayList < Bind > bindList , WidgetFactory factory , ItemGroupBean itemGroupBean , Group group , Repeat repeat , boolean isGroupRepeating , Label groupHeader ) { } public RuleActionPropertyDao getRuleActionPropertyDao ( ) { } public void setRuleActionPropertyDao ( RuleActionPropertyDao ruleActionPropertyDao ) { } No newline ; at end ; of file ; }

Fix:
expression = expression . replaceAll ( "_CURRENT_DATE" , "today()" ) ;