Buggy code:
public class IRCHandler extends MonsterIRC { private BufferedWriter writer = null ; private Socket connection = null ; private BufferedReader reader = null ; private Thread watch = null ; private Thread print = null ; private final MonsterIRC plugin ; private Hashtable < Integer , String > MessageQueue = new Hashtable < Integer , String > ( ) ; int counter = - 1 ; public IRCHandler ( final MonsterIRC plugin ) { } public boolean connect ( final IRCServer server ) { if ( ( connection ) != null ) { if ( connection . isConnected ( ) ) { disconnect ( server ) ; } } String line = null ; int ping = - 1 ; int tries = 0 ; for ( int i = 0 ; i < ( server . getRetrys ( ) ) ; i ++ ) { ping = Configuration . ping ( server . getServer ( ) , server . getPort ( ) , server . getTimeout ( ) ) ; if ( ( ping < ( ( server . getTimeout ( ) ) + 1 ) ) && ( ping != ( - 1 ) ) ) { tries = i ; break ; } } if ( ( ping < ( ( server . getTimeout ( ) ) + 1 ) ) && ( ping != ( - 1 ) ) ) { IRC . log ( ( ( ( ( "The<seq2seq4repair_space>IRC<seq2seq4repair_space>server<seq2seq4repair_space>took<seq2seq4repair_space>" + ping ) + "<seq2seq4repair_space>MS<seq2seq4repair_space>to<seq2seq4repair_space>respond<seq2seq4repair_space>with<seq2seq4repair_space>" ) + tries ) + "<seq2seq4repair_space>retrys." ) ) ; try { connection = null ; connection = new Socket ( ) ; InetAddress addr = InetAddress . getByName ( server . getServer ( ) ) ; SocketAddress sockaddr = new InetSocketAddress ( addr , server . getPort ( ) ) ; connection . connect ( sockaddr ) ; writer = new BufferedWriter ( new OutputStreamWriter ( connection . getOutputStream ( ) ) ) ; reader = new BufferedReader ( new InputStreamReader ( connection . getInputStream ( ) ) ) ; IRC . log ( "Attempting<seq2seq4repair_space>to<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>chat." ) ; <START_BUG> if ( server . isIdentifing ( ) ) { <END_BUG> writer . write ( ( ( "PASS<seq2seq4repair_space>" + ( server . getPassword ( ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; } writer . write ( ( ( "NICK<seq2seq4repair_space>" + ( server . getNick ( ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; writer . write ( ( ( ( ( "USER<seq2seq4repair_space>" + ( server . getNick ( ) ) ) + "<seq2seq4repair_space>8<seq2seq4repair_space>*<seq2seq4repair_space>:" ) + ( plugin . getDescription ( ) . getVersion ( ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; IRC . log ( "Processing<seq2seq4repair_space>connection...." ) ; while ( ( line = reader . readLine ( ) ) != null ) { IRC . debug ( line , debug ) ; if ( ( line . contains ( "004" ) ) || ( line . contains ( "376" ) ) ) { for ( String s : server . getConnectCommands ( ) ) { writer . write ( ( s + "\r\n" ) ) ; writer . flush ( ) ; } break ; } else if ( line . contains ( "433" ) ) { if ( ! ( server . isIdentifing ( ) ) ) { IRC . log ( "Your<seq2seq4repair_space>nickname<seq2seq4repair_space>is<seq2seq4repair_space>already<seq2seq4repair_space>in<seq2seq4repair_space>use,<seq2seq4repair_space>please<seq2seq4repair_space>switch<seq2seq4repair_space>it" ) ; IRC . log ( "using<seq2seq4repair_space>\"nick<seq2seq4repair_space>[NAME]\"<seq2seq4repair_space>and<seq2seq4repair_space>try<seq2seq4repair_space>to<seq2seq4repair_space>connect<seq2seq4repair_space>again." ) ; disconnect ( server ) ; return false ; } else { IRC . log ( "Sending<seq2seq4repair_space>ghost<seq2seq4repair_space>command...." ) ; writer . write ( ( ( ( ( "NICKSERV<seq2seq4repair_space>GHOST<seq2seq4repair_space>" + ( server . getNick ( ) ) ) + "<seq2seq4repair_space>" ) + ( server . getNickservPassword ( ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; continue ; } } else if ( line . toLowerCase ( ) . startsWith ( "ping<seq2seq4repair_space>" ) ) { writer . write ( ( ( "PONG<seq2seq4repair_space>" + ( line . substring ( 5 ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; continue ; } } if ( server . isIdentifing ( ) ) { IRC . log ( "Identifying<seq2seq4repair_space>with<seq2seq4repair_space>Nickserv...." ) ; writer . write ( ( ( "NICKSERV<seq2seq4repair_space>IDENTIFY<seq2seq4repair_space>" + ( server . getNickservPassword ( ) ) ) + "\r\n" ) ) ; writer . flush ( ) ; } IRCConnectEvent cevent = new IRCConnectEvent ( server ) ; plugin . getServer ( ) . getPluginManager ( ) . callEvent ( cevent ) ; PluginConnectEvent pce = new PluginConnectEvent ( server ) ; MonsterIRC . getEventManager ( ) . dispatchEvent ( pce ) ; for ( IRCChannel c : Variables . channels ) { if ( c . isAutoJoin ( ) ) { MonsterIRC . getHandleManager ( ) . getIRCHandler ( ) . join ( c ) ; } } watch = new Thread ( KEEP_ALIVE ) ; watch . setDaemon ( true ) ; watch . setPriority ( Thread . MAX_PRIORITY ) ; watch . start ( ) ; print = new Thread ( DISPATCH ) ; print . setDaemon ( true ) ; print . setPriority ( Thread . NORM_PRIORITY ) ; print . start ( ) ; } catch ( Exception e ) { IRC . log ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>IRC!<seq2seq4repair_space>Try<seq2seq4repair_space>again<seq2seq4repair_space>in<seq2seq4repair_space>about<seq2seq4repair_space>1<seq2seq4repair_space>minute!" ) ; disconnect ( server ) ; } } else { IRC . log ( "The<seq2seq4repair_space>IRC<seq2seq4repair_space>server<seq2seq4repair_space>seems<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>down<seq2seq4repair_space>or<seq2seq4repair_space>running<seq2seq4repair_space>slowly!" ) ; IRC . log ( "To<seq2seq4repair_space>try<seq2seq4repair_space>conencting<seq2seq4repair_space>again<seq2seq4repair_space>run<seq2seq4repair_space>the<seq2seq4repair_space>command<seq2seq4repair_space>//irc<seq2seq4repair_space>connect" ) ; return false ; } return isConnected ( server ) ; } public boolean disconnect ( final IRCServer server ) { } public boolean isConnected ( final IRCServer server ) { } public void join ( final IRCChannel channel ) { } public void part ( final IRCChannel channel ) { } private final Runnable KEEP_ALIVE ; private final Runnable DISPATCH ; public void sendMessage ( final String channel , final String Message ) { } public void sendNotice ( final String to , final String message ) { }

Fix:
if ( ! ( server . getPassword ( ) . equalsIgnoreCase ( "" ) ) ) {