Buggy code:
String domOnto = "" ; List < String > lst = ( ( List < String > ) ( sess . getAttribute ( "property_patternsA" ) ) ) ; if ( grConf . isDominantA ( ) ) domOnto = ( ( String ) ( sess . getAttribute ( "domA" ) ) ) ; else domOnto = ( ( String ) ( sess . getAttribute ( "domB" ) ) ) ; String name = URLDecoder . decode ( selectedFusions [ idx ] . pre , "UTF-8" ) ; String longName = selectedFusions [ idx ] . preL ; name = StringUtils . replace ( name , "&gt;" , ">" ) ; longName = StringUtils . replace ( longName , "&gt;" , ">" ) ; String [ ] newPredTokes = name . split ( "=>" ) ; String newPred = "" ; if ( ( newPredTokes . length ) == 2 ) { newPred = newPredTokes [ 1 ] ; } else { newPred = newPredTokes [ 0 ] ; } newPred = newPred . replaceAll ( "," , "_" ) ; System . out . println ( ( "Long<seq2seq4repair_space>name<seq2seq4repair_space>:<seq2seq4repair_space>" + longName ) ) ; String [ ] predicates = longName . split ( "=>" ) ; String leftPre = predicates [ 0 ] ; String rightPre = predicates [ 1 ] ; leftPre = StringUtils . removeEnd ( leftPre , "|" ) ; rightPre = StringUtils . removeEnd ( rightPre , "|" ) ; String [ ] leftPres = leftPre . split ( "\\|" ) ; String [ ] rightPres = rightPre . split ( "\\|" ) ; System . out . println ( ( "Left<seq2seq4repair_space>pres<seq2seq4repair_space>" + leftPre ) ) ; for ( String s : leftPres ) System . out . print ( ( s + "<seq2seq4repair_space>" ) ) ; System . out . println ( ) ; System . out . println ( ( "Right<seq2seq4repair_space>pres<seq2seq4repair_space>" + rightPre ) ) ; for ( String s : rightPres ) System . out . print ( ( s + "<seq2seq4repair_space>" ) ) ; clearPrevious ( leftPres , rightPres , grConf , nodeA , tGraph ) ; for ( String leftProp : leftPres ) { String [ ] mainPattern = leftProp . split ( "," ) ; List < String > patterns = findChains ( leftProp , lst ) ; for ( String pattern : patterns ) { String [ ] leftPreTokens = pattern . split ( "," ) ; StringBuilder q = new StringBuilder ( ) ; q . append ( ( ( "INSERT<seq2seq4repair_space>{<seq2seq4repair_space>GRAPH<seq2seq4repair_space><" + tGraph ) + "><seq2seq4repair_space>{<seq2seq4repair_space>" ) ) ; String prev_s = ( "<" + nodeA ) + ">" ; for ( int i = 0 ; i < ( ( mainPattern . length ) - 1 ) ; i ++ ) { q . append ( ( ( ( ( ( prev_s + "<seq2seq4repair_space><" ) + ( mainPattern [ i ] ) ) + "><seq2seq4repair_space>?o" ) + i ) + "<seq2seq4repair_space>.<seq2seq4repair_space>" ) ) ; prev_s = "?o" + i ; } q . append ( ( ( ( ( ( ( prev_s + "<seq2seq4repair_space><" ) + domOnto ) + newPred ) + "><seq2seq4repair_space>?o" ) + ( ( mainPattern . length ) - 1 ) ) + "<seq2seq4repair_space>.<seq2seq4repair_space>" ) ) ; prev_s = "?o" + ( ( mainPattern . length ) - 1 ) ; for ( int i = mainPattern . length ; i < ( leftPreTokens . length ) ; i ++ ) { q . append ( ( ( ( ( ( prev_s + "<seq2seq4repair_space><" ) + ( leftPreTokens [ i ] ) ) + "><seq2seq4repair_space>?o" ) + i ) + "<seq2seq4repair_space>.<seq2seq4repair_space>" ) ) ; prev_s = "?o" + i ; } prev_s = ( "<" + nodeA ) + ">" ; <START_BUG> q . append ( ( ( "}<seq2seq4repair_space>}<seq2seq4repair_space>WHERE<seq2seq4repair_space>{\n<seq2seq4repair_space>GRAPH<seq2seq4repair_space><" + ( grConf . getMetadataGraphB ( ) ) ) + "><seq2seq4repair_space>{" ) ) ; <END_BUG> for ( int i = 0 ; i < ( leftPreTokens . length ) ; i ++ ) { q . append ( ( ( ( ( ( prev_s + "<seq2seq4repair_space><" ) + ( leftPreTokens [ i ] ) ) + "><seq2seq4repair_space>?o" ) + i ) + "<seq2seq4repair_space>.<seq2seq4repair_space>" ) ) ; prev_s = "?o" + i ; } q . append ( "}<seq2seq4repair_space>}" ) ; System . out . println ( q . toString ( ) ) ; VirtuosoUpdateRequest vur = VirtuosoUpdateFactory . create ( q . toString ( ) , vSet ) ; vur . exec ( ) ; } } } private void metadataKeepBoth ( int idx , String nodeA , String tGraph , HttpSession sess , GraphConfig grConf , VirtGraph vSet , FuseLinkServlet . JSONPropertyFusion [ ] selectedFusions ) { } private void metadataKeepRight ( int idx , String nodeA , String tGraph , HttpSession sess , GraphConfig grConf , VirtGraph vSet , FuseLinkServlet . JSONPropertyFusion [ ] selectedFusions ) throws UnsupportedEncodingException { } private void updateGeom ( String subA , String subB , String geomA , String geomB , Connection dbConn ) throws SQLException { } private List < String > findChains ( String p , List < String > lst ) { } private String formInsertQuery ( String tGraph , String subject , String fusedGeometry ) { } private String formInsertGeomQuery ( String tGraph , String subject , String fusedGeometry ) { } private String formInsertConcatGeomQuery ( String tGraph , String subject , String geomA , String geomB ) { } private String formInsertQuery ( String tGraph , String subject , String predicate , String object ) { } private void executeVirtuosoUpdate ( String updateQuery , VirtGraph vSet ) { } @ Override protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override protected void doPost ( HttpServletRequest request , HttpServletResponse response ) throws IOException , ServletException { } @ Override public String getServletInfo ( ) { }

Fix:
q . append ( ( ( "}<seq2seq4repair_space>}<seq2seq4repair_space>WHERE<seq2seq4repair_space>{\n<seq2seq4repair_space>GRAPH<seq2seq4repair_space><" + ( grConf . getMetadataGraphA ( ) ) ) + "><seq2seq4repair_space>{" ) ) ;