Buggy code:
public class SendMailCommand { private static final Logger logger = LoggingManager . getLoggerForClass ( ) ; private static final String TRUST_ALL_SOCKET_FACTORY = TrustAllSSLSocketFactory . class . getName ( ) ; private boolean useSSL = false ; private boolean useStartTLS = false ; private boolean trustAllCerts = false ; private boolean enforceStartTLS = false ; private boolean sendEmlMessage = false ; private boolean enableDebug ; private String smtpServer ; private String smtpPort ; private String sender ; private List < InternetAddress > replyTo ; private String emlMessage ; private List < InternetAddress > receiverTo ; private List < InternetAddress > receiverCC ; private List < InternetAddress > receiverBCC ; private CollectionProperty headerFields ; private String subject = "" ; private boolean useAuthentication = false ; private String username ; private String password ; private boolean useLocalTrustStore ; private String trustStoreToUse ; private List < File > attachments ; private String mailBody ; private boolean synchronousMode ; private Session session ; private StringBuilder serverResponse = new StringBuilder ( ) ; private boolean plainBody ; public SendMailCommand ( ) { } public Message prepareMessage ( ) throws IOException , MessagingException { } public void execute ( Message message ) throws IOException , InterruptedException , MessagingException { Transport tr = session . getTransport ( getProtocol ( ) ) ; SynchronousTransportListener listener = null ; if ( synchronousMode ) { listener = new SynchronousTransportListener ( ) ; tr . addTransportListener ( listener ) ; } if ( useAuthentication ) { tr . connect ( smtpServer , username , password ) ; } else { tr . connect ( ) ; } tr . sendMessage ( message , message . getAllRecipients ( ) ) ; <START_BUG> if ( synchronousMode ) { <END_BUG> listener . attend ( ) ; } tr . close ( ) ; SendMailCommand . logger . debug ( "transport<seq2seq4repair_space>closed" ) ; SendMailCommand . logger . debug ( "message<seq2seq4repair_space>sent" ) ; return ; } public void execute ( ) throws Exception { } public String getSmtpServer ( ) { } public void setSmtpServer ( String smtpServer ) { } public String getSender ( ) { } public void setSender ( String sender ) { } public String getSubject ( ) { } public void setSubject ( String subject ) { } public String getUsername ( ) { } public void setUsername ( String username ) { } public String getPassword ( ) { } public void setPassword ( String password ) { } public void setReceiverTo ( List < InternetAddress > receiverTo ) { } public List < InternetAddress > getReceiverCC ( ) { } public void setReceiverCC ( List < InternetAddress > receiverCC ) { } public List < InternetAddress > getReceiverBCC ( ) { } public void setReceiverBCC ( List < InternetAddress > receiverBCC ) { } public boolean isUseAuthentication ( ) { } public void setUseAuthentication ( boolean useAuthentication ) { } public boolean getUseSSL ( ) { } public void setUseSSL ( boolean useSSL ) { } public boolean getUseStartTLS ( ) { } public void setUseStartTLS ( boolean useStartTLS ) { } public String getSmtpPort ( ) { } public void setSmtpPort ( String smtpPort ) { } public boolean isTrustAllCerts ( ) { } public void setTrustAllCerts ( boolean trustAllCerts ) { } public void setEnforceStartTLS ( boolean enforceStartTLS ) { } public boolean isEnforceStartTLS ( ) { } public CollectionProperty getHeaders ( ) { } public void setHeaderFields ( CollectionProperty headerFields ) { } public void addHeader ( String headerName , String headerValue ) { } public void clearHeaders ( ) { } public List < File > getAttachments ( ) { } public void setAttachments ( List < File > attachments ) { } public void addAttachment ( File attachment ) { } public void clearAttachments ( ) { } public boolean isSynchronousMode ( ) { } public void setSynchronousMode ( boolean synchronousMode ) { } private String getProtocol ( ) { } private String getPort ( ) { } public void setUseLocalTrustStore ( boolean useLocalTrustStore ) { } public void setTrustStoreToUse ( String trustStoreToUse ) { } public void setUseEmlMessage ( boolean sendEmlMessage ) { } public void setEmlMessage ( String emlMessage ) { } public void setMailBody ( String body ) { } public void setPlainBody ( boolean plainBody ) { } public String getServerResponse ( ) { } public void setEnableDebug ( boolean selected ) { } public void setReplyTo ( List < InternetAddress > replyTo ) { } }

Fix:
if ( listener != null ) {