Buggy code:
private static final String rightBrace = "}" ; private static final byte NULL_VALUE = ( ( byte ) ( 255 ) ) ; private static final String SYNTAX_ERR = "42X01" ; private static final int MGRLVL_3 = 3 ; private static final int MGRLVL_4 = 4 ; private static final int MGRLVL_5 = 5 ; private static final int MGRLVL_6 = 6 ; private static final int MGRLVL_7 = 7 ; private static final int COMMIT = 1 ; private static final int ROLLBACK = 2 ; protected CcsidManager ccsidManager = new EbcdicCcsidManager ( ) ; private int correlationID ; private InputStream sockis ; private OutputStream sockos ; private DDMReader reader ; private DDMWriter writer ; private DRDAXAProtocol xaProto ; private static int [ ] ACCRDB_REQUIRED = new int [ ] { CodePoint . RDBACCCL , CodePoint . CRRTKN , CodePoint . PRDID , CodePoint . TYPDEFNAM , CodePoint . TYPDEFOVR } ; private static int MAX_REQUIRED_LEN = 5 ; private int currentRequiredLength = 0 ; private int [ ] required = new int [ DRDAConnThread . MAX_REQUIRED_LEN ] ; private NetworkServerControlImpl server ; private Session session ; private long timeSlice ; private Object timeSliceSync = new Object ( ) ; private boolean logConnections ; private boolean sendWarningsOnCNTQRY = false ; private Object logConnectionsSync = new Object ( ) ; private boolean close ; private Object closeSync = new Object ( ) ; private static HeaderPrintWriter logStream ; private AppRequester appRequester ; private Database database ; private int sqlamLevel ; private byte diagnosticLevel = ( ( byte ) ( 240 ) ) ; private Vector unknownManagers ; private Vector knownManagers ; private Vector errorManagers ; private Vector errorManagersLevel ; private SQLException databaseAccessException ; private Pkgnamcsn prevPkgnamcsn = null ; private DRDAString rdbnam = new DRDAString ( ccsidManager ) ; private DRDAString rdbcolid = new DRDAString ( ccsidManager ) ; private DRDAString pkgid = new DRDAString ( ccsidManager ) ; private DRDAString pkgcnstkn = new DRDAString ( ccsidManager ) ; private int pkgsn ; private static final String TIMEOUT_STATEMENT = "SET<seq2seq4repair_space>STATEMENT_TIMEOUT<seq2seq4repair_space>" ; private int pendingStatementTimeout ; private static DecryptionManager decryptionManager ; private byte [ ] myPublicKey ; private byte [ ] myTargetSeed ; private static final byte [ ] eod00000 = new byte [ ] { '0' , '0' , '0' , '0' , '0' } ; private static final byte [ ] eod02000 = new byte [ ] { '0' , '2' , '0' , '0' , '0' } ; private static final byte [ ] nullSQLState = new byte [ ] { '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' } ; private static final byte [ ] errD4_D6 = new byte [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; private static final byte [ ] warn0_warnA = new byte [ ] { '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' , '<seq2seq4repair_space>' } ; private static final String AUTHENTICATION_PROVIDER_BUILTIN_CLASS = "org.apache.derby.impl.jdbc.authentication.BasicAuthenticationServiceImpl" ; private static final String AUTHENTICATION_PROVIDER_NONE_CLASS = "org.apache.derby.impl.jdbc.authentication.NoneAuthenticationServiceImpl" ; private static final DRDAProtocolExceptionInfo dummy = new DRDAProtocolExceptionInfo ( 0 , 0 , 0 , false ) ; DRDAConnThread ( Session session , NetworkServerControlImpl server , long timeSlice , boolean logConnections ) { } public void run ( ) { } protected InputStream getInputStream ( ) { } protected OutputStream getOutputStream ( ) { } protected DDMReader getReader ( ) { } protected DDMWriter getWriter ( ) { } protected int getCorrelationID ( ) { } protected Session getSession ( ) { } protected Database getDatabase ( ) { } protected NetworkServerControlImpl getServer ( ) { } protected byte [ ] getCrrtkn ( ) { } protected String getDbName ( ) { } protected void close ( ) { } protected void setLogConnections ( boolean value ) { } protected void setTimeSlice ( long value ) { } protected void markCommunicationsFailure ( String arg1 , String arg2 , String arg3 , String arg4 ) throws DRDAProtocolException { } protected void markCommunicationsFailure ( Exception e , String arg1 , String arg2 , String arg3 , String arg4 ) throws DRDAProtocolException { } protected void throwSyntaxrm ( int errcd , int cpArg ) throws DRDAProtocolException { } protected void agentError ( String msg ) throws DRDAProtocolException { } protected void missingCodePoint ( int codePoint ) throws DRDAProtocolException { } protected static void println2Log ( String dbname , String drdaID , String msg ) { } protected void writeRDBNAM ( String rdbnam ) throws DRDAProtocolException { } private void initialize ( ) { } private void initializeForSession ( ) { } private void sessionInitialState ( ) throws Exception { } private void cleanUpAndCloseResultSet ( DRDAStatement stmt , SQLException sqle , int writerMark ) throws DRDAProtocolException { } private void processCommands ( ) throws DRDAProtocolException { } private void errorInChain ( SQLException e ) throws DRDAProtocolException { } private void exchangeServerAttributes ( ) throws DRDAProtocolException { } private boolean parseDRDAConnection ( ) throws DRDAProtocolException { } private void writeRDBfailure ( int codePoint ) throws DRDAProtocolException { } private int getRdbAccessErrorCodePoint ( ) { } private int verifyUserIdPassword ( ) throws DRDAProtocolException { } private int getConnFromDatabaseName ( ) throws DRDAProtocolException { Properties p = new Properties ( ) ; databaseAccessException = null ; if ( ( session . drdaID ) == null ) session . drdaID = ( ( DRDAConnThread . leftBrace ) + ( session . connNum ) ) + ( DRDAConnThread . rightBrace ) ; p . put ( DRDAID_ATTR , session . drdaID ) ; if ( ( ( database . securityMechanism ) == ( CodePoint . SECMEC_USRSSBPWD ) ) && ( ( database . dbName . indexOf ( PASSWORD_ATTR ) ) == ( - 1 ) ) ) { <START_BUG> p . put ( CLIENT_SECURITY_MECHANISM , String . valueOf ( database . securityMechanism ) ) ; <END_BUG> p . put ( DRDA_SECTKN_IN , DecryptionManager . toHexString ( database . secTokenIn , 0 , database . secTokenIn . length ) ) ; p . put ( DRDA_SECTKN_OUT , DecryptionManager . toHexString ( database . secTokenOut , 0 , database . secTokenOut . length ) ) ; } try { database . makeConnection ( p ) ; } catch ( SQLException se ) { String sqlState = se . getSQLState ( ) ; databaseAccessException = se ; for ( ; se != null ;

Fix:
p . put ( DRDA_SECMEC , String . valueOf ( database . securityMechanism ) ) ;