Buggy code:
sql + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } line . deleteCharAt ( ( ( line . length ( ) ) - 1 ) ) ; line . append ( ")," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>status=VALUES(status),<seq2seq4repair_space>" ) ; sql . append ( "deal_time=VALUES(deal_time),<seq2seq4repair_space>deal_man=VALUES(deal_man),<seq2seq4repair_space>" ) ; sql . append ( "deal_type=VALUES(deal_type),<seq2seq4repair_space>deal_desc=VALUES(deal_desc);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; sql3 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>org_deal_flag<seq2seq4repair_space>=<seq2seq4repair_space>1<seq2seq4repair_space>where<seq2seq4repair_space>status='上门成功';" ; break ; case CallFailCityStatus : standardColumns = CallFailDoorBackListColumn . getStandardColumns ( ) ; sql = new StringBuffer ( ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>t_call_fail_list(policy_no,<seq2seq4repair_space>door_back_date,<seq2seq4repair_space>door_stats_date,<seq2seq4repair_space>" + "deal_type,<seq2seq4repair_space>deal_time,<seq2seq4repair_space>deal_man)<seq2seq4repair_space>VALUES<seq2seq4repair_space>" ) ) ; line = null ; for ( DataRow row : dt . Rows ) { line = new StringBuffer ( "(" ) ; for ( ColumnItem item : standardColumns ) { if ( item . getDisplayName ( ) . contains ( "回访日期" ) ) { val = row . getValue ( item . getDisplayName ( ) ) ; if ( ( val == null ) || ( ( val . toString ( ) . trim ( ) . length ( ) ) <= 0 ) ) { line . append ( "null," ) ; } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } line . deleteCharAt ( ( ( line . length ( ) ) - 1 ) ) ; line . append ( ")," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>door_back_date=VALUES(door_back_date),<seq2seq4repair_space>door_stats_date=VALUES(door_stats_date),<seq2seq4repair_space>" ) ; sql . append ( "deal_type=VALUES(deal_type),<seq2seq4repair_space>deal_time=VALUES(deal_time),<seq2seq4repair_space>deal_man=VALUES(deal_man);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; sql3 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>status='上门成功'<seq2seq4repair_space>where<seq2seq4repair_space>deal_type='上门成功'" ; sql4 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>status='上门失败'<seq2seq4repair_space>where<seq2seq4repair_space>deal_type<>'上门成功'" ; sql5 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>org_deal_flag<seq2seq4repair_space>=<seq2seq4repair_space>1<seq2seq4repair_space>where<seq2seq4repair_space>status='上门成功';" ; break ; case CallFailMailStatus : standardColumns = CallFailMailListColumn . getStandardColumns ( ) ; sql = new StringBuffer ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>t_call_fail_list(policy_no,<seq2seq4repair_space>letter_date,<seq2seq4repair_space>has_letter)<seq2seq4repair_space>VALUES<seq2seq4repair_space>" ) ; line = null ; for ( DataRow row : dt . Rows ) { line = new StringBuffer ( "(" ) ; for ( ColumnItem item : standardColumns ) { if ( item . getDisplayName ( ) . contains ( "信函日期" ) ) { val = row . getValue ( item . getDisplayName ( ) ) ; if ( ( val == null ) || ( ( val . toString ( ) . trim ( ) . length ( ) ) <= 0 ) ) { line . append ( "null," ) ; } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } line . append ( "\"信函已发\"<seq2seq4repair_space>)," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>" ) ; sql . append ( "letter_date=VALUES(letter_date),<seq2seq4repair_space>has_letter=VALUES(has_letter);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; break ; case CallFailMailBackStatus : standardColumns = CallFailMailBackListColumn . getStandardColumns ( ) ; sql = new StringBuffer ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>t_call_fail_list(policy_no,<seq2seq4repair_space>mail_fail_reason,<seq2seq4repair_space>mail_fail_date)<seq2seq4repair_space>VALUES<seq2seq4repair_space>" ) ; line = null ; for ( DataRow row : dt . Rows ) { line = new StringBuffer ( "(" ) ; for ( ColumnItem item : standardColumns ) { if ( ( item . getDisplayName ( ) . contains ( "退信时间" ) ) || ( item . getDisplayName ( ) . contains ( "回邮时间" ) ) ) { val = row . getValue ( item . getDisplayName ( ) ) ; if ( ( val == null ) || ( ( val . toString ( ) . trim ( ) . length ( ) ) <= 0 ) ) { line . append ( "null," ) ; } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } line . append ( ")," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>mail_fail_reason=VALUES(mail_fail_reason),<seq2seq4repair_space>" ) ; sql . append ( "mail_fail_date=VALUES(mail_fail_date);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; break ; case CallFailMailSuccessStatus : standardColumns = CallFailMailBackListColumn . getStandardColumns ( ) ; sql = new StringBuffer ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>t_call_fail_list(policy_no,<seq2seq4repair_space>has_letter,<seq2seq4repair_space>mail_back_date,<seq2seq4repair_space>client_sign_date)<seq2seq4repair_space>VALUES<seq2seq4repair_space>" ) ; line = null ; for ( DataRow row : dt . Rows ) { line = new StringBuffer ( "(" ) ; for ( ColumnItem item : standardColumns ) { if ( ( item . getDisplayName ( ) . contains ( "退信时间" ) ) || ( item . getDisplayName ( ) . contains ( "回邮时间" ) ) ) { val = row . getValue ( item . getDisplayName ( ) ) ; if ( ( val == null ) || ( ( val . toString ( ) . trim ( ) . length ( ) ) <= 0 ) ) { line . append ( "null," ) ; } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } else { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } } line . append ( "1<seq2seq4repair_space>)," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>has_letter=VALUES(has_letter),<seq2seq4repair_space>" ) ; sql . append ( "mail_back_date=VALUES(mail_back_date),<seq2seq4repair_space>client_sign_date=VALUES(client_sign_date);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; break ; case CallFailNeedDoorStatus : standardColumns = CallFailNeedDoorListColumn . getStandardColumns ( ) ; sql = new StringBuffer ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>t_call_fail_list(policy_no,<seq2seq4repair_space>status)<seq2seq4repair_space>VALUES<seq2seq4repair_space>" ) ; line = null ; for ( DataRow row : dt . Rows ) { line = new StringBuffer ( "(" ) ; for ( ColumnItem item : standardColumns ) { line . append ( ( ( "\"" + ( StringUtil . trimStr ( row . getValue ( item . getDisplayName ( ) ) ) ) ) + "\"," ) ) ; } line . deleteCharAt ( ( ( line . length ( ) ) - 1 ) ) ; line . append ( ")," ) ; sql . append ( line ) ; } sql . deleteCharAt ( ( ( sql . length ( ) ) - 1 ) ) ; sql . append ( "<seq2seq4repair_space>ON<seq2seq4repair_space>DUPLICATE<seq2seq4repair_space>KEY<seq2seq4repair_space>UPDATE<seq2seq4repair_space>" ) ; sql . append ( "status=VALUES(status);" ) ; UploadDataServiceImpl . log . debug ( ( "----------------batch<seq2seq4repair_space>update<seq2seq4repair_space>:<seq2seq4repair_space>" + sql ) ) ; sql2 = "delete<seq2seq4repair_space>from<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>where<seq2seq4repair_space>issue_no<seq2seq4repair_space>is<seq2seq4repair_space>null" ; <START_BUG> sql3 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>status=deal_status<seq2seq4repair_space>where<seq2seq4repair_space>deal_status<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>null" ; <END_BUG>

Fix:
sql3 = "update<seq2seq4repair_space>t_call_fail_list<seq2seq4repair_space>set<seq2seq4repair_space>status=deal_status<seq2seq4repair_space>where<seq2seq4repair_space>deal_status<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>null<seq2seq4repair_space>and<seq2seq4repair_space>status<>\"二访成功\"" ;