Buggy code:
public SQLException { } public void setDate ( PreparedStatement stmnt , int idx , java . util . Date val , Column col ) throws SQLException { } public void setDate ( PreparedStatement stmnt , int idx , Date val , Calendar cal , Column col ) throws SQLException { } public void setCalendar ( PreparedStatement stmnt , int idx , Calendar val , Column col ) throws SQLException { } public void setDouble ( PreparedStatement stmnt , int idx , double val , Column col ) throws SQLException { } public void setFloat ( PreparedStatement stmnt , int idx , float val , Column col ) throws SQLException { } public void setInt ( PreparedStatement stmnt , int idx , int val , Column col ) throws SQLException { } public void setLong ( PreparedStatement stmnt , int idx , long val , Column col ) throws SQLException { } public void setLocale ( PreparedStatement stmnt , int idx , Locale val , Column col ) throws SQLException { } public void setNull ( PreparedStatement stmnt , int idx , int colType , Column col ) throws SQLException { } public void setNumber ( PreparedStatement stmnt , int idx , Number num , Column col ) throws SQLException { } public void setObject ( PreparedStatement stmnt , int idx , Object val , int colType , Column col ) throws SQLException { } public void setRef ( PreparedStatement stmnt , int idx , Ref val , Column col ) throws SQLException { } public void setShort ( PreparedStatement stmnt , int idx , short val , Column col ) throws SQLException { } public void setString ( PreparedStatement stmnt , int idx , String val , Column col ) throws SQLException { } public void setTime ( PreparedStatement stmnt , int idx , Time val , Calendar cal , Column col ) throws SQLException { } public void setTimestamp ( PreparedStatement stmnt , int idx , Timestamp val , Calendar cal , Column col ) throws SQLException { } public void setTyped ( PreparedStatement stmnt , int idx , Object val , Column col , int type , JDBCStore store ) throws SQLException { } public void setUnknown ( PreparedStatement stmnt , int idx , Object val , Column col ) throws SQLException { } public byte [ ] serialize ( Object val , JDBCStore store ) throws SQLException { } public void putBytes ( Object blob , byte [ ] data ) throws SQLException { } public void putString ( Object clob , String data ) throws SQLException { } public void putChars ( Object clob , char [ ] data ) throws SQLException { } private static Object invokePutLobMethod ( Method method , Object target , Object [ ] args ) throws SQLException { } protected void storageWarning ( Object orig , Object converted ) { } public int getJDBCType ( int metaTypeCode , boolean lob ) { } public int getPreferredType ( int type ) { } public String getTypeName ( Column col ) { } public String getTypeName ( int type ) { } protected String appendSize ( Column col , String typeName ) { } public void setJoinSyntax ( String syntax ) { } public String getPlaceholderValueString ( Column col ) { } public SQLBuffer toSelectCount ( Select sel ) { } public SQLBuffer toDelete ( ClassMapping mapping , Select sel , Object [ ] params ) { } public SQLBuffer toUpdate ( ClassMapping mapping , Select sel , JDBCStore store , Object [ ] params , Map updates ) { } protected SQLBuffer toBulkOperation ( ClassMapping mapping , Select sel , JDBCStore store , Object [ ] params , Map updateParams ) { } protected void appendUpdates ( Select sel , JDBCStore store , SQLBuffer sql , Object [ ] params , Map updateParams , boolean allowAlias ) { } public String [ ] getDeleteTableContentsSQL ( Table [ ] tables ) { } public SQLBuffer toSelect ( Select sel , boolean forUpdate , JDBCFetchConfiguration fetch ) { } protected SQLBuffer getFrom ( Select sel , boolean forUpdate ) { } protected SQLBuffer getFromSelect ( Select sel , boolean forUpdate ) { } protected SQLBuffer getWhere ( Select sel , boolean forUpdate ) { } public SQLBuffer toTraditionalJoin ( Join join ) { } public SQLBuffer toSQL92Join ( Join join , boolean forUpdate , boolean first ) { } public SQLBuffer toNativeJoin ( Join join ) { } public boolean canOuterJoin ( int syntax , ForeignKey fk ) { } public SQLBuffer toSelect ( SQLBuffer selects , JDBCFetchConfiguration fetch , SQLBuffer from , SQLBuffer where , SQLBuffer group , SQLBuffer having , SQLBuffer order , boolean distinct , boolean forUpdate , long start , long end ) { } public String getSelectOperation ( JDBCFetchConfiguration fetch ) { } protected SQLBuffer toOperation ( String op , SQLBuffer selects , SQLBuffer from , SQLBuffer where , SQLBuffer group , SQLBuffer having , SQLBuffer order , boolean distinct , boolean forUpdate , long start , long end ) { } protected void appendSelectRange ( SQLBuffer buf , long start , long end ) { } protected SQLBuffer getSelects ( Select sel , boolean distinctIdentifiers , boolean forUpdate ) { } public boolean supportsLocking ( Select sel ) { } public boolean supportsRandomAccessResultSet ( Select sel , boolean forUpdate ) { } public void assertSupport ( boolean feature , String property ) { } public void substring ( SQLBuffer buf , FilterValue str , FilterValue start , FilterValue end ) { } public void indexOf ( SQLBuffer buf , FilterValue str , FilterValue find , FilterValue start ) { } public void mathFunction ( SQLBuffer buf , String op , FilterValue lhs , FilterValue rhs ) { boolean castlhs = false ; boolean castrhs = false ; Class lc = Filters . wrap ( lhs . getType ( ) ) ; Class rc = Filters . wrap ( rhs . getType ( ) ) ; int type = 0 ; if ( ( requiresCastForMathFunctions ) && ( ( lc != rc ) || ( ( lhs . isConstant ( ) ) && ( rhs . isConstant ( ) ) ) ) ) { Class c = Filters . promote ( lc , rc ) ; type = getJDBCType ( JavaTypes . getTypeCode ( c ) , false ) ; if ( ( type != ( Types . VARBINARY ) ) && ( type != ( Types . BLOB ) ) ) { castlhs = ( ( lhs . isConstant ( ) ) && ( rhs . isConstant ( ) ) ) || ( lc != c ) ; castrhs = ( ( lhs . isConstant ( ) ) && ( rhs . isConstant ( ) ) ) || ( rc != c ) ; } } boolean mod = "MOD" . equals ( op ) ; if ( mod ) { if ( supportsModOperator ) op = "%" ; else buf . append ( op ) ; } buf . append ( "(" ) ; if ( castlhs ) appendCast ( buf , lhs , type ) ; else lhs . appendTo ( buf ) ; <START_BUG> if ( mod ) <END_BUG>

Fix:
if ( mod && ( ! ( supportsModOperator ) ) )