Buggy code:
public class NotificationManager { private static Logger log = Logger . getLogger ( NotificationManager . class . getName ( ) ) ; public ArrayList < Notification > getEnabledNotifications ( Connection sd , PreparedStatement pstmt , boolean forward_only ) throws SQLException { } public void addNotification ( Connection sd , PreparedStatement pstmt , String user , Notification n ) throws Exception { } public void updateNotification ( Connection sd , PreparedStatement pstmt , String user , Notification n ) throws Exception { } public boolean isFeedbackLoop ( Connection con , String server , Notification n ) throws SQLException { } public ArrayList < Notification > getProjectNotifications ( Connection sd , PreparedStatement pstmt , String user , int projectId ) throws SQLException { } public void deleteNotification ( Connection sd , PreparedStatement pstmt , String user , int id ) throws SQLException { } private void addToList ( ResultSet resultSet , ArrayList < Notification > notifications , boolean getPassword ) throws SQLException { } public void notifyForSubmission ( Connection sd , Connection cResults , PreparedStatement pstmtGetUploadEvent , PreparedStatement pstmtGetNotifications , PreparedStatement pstmtUpdateUploadEvent , PreparedStatement pstmtNotificationLog , int ue_id , String remoteUser , String serverName ) throws SQLException { ResultSet rs = null ; ResultSet rsNotifications = null ; int s_id = 0 ; String ident = null ; String instanceId = null ; NotificationManager . log . info ( ( "notifyForSubmission::<seq2seq4repair_space>" + ue_id ) ) ; String sqlGetUploadEvent = "select<seq2seq4repair_space>ue.s_id,<seq2seq4repair_space>ue.ident,<seq2seq4repair_space>ue.instanceid<seq2seq4repair_space>" + ( "<seq2seq4repair_space>from<seq2seq4repair_space>upload_event<seq2seq4repair_space>ue<seq2seq4repair_space>" + "<seq2seq4repair_space>where<seq2seq4repair_space>ue.ue_id<seq2seq4repair_space>=<seq2seq4repair_space>?;" ) ; try { if ( pstmtGetUploadEvent != null ) { pstmtGetUploadEvent . close ( ) ; } } catch ( SQLException e ) { } pstmtGetUploadEvent = sd . prepareStatement ( sqlGetUploadEvent ) ; String sqlGetNotifications = "select<seq2seq4repair_space>n.target,<seq2seq4repair_space>n.notify_details<seq2seq4repair_space>" + ( ( "<seq2seq4repair_space>from<seq2seq4repair_space>forward<seq2seq4repair_space>n<seq2seq4repair_space>" + "<seq2seq4repair_space>where<seq2seq4repair_space>n.s_id<seq2seq4repair_space>=<seq2seq4repair_space>?<seq2seq4repair_space>" ) + "<seq2seq4repair_space>and<seq2seq4repair_space>n.target<seq2seq4repair_space>!=<seq2seq4repair_space>'forward'" ) ; try { if ( pstmtGetNotifications != null ) { pstmtGetNotifications . close ( ) ; } } catch ( SQLException e ) { } pstmtGetNotifications = sd . prepareStatement ( sqlGetNotifications ) ; String sqlUpdateUploadEvent = "update<seq2seq4repair_space>upload_event<seq2seq4repair_space>set<seq2seq4repair_space>notifications_applied<seq2seq4repair_space>=<seq2seq4repair_space>'true'<seq2seq4repair_space>where<seq2seq4repair_space>ue_id<seq2seq4repair_space>=<seq2seq4repair_space>?;<seq2seq4repair_space>" ; try { if ( pstmtUpdateUploadEvent != null ) { pstmtUpdateUploadEvent . close ( ) ; } } catch ( SQLException e ) { } pstmtUpdateUploadEvent = sd . prepareStatement ( sqlUpdateUploadEvent ) ; String sqlNotificationLog = "insert<seq2seq4repair_space>into<seq2seq4repair_space>notification_log<seq2seq4repair_space>" + ( "(o_id,<seq2seq4repair_space>notify_details,<seq2seq4repair_space>status,<seq2seq4repair_space>status_details,<seq2seq4repair_space>event_time)<seq2seq4repair_space>" + "values(<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>?,<seq2seq4repair_space>now());<seq2seq4repair_space>" ) ; try { if ( pstmtNotificationLog != null ) { pstmtNotificationLog . close ( ) ; } } catch ( SQLException e ) { } pstmtNotificationLog = sd . prepareStatement ( sqlNotificationLog ) ; String adminEmail = UtilityMethodsEmail . getAdminEmail ( sd , remoteUser ) ; int o_id = GeneralUtilityMethods . getOrganisationId ( sd , remoteUser ) ; pstmtGetUploadEvent . setInt ( 1 , ue_id ) ; rs = pstmtGetUploadEvent . executeQuery ( ) ; if ( rs . next ( ) ) { s_id = rs . getInt ( 1 ) ; ident = rs . getString ( 2 ) ; instanceId = rs . getString ( 3 ) ; NotificationManager . log . info ( ( ( ( ( ( "Get<seq2seq4repair_space>notifications::<seq2seq4repair_space>" + s_id ) + "<seq2seq4repair_space>:<seq2seq4repair_space>" ) + ident ) + "<seq2seq4repair_space>:<seq2seq4repair_space>" ) + instanceId ) ) ; pstmtGetNotifications . setInt ( 1 , s_id ) ; rsNotifications = pstmtGetNotifications . executeQuery ( ) ; while ( rsNotifications . next ( ) ) { NotificationManager . log . info ( ( ( ( "++++++<seq2seq4repair_space>Notification:<seq2seq4repair_space>" + ( rsNotifications . getString ( 1 ) ) ) + "<seq2seq4repair_space>" ) + ( rsNotifications . getString ( 2 ) ) ) ) ; String target = rsNotifications . getString ( 1 ) ; String notifyDetailsString = rsNotifications . getString ( 2 ) ; NotifyDetails nd = new Gson ( ) . fromJson ( notifyDetailsString , NotifyDetails . class ) ; <START_BUG> String docUrl = ( ( "//webForm//" + ident ) + "&datakey=instanceid&datakeyvalue=" ) + instanceId ; <END_BUG> String status = "success" ; String notify_details = null ; String error_details = null ; if ( target . equals ( "email" ) ) { EmailServer emailServer = UtilityMethodsEmail . getSmtpHost ( sd , null , remoteUser ) ; if ( ( ( emailServer . smtpHost ) != null ) && ( ( emailServer . smtpHost . trim ( ) . length ( ) ) > 0 ) ) { ArrayList < String > emailList = null ; NotificationManager . log . info ( ( "Email<seq2seq4repair_space>question:<seq2seq4repair_space>" + ( nd . emailQuestion ) ) ) ; if ( ( nd . emailQuestion ) > 0 ) { emailList = GeneralUtilityMethods . getResponseForQuestion ( sd , cResults , s_id , nd . emailQuestion , instanceId ) ; } else { emailList = new ArrayList < String > ( ) ; } for ( String email : nd . emails ) { if ( ( email . length ( ) ) > 0 ) { NotificationManager . log . info ( ( "Adding<seq2seq4repair_space>static<seq2seq4repair_space>email:<seq2seq4repair_space>" + email ) ) ; emailList . add ( email ) ; } } String emails = "" ; for ( String email : emailList ) { if ( isValidEmail ( email ) ) { if ( ( emails . length ( ) ) > 0 ) { emails += ";" ; } emails += email ; } else { NotificationManager . log . info ( ( "Email<seq2seq4repair_space>Notifications:<seq2seq4repair_space>Discarding<seq2seq4repair_space>invalid<seq2seq4repair_space>email:<seq2seq4repair_space>" + email ) ) ; } } String subject = "Smap<seq2seq4repair_space>Notification" ; if ( ( nd . subject ) != null ) { subject = nd . subject ; } String from = "smap" ; if ( ( nd . from ) != null ) { from = nd . from ; } notify_details = ( ( "Sending<seq2seq4repair_space>email<seq2seq4repair_space>to:<seq2seq4repair_space>" + emails ) + "<seq2seq4repair_space>containing<seq2seq4repair_space>link<seq2seq4repair_space>" ) + docUrl ; NotificationManager . log . info ( ( ( ( ( ( ( ( ( ( "+++<seq2seq4repair_space>emailing<seq2seq4repair_space>to:<seq2seq4repair_space>" + emails ) + "<seq2seq4repair_space>:<seq2seq4repair_space>" ) + docUrl ) + "<seq2seq4repair_space>from:<seq2seq4repair_space>" ) + from ) + "<seq2seq4repair_space>subject:<seq2seq4repair_space>" ) + subject ) + "<seq2seq4repair_space>smtp_host:<seq2seq4repair_space>" ) + ( emailServer . smtpHost ) ) ) ;

Fix:
String docUrl = ( ( "//webForm//" + ident ) + "?datakey=instanceid&datakeyvalue=" ) + instanceId ;