Buggy code:
public class VitessPreparedStatement extends VitessStatement implements PreparedStatement { private final boolean USE_BIND_VARIABLES ; private static Logger logger = Logger . getLogger ( VitessPreparedStatement . class . getName ( ) ) ; private final String sql ; private final Map < Integer , String > parameterMap ; private final Map < String , Object > bindVariables ; public VitessPreparedStatement ( VitessConnection vitessConnection , String sql ) throws SQLException { } public VitessPreparedStatement ( VitessConnection vitessConnection , String sql , int resultSetType , int resultSetConcurrency ) throws SQLException { } public VitessPreparedStatement ( VitessConnection vitessConnection , String sql , int resultSetType , int resultSetConcurrency , boolean useBindVariables ) throws SQLException { } public ResultSet executeQuery ( ) throws SQLException { } public int executeUpdate ( ) throws SQLException { VTGateConn vtGateConn ; Topodata . TabletType tabletType ; Cursor cursor ; checkOpen ( ) ; closeOpenResultSetAndResetCount ( ) ; vtGateConn = this . vitessConnection . getVtGateConn ( ) ; tabletType = this . vitessConnection . getTabletType ( ) ; if ( tabletType != ( TabletType . MASTER ) ) { throw new SQLException ( SQLExceptionMessages . DML_NOT_ON_MASTER ) ; } VTGateTx vtGateTx = this . vitessConnection . getVtGateTx ( ) ; if ( vtGateTx == null ) { Context context = this . vitessConnection . createContext ( this . queryTimeoutInMillis ) ; vtGateTx = vtGateConn . begin ( context ) . checkedGet ( ) ; this . vitessConnection . setVtGateTx ( vtGateTx ) ; } if ( this . vitessConnection . getAutoCommit ( ) ) { Context context = this . vitessConnection . createContext ( this . queryTimeoutInMillis ) ; cursor = executeSQL ( vtGateTx , USE_BIND_VARIABLES , context , this . sql , tabletType , this . bindVariables , this . parameterMap ) ; vtGateTx . commit ( context ) . checkedGet ( ) ; vtGateTx = null ; this . vitessConnection . setVtGateTx ( vtGateTx ) ; } else { Context context = this . vitessConnection . createContext ( this . queryTimeoutInMillis ) ; cursor = executeSQL ( vtGateTx , USE_BIND_VARIABLES , context , this . sql , tabletType , this . bindVariables , this . parameterMap ) ; } if ( null == cursor ) { throw new SQLException ( SQLExceptionMessages . METHOD_CALL_FAILED ) ; } <START_BUG> if ( null != ( cursor . getFields ( ) ) ) { <END_BUG> throw new SQLException ( SQLExceptionMessages . SQL_RETURNED_RESULT_SET ) ; } this . resultCount = cursor . getRowsAffected ( ) ; int truncatedUpdateCount ; if ( ( this . resultCount ) > ( Integer . MAX_VALUE ) ) { truncatedUpdateCount = Integer . MAX_VALUE ; } else { truncatedUpdateCount = ( ( int ) ( this . resultCount ) ) ; } return truncatedUpdateCount ; } public boolean execute ( ) throws SQLException { } public void clearParameters ( ) throws SQLException { } public void setNull ( int parameterIndex , int sqlType ) throws SQLException { } public void setBoolean ( int parameterIndex , boolean x ) throws SQLException { } public void setByte ( int parameterIndex , byte x ) throws SQLException { } public void setShort ( int parameterIndex , short x ) throws SQLException { } public void setInt ( int parameterIndex , int x ) throws SQLException { } public void setLong ( int parameterIndex , long x ) throws SQLException { } public void setFloat ( int parameterIndex , float x ) throws SQLException { } public void setDouble ( int parameterIndex , double x ) throws SQLException { } public void setBigDecimal ( int parameterIndex , BigDecimal x ) throws SQLException { } public void setString ( int parameterIndex , String x ) throws SQLException { } public void setBytes ( int parameterIndex , byte [ ] x ) throws SQLException { } public void setDate ( int parameterIndex , Date x ) throws SQLException { } public void setTime ( int parameterIndex , Time x ) throws SQLException { } public void setTimestamp ( int parameterIndex , Timestamp x ) throws SQLException { } public void setDate ( int parameterIndex , Date x , Calendar cal ) throws SQLException { } public void setTime ( int parameterIndex , Time x , Calendar cal ) throws SQLException { } public void setTimestamp ( int parameterIndex , Timestamp x , Calendar cal ) throws SQLException { } public void setObject ( int parameterIndex , Object x ) throws SQLException { } private void setMapVariable ( int parameterIndex , String str , Object x ) throws SQLException { } private Cursor executeSQL ( VTGateTx vtGateTx , final boolean useBindVariables , final Context context , final String sql , final Topodata . TabletType tabletType , final Map < String , Object > bindVariables , Map < Integer , String > parameterMap ) throws SQLException { } private String convertToStringLiteral ( String value ) { } public void addBatch ( ) throws SQLException { } public ParameterMetaData getParameterMetaData ( ) throws SQLException { } public void setNull ( int parameterIndex , int sqlType , String typeName ) throws SQLException { } public void setAsciiStream ( int parameterIndex , InputStream x , int length ) throws SQLException { } public void setBinaryStream ( int parameterIndex , InputStream x ) throws SQLException { } public void setCharacterStream ( int parameterIndex , Reader reader , int length ) throws SQLException { } public void setObject ( int parameterIndex , Object x , int targetSqlType , int scaleOrLength ) throws SQLException { } public void setAsciiStream ( int parameterIndex , InputStream x , long length ) throws SQLException { } public void setBinaryStream ( int parameterIndex , InputStream x , long length ) throws SQLException { } public void setCharacterStream ( int parameterIndex , Reader reader , long length ) throws SQLException { } public void setUnicodeStream ( int parameterIndex , InputStream x , int length ) throws SQLException { } public void setRef ( int parameterIndex , Ref x ) throws SQLException { }

Fix:
if ( ( null != ( cursor . getFields ( ) ) ) && ( ( cursor . getFields ( ) . size ( ) ) != 0 ) ) {