Buggy code:
public class PrintPageController implements Initializable { private DatabaseManager dbManager ; private ArrayList < CheckBox > routeBoxes ; @ FXML private FlowPane flowScrollRoutes ; @ FXML private TextArea txtAreaReport ; @ FXML private Button btnPrintReport ; private ArrayList < String > strReport ; @ Override public void initialize ( URL arg0 , ResourceBundle arg1 ) { } public void keyPressedAction ( KeyEvent ke ) { } public void btnCreateReportAction ( ActionEvent ae ) { } public void btnPrintReportAction ( ActionEvent ae ) { ae . consume ( ) ; File dir = new File ( ".//Prints" ) ; if ( ! ( dir . exists ( ) ) ) { boolean dirResult = dir . mkdir ( ) ; if ( dirResult ) { System . out . println ( "Directory<seq2seq4repair_space>Created" ) ; } } Date d = new Date ( ) ; SimpleDateFormat format = new SimpleDateFormat ( "MM-dd-yyyy" ) ; String fileName = "" ; fileName += ".//Prints//" ; fileName += format . format ( d ) ; fileName += "-" ; fileName += String . valueOf ( d . getTime ( ) ) ; fileName += ".txt" ; File f = new File ( fileName ) ; if ( ! ( f . exists ( ) ) ) { try { boolean fileResult = f . createNewFile ( ) ; if ( fileResult ) { FileOutputStream ostream = new FileOutputStream ( f . getAbsolutePath ( ) ) ; OutputStreamWriter owriter = new OutputStreamWriter ( ostream , "UTF-8" ) ; for ( String s : strReport ) { owriter . write ( ( s + "\n" ) ) ; } owriter . close ( ) ; ostream . close ( ) ; JTextArea jtext = new JTextArea ( ) ; jtext . setSize ( 470 , 277 ) ; jtext . setText ( "" ) ; jtext . setFont ( new Font ( "Monospaced" , Font . PLAIN , 12 ) ) ; for ( String s : strReport ) { jtext . setText ( ( ( ( jtext . getText ( ) ) + s ) + "\n" ) ) ; } try { if ( jtext . print ( ) ) { if ( Boolean . valueOf ( properties . getProperty ( "EMAILENABLE" ) ) ) { if ( properties . getProperty ( "EMAILSEND" ) . equals ( "PRINT" ) ) { try { Properties props = new Properties ( ) ; props . put ( "mail.smtp.starttls.enable" , "true" ) ; props . put ( "mail.smtp.host" , properties . getProperty ( "EMAILHOST" ) ) ; props . put ( "mail.smtp.port" , properties . getProperty ( "EMAILPORT" ) ) ; Session sess ; <START_BUG> if ( ! ( Boolean . valueOf ( properties . getProperty ( "EMAILAUTHREQ" ) ) ) ) { <END_BUG> props . put ( "mail.smtp.auth" , "false" ) ; sess = Session . getDefaultInstance ( props ) ; } else { props . put ( "mail.smtp.auth" , "true" ) ; sess = Session . getInstance ( props , new Authenticator ( ) { protected PasswordAuthentication getPasswordAuthentication ( ) { return new PasswordAuthentication ( properties . getProperty ( "EMAILUSERNAME" ) , properties . getProperty ( "EMAILPASSWORD" ) ) ; } } ) ; } MimeMessage message = new MimeMessage ( sess ) ; boolean sendEmail = false ; Address [ ] a = new Address [ 1 ] ; a [ 0 ] = new javax . mail . internet . InternetAddress ( properties . getProperty ( "EMAILREPLYTO" ) ) ; message . setReplyTo ( a ) ; message . setFrom ( new javax . mail . internet . InternetAddress ( properties . getProperty ( "EMAILREPLYTO" ) ) ) ; message . setSubject ( "Package<seq2seq4repair_space>Delivery<seq2seq4repair_space>Notice" ) ; message . setText ( properties . getProperty ( "EMAILMESSAGE" ) ) ; for ( CheckBox c : routeBoxes ) { if ( c . isSelected ( ) ) { for ( Route r : dbManager . getRoutes ( ) ) { if ( r . getRouteName ( ) . equals ( c . getText ( ) ) ) { for ( Stop s : dbManager . getStopsOnRoute ( r ) ) { if ( ( dbManager . getPackagesForStop ( s ) . size ( ) ) > 0 ) { ArrayList < String > addresses = ( ( ArrayList < String > ) ( dbManager . getEmailAddress ( s ) ) ) ; if ( ( addresses . size ( ) ) > 0 ) { sendEmail = true ; for ( String str : addresses ) { message . addRecipients ( BCC , str ) ; } } } } } } } } if ( sendEmail ) { Transport . send ( message ) ; } } catch ( MessagingException e ) { Logger . logException ( e ) ; MessageDialogBuilder . error ( ) . message ( "Error<seq2seq4repair_space>Sending<seq2seq4repair_space>Email" ) . title ( "ERROR" ) . buttonType ( OK ) . show ( stage . getScene ( ) . getWindow ( ) ) ; } } } for ( CheckBox c : routeBoxes ) { if ( c . isSelected ( ) ) { for ( Route r : dbManager . getRoutes ( ) ) { if ( r . getRouteName ( ) . equals ( c . getText ( ) ) ) { for ( Stop s : dbManager . getStopsOnRoute ( r ) ) { if ( s . getAutoRemove ( ) ) { for ( Package p : dbManager . getPackagesForStop ( s ) ) { dbManager . updatePackage ( p . getPackageId ( ) , true , true ) ; } } } } } } } } } catch ( PrinterException e ) { Logger . logException ( e ) ; MessageDialogBuilder . error ( ) . message ( "Error<seq2seq4repair_space>Printing" ) . title ( "ERROR" ) . buttonType ( OK ) . show ( stage . getScene ( ) . getWindow ( ) ) ; } } }

Fix:
if ( properties . getProperty ( "EMAILAUTHREQ" ) . equalsIgnoreCase ( "false" ) ) {