Buggy code:
@ WebServlet ( name = "database" , loadOnStartup = 1 , value = { } ) public class Database extends HttpServlet { private static final Logger logger = LoggerFactory . getLogger ( Database . class ) ; private static final long serialVersionUID = 2460919096215614297L ; private static DatabaseConnectionPool pool ; private static Driver driver ; @ Override public void init ( ) throws ServletException { Database . logger . info ( "initialize" ) ; try { Class . forName ( "org.postgresql.Driver" ) ; } catch ( ClassNotFoundException e ) { throw new ServletException ( e ) ; } for ( Driver d : Collections . list ( DriverManager . getDrivers ( ) ) ) { if ( d . getClass ( ) . equals ( Driver . class ) ) { Database . driver = d ; } } try { DriverManager . registerDriver ( Database . driver ) ; } catch ( SQLException e ) { throw new ServletException ( e ) ; } Database . pool = new DatabaseConnectionPool ( 10 ) ; try { Database . pool . startup ( ) ; } catch ( IllegalStateException e ) { throw new ServletException ( e ) ; } catch ( SQLException e ) { throw new ServletException ( e ) ; } try { Connection connection = Database . getConnection ( ) ; Statement statement = connection . createStatement ( ) ; statement . execute ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>NOT<seq2seq4repair_space>EXISTS<seq2seq4repair_space>pnpo_message<seq2seq4repair_space>(id<seq2seq4repair_space>int<seq2seq4repair_space>primary<seq2seq4repair_space>key,<seq2seq4repair_space>data<seq2seq4repair_space>bytea)" ) ; statement . execute ( "CREATE<seq2seq4repair_space>TABLE<seq2seq4repair_space>IF<seq2seq4repair_space>NOT<seq2seq4repair_space>EXISTS<seq2seq4repair_space>pnpo_installation<seq2seq4repair_space>(id<seq2seq4repair_space>int<seq2seq4repair_space>primary<seq2seq4repair_space>key,<seq2seq4repair_space>name<seq2seq4repair_space>varchar(256),<seq2seq4repair_space>major<seq2seq4repair_space>int,<seq2seq4repair_space>minor<seq2seq4repair_space>int,<seq2seq4repair_space>micro<seq2seq4repair_space>int,<seq2seq4repair_space>qualifier<seq2seq4repair_space>varchar(256))" ) ; if ( ( statement . execute ( "SELECT<seq2seq4repair_space>*<seq2seq4repair_space>FROM<seq2seq4repair_space>pnpo_installation" ) ) && ( statement . getResultSet ( ) . next ( ) ) ) { <START_BUG> statement . execute ( ( ( ( ( ( ( ( ( ( "UPDATE<seq2seq4repair_space>pnpo_installation<seq2seq4repair_space>SET<seq2seq4repair_space>name<seq2seq4repair_space>=<seq2seq4repair_space>'" + ( "PNPO" + "',<seq2seq4repair_space>major<seq2seq4repair_space>=<seq2seq4repair_space>'" ) ) + ( PNPO . MAJOR_VERSION ) ) + "',<seq2seq4repair_space>minor<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . MINOR_VERSION ) ) + "',<seq2seq4repair_space>micro<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . MICRO_VERSION ) ) + "',qualifier<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . QUALIFIER_VERSION ) ) + "'<seq2seq4repair_space>WHERE<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>1" ) ) ; <END_BUG> } else { statement . execute ( ( ( ( ( ( ( ( ( ( ( "INSERT<seq2seq4repair_space>INTO<seq2seq4repair_space>pnpo_installation<seq2seq4repair_space>VALUES<seq2seq4repair_space>(<seq2seq4repair_space>" + 0 ) + ",<seq2seq4repair_space>'PNPO',<seq2seq4repair_space>" ) + ( PNPO . MAJOR_VERSION ) ) + ",<seq2seq4repair_space>" ) + ( PNPO . MINOR_VERSION ) ) + ",<seq2seq4repair_space>" ) + ( PNPO . MICRO_VERSION ) ) + ",<seq2seq4repair_space>'" ) + ( PNPO . QUALIFIER_VERSION ) ) + "')" ) ) ; } connection . commit ( ) ; connection . close ( ) ; } catch ( SQLException e ) { throw new ServletException ( e ) ; } } @ Override public void destroy ( ) { } public static Connection getConnection ( ) throws SQLException { } }

Fix:
statement . execute ( ( ( ( ( ( ( ( ( ( "UPDATE<seq2seq4repair_space>pnpo_installation<seq2seq4repair_space>SET<seq2seq4repair_space>name<seq2seq4repair_space>=<seq2seq4repair_space>'" + ( "PNPO" + "',<seq2seq4repair_space>major<seq2seq4repair_space>=<seq2seq4repair_space>'" ) ) + ( PNPO . MAJOR_VERSION ) ) + "',<seq2seq4repair_space>minor<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . MINOR_VERSION ) ) + "',<seq2seq4repair_space>micro<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . MICRO_VERSION ) ) + "',qualifier<seq2seq4repair_space>=<seq2seq4repair_space>'" ) + ( PNPO . QUALIFIER_VERSION ) ) + "'<seq2seq4repair_space>WHERE<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>0" ) ) ;