Buggy code:
public class CtxdMDAOImpl extends QueryInstanceSDAOImpl implements ICtxdMDAO { private Map fetchRow ( List columns , ResultSet rs ) throws AppException , SysException , SQLException { } public PagView queryResult ( String instanceId , List conditionListFromPage , PagInfo pagInfo , Map sortMap ) throws AppException , SysException { } public List exportResult ( String instanceId , List conditionListFromPage , Map sortMap ) throws AppException , SysException { } private void fillParameters ( List conditions , Sql sql ) { } public DTableDescSVO getTableByName ( String tableName ) throws AppException , SysException { } private String getWholeSql ( String instanceId , List conditionListFromPage , Map sortMap ) throws AppException , SysException { } private String getWholeSql4Group ( String instanceId , List conditionListFromPage , Map sortMap ) throws AppException , SysException { } private String getConditionSql ( List conditions ) throws AppException , SysException { } private String getSqlColumns4Group ( List columns ) throws AppException , SysException { if ( ( columns == null ) || ( ( columns . size ( ) ) == 0 ) ) { throw new AppException ( "11111" , "»ñÈ¡²»µ½×Ö¶ÎÁÐ±í£¡" ) ; } String queryColum = "" ; for ( int i = 0 ; i < ( columns . size ( ) ) ; i ++ ) { QueryInstanceColumnSVO column = ( ( QueryInstanceColumnSVO ) ( columns . get ( i ) ) ) ; String columnName = column . getColumnName ( ) ; String dataType = column . getDataType ( ) ; String isSum = column . getIsSum ( ) ; String isGroup = column . getIsGroup ( ) ; if ( "Y" . equals ( isSum ) ) { <START_BUG> columnName = ( ( ( ( "sum(<seq2seq4repair_space>case<seq2seq4repair_space>when<seq2seq4repair_space>" + columnName ) + "<seq2seq4repair_space>is<seq2seq4repair_space>null<seq2seq4repair_space>then<seq2seq4repair_space>0<seq2seq4repair_space>else<seq2seq4repair_space>" ) + columnName ) + "<seq2seq4repair_space>end)<seq2seq4repair_space>as<seq2seq4repair_space>" ) + columnName ; <END_BUG> } if ( Tools . isDateType ( dataType ) ) { columnName = ( ( "<seq2seq4repair_space>to_char(" + columnName ) + ",'yyyy-mm-dd')<seq2seq4repair_space>as<seq2seq4repair_space>" ) + columnName ; } queryColum = ( queryColum + columnName ) + "," ; } queryColum = queryColum . substring ( 0 , ( ( queryColum . length ( ) ) - 1 ) ) ; return queryColum ; } private String getSqlColumns ( List columns ) throws AppException , SysException { } public List getQueryCondition ( String instanceId , List conditionListFromPage ) throws AppException , SysException { } public String getSqlGroup ( List columns ) throws AppException , SysException { } private List getQueryConditionData ( String instanceId , String columnName ) throws AppException , SysException { } public List getFuncNodeListByUser ( SysUserSVO vo ) throws AppException , SysException { } public List getDBTables ( ) throws AppException , SysException { } public DTableDescSVO getConfigTableInfo ( String tableId ) throws AppException , SysException { } public List getColumnDescList ( String tableName ) throws AppException , SysException { } public void addBat ( List vos ) throws AppException , SysException { } public List getColumnCommentsByTable ( String tableName ) throws AppException , SysException { } public PagView getQueryInstanceList ( QueryInstanceSVO i , PagInfo pagInfo ) throws AppException , SysException { } public List getColumnList ( String instacneId ) throws AppException , SysException { } public List getQueryConditionList ( String instanceId ) throws AppException , SysException { } public List getFuncNodeListByUserNew ( SysUserSVO vo ) throws AppException , SysException { } }

Fix:
columnName = ( ( ( ( "sum(<seq2seq4repair_space>case<seq2seq4repair_space>when<seq2seq4repair_space>" + columnName ) + "<seq2seq4repair_space>is<seq2seq4repair_space>null<seq2seq4repair_space>then<seq2seq4repair_space>0<seq2seq4repair_space>else<seq2seq4repair_space>" ) + columnName ) + "+0<seq2seq4repair_space>end)<seq2seq4repair_space>as<seq2seq4repair_space>" ) + columnName ;