//# 27 errors, 1,620 messages
//#
/*
    //#DatabaseInstaller.java:1:1: class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */

package org.apache.roller.weblogger.business.startup;

import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.business.DatabaseProvider;
import org.apache.roller.weblogger.pojos.WeblogPermission;


/**
 * Handles the install/upgrade of the Roller Weblogger database when the user
 * has configured their installation type to 'auto'.
 */
public class DatabaseInstaller {
    
    private static Log log = LogFactory.getLog(DatabaseInstaller.class);
    //#DatabaseInstaller.java:43: method: org.apache.roller.weblogger.business.startup.DatabaseInstaller.org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init
    //#DatabaseInstaller.java:43: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.createDatabase()V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.errorMessage(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.errorMessage(Ljava/lang/String;Ljava/lang/Throwable;)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getDatabaseVersion()I
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getMessages()Ljava/util/List;
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.isCreationRequired()Z
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.isUpgradeRequired()Z
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.parseVersionString(Ljava/lang/String;)I
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.setDatabaseVersion(Ljava/sql/Connection;I)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.setDatabaseVersion(Ljava/sql/Connection;Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.successMessage(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.tableExists(Ljava/sql/Connection;Ljava/lang/String;)Z
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.updateDatabaseVersion(Ljava/sql/Connection;I)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeDatabase(Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo130(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo200(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo210(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo230(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo240(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo300(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo310(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo400(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo401(Ljava/sql/Connection;Z)V
    //#output(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): log
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.createDatabase()V == &createDatabase
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.errorMessage(Ljava/lang/String;)V == &errorMessage
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.errorMessage(Ljava/lang/String;Ljava/lang/Throwable;)V == &errorMessage
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String; == &getDatabaseHandle
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getDatabaseVersion()I == &getDatabaseVersion
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.getMessages()Ljava/util/List; == &getMessages
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.isCreationRequired()Z == &isCreationRequired
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.isUpgradeRequired()Z == &isUpgradeRequired
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.parseVersionString(Ljava/lang/String;)I == &parseVersionString
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.setDatabaseVersion(Ljava/sql/Connection;I)V == &setDatabaseVersion
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.setDatabaseVersion(Ljava/sql/Connection;Ljava/lang/String;)V == &setDatabaseVersion
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.successMessage(Ljava/lang/String;)V == &successMessage
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.tableExists(Ljava/sql/Connection;Ljava/lang/String;)Z == &tableExists
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.updateDatabaseVersion(Ljava/sql/Connection;I)V == &updateDatabaseVersion
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeDatabase(Z)V == &upgradeDatabase
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo130(Ljava/sql/Connection;Z)V == &upgradeTo130
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo200(Ljava/sql/Connection;Z)V == &upgradeTo200
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo210(Ljava/sql/Connection;Z)V == &upgradeTo210
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo230(Ljava/sql/Connection;Z)V == &upgradeTo230
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo240(Ljava/sql/Connection;Z)V == &upgradeTo240
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo300(Ljava/sql/Connection;Z)V == &upgradeTo300
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo310(Ljava/sql/Connection;Z)V == &upgradeTo310
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo400(Ljava/sql/Connection;Z)V == &upgradeTo400
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): __Dispatch_Table.upgradeTo401(Ljava/sql/Connection;Z)V == &upgradeTo401
    //#post(org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init): init'ed(log)
    //#DatabaseInstaller.java:43: end of method: org.apache.roller.weblogger.business.startup.DatabaseInstaller.org.apache.roller.weblogger.business.startup.DatabaseInstaller__static_init
    
    private final DatabaseProvider db;
    private final DatabaseScriptProvider scripts;
    private final String version;
    private List<String> messages = new ArrayList<String>();
    
    // the name of the property which holds the dbversion value
    private static final String DBVERSION_PROP = "roller.database.version";
    
    
    public DatabaseInstaller(DatabaseProvider dbProvider, DatabaseScriptProvider scriptProvider) {
    //#DatabaseInstaller.java:54: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)
    //#input(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): dbProvider
    //#input(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): log
    //#input(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): scriptProvider
    //#input(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this
    //#output(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): new ArrayList(DatabaseInstaller#1) num objects
    //#output(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.db
    //#output(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.messages
    //#output(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.scripts
    //#output(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.version
    //#new obj(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): new ArrayList(DatabaseInstaller#1)
    //#pre[2] (void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): (soft) log != null
    //#presumption(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): java.lang.Object:getClass(...)@60 != null
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.db == dbProvider
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): init'ed(this.db)
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.messages == &new ArrayList(DatabaseInstaller#1)
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): this.scripts == scriptProvider
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): init'ed(this.scripts)
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): init'ed(this.version)
    //#post(void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)): new ArrayList(DatabaseInstaller#1) num objects == 1
        db = dbProvider;
        scripts = scriptProvider;
        
        Properties props = new Properties();
        try {
            props.load(getClass().getResourceAsStream("/roller-version.properties"));
        } catch (IOException e) {
            log.error("roller-version.properties not found", e);
    //#DatabaseInstaller.java:62: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
        
        version = props.getProperty("ro.version", "UNKNOWN");
    }
    //#DatabaseInstaller.java:66: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.org.apache.roller.weblogger.business.startup.DatabaseInstaller(DatabaseProvider, DatabaseScriptProvider)
    
    
    /** 
     * Determine if database schema needs to be upgraded.
     */
    public boolean isCreationRequired() {
        Connection con = null;
    //#DatabaseInstaller.java:73: method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.isCreationRequired()
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType.JDBC_PROPERTIES
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[org/apache/roller/weblogger/business/DatabaseProvider]
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[others]
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getConnection()Ljava/sql/Connection;
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getJdbcConnectionURL()Ljava/lang/String;
    //#input(bool isCreationRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getType()Lorg/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType;
    //#input(bool isCreationRequired()): this
    //#input(bool isCreationRequired()): this.db
    //#input(bool isCreationRequired()): this.db.__Tag
    //#input(bool isCreationRequired()): this.db.dataSource
    //#input(bool isCreationRequired()): this.db.jdbcConnectionURL
    //#input(bool isCreationRequired()): this.db.props
    //#input(bool isCreationRequired()): this.db.props._tainted
    //#input(bool isCreationRequired()): this.db.type
    //#output(bool isCreationRequired()): return_value
    //#pre[2] (bool isCreationRequired()): this.db != null
    //#pre[3] (bool isCreationRequired()): this.db.__Tag == org/apache/roller/weblogger/business/DatabaseProvider
    //#pre[8] (bool isCreationRequired()): init'ed(this.db.type)
    //#pre[4] (bool isCreationRequired()): (soft) this.db.dataSource != null
    //#pre[5] (bool isCreationRequired()): (soft) init'ed(this.db.jdbcConnectionURL)
    //#pre[6] (bool isCreationRequired()): (soft) this.db.props != null
    //#pre[7] (bool isCreationRequired()): (soft) this.db.props._tainted == 0
    //#post(bool isCreationRequired()): init'ed(return_value)
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.sql.DatabaseMetaData:getTables
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.sql.ResultSet:next
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.sql.ResultSet:getString
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:java.sql.DriverManager:getConnection
    //#unanalyzed(bool isCreationRequired()): Effects-of-calling:javax.sql.DataSource:getConnection
        try {            
            con = db.getConnection();
            
            // just check for a couple key Roller tables
            if (tableExists(con, "rolleruser") && tableExists(con, "userrole")) {
    //#DatabaseInstaller.java:78: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.tableExists: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool isCreationRequired()
    //#    basic block: bb_2
    //#    assertion: getConnection(...) != null
    //#    callee: bool org/apache/roller/weblogger/business/startup/DatabaseInstaller.tableExists(Connection, String)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 1148
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                return false;
            }
            
        } catch (Throwable t) {
            throw new RuntimeException("Error checking for tables", t);            
        } finally {
            try { if (con != null) con.close(); } catch (Exception ignored) {}
    //#DatabaseInstaller.java:85: Warning: test always goes same way
    //#    test predetermined because con != null
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool isCreationRequired()
    //#    from bb: bb_11
    //#    live edge: bb_11-->bb_12
    //#    tested vn: getConnection(...) == null
    //#    tested vn values: {0}
    //#DatabaseInstaller.java:85: Warning: test always goes same way
    //#    test predetermined because con != null
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool isCreationRequired()
    //#    from bb: bb_5
    //#    live edge: bb_5-->bb_6
    //#    tested vn: getConnection(...) == null
    //#    tested vn values: {0}
        }
        
        return true;
    //#DatabaseInstaller.java:88: end of method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.isCreationRequired()
    }
    
    
    /** 
     * Determine if database schema needs to be upgraded.
     */
    public boolean isUpgradeRequired() {
        int desiredVersion = parseVersionString(version);
    //#DatabaseInstaller.java:96: method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.isUpgradeRequired()
    //#input(bool isUpgradeRequired()): "')"._tainted
    //#input(bool isUpgradeRequired()): "Set database verstion to "._tainted
    //#input(bool isUpgradeRequired()): "insert into roller_properties values('roller.database.version', '"._tainted
    //#input(bool isUpgradeRequired()): log
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType.JDBC_PROPERTIES
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[org/apache/roller/weblogger/business/DatabaseProvider]
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[others]
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getConnection()Ljava/sql/Connection;
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getJdbcConnectionURL()Ljava/lang/String;
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getType()Lorg/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType;
    //#input(bool isUpgradeRequired()): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(bool isUpgradeRequired()): this
    //#input(bool isUpgradeRequired()): this.db
    //#input(bool isUpgradeRequired()): this.db.__Tag
    //#input(bool isUpgradeRequired()): this.db.dataSource
    //#input(bool isUpgradeRequired()): this.db.jdbcConnectionURL
    //#input(bool isUpgradeRequired()): this.db.props
    //#input(bool isUpgradeRequired()): this.db.props._tainted
    //#input(bool isUpgradeRequired()): this.db.type
    //#input(bool isUpgradeRequired()): this.messages
    //#input(bool isUpgradeRequired()): this.version
    //#input(bool isUpgradeRequired()): this.version._tainted
    //#output(bool isUpgradeRequired()): return_value
    //#pre[11] (bool isUpgradeRequired()): this.version != null
    //#pre[1] (bool isUpgradeRequired()): (soft) log != null
    //#pre[3] (bool isUpgradeRequired()): (soft) this.db != null
    //#pre[4] (bool isUpgradeRequired()): (soft) this.db.__Tag == org/apache/roller/weblogger/business/DatabaseProvider
    //#pre[5] (bool isUpgradeRequired()): (soft) this.db.dataSource != null
    //#pre[6] (bool isUpgradeRequired()): (soft) init'ed(this.db.jdbcConnectionURL)
    //#pre[7] (bool isUpgradeRequired()): (soft) this.db.props != null
    //#pre[8] (bool isUpgradeRequired()): (soft) this.db.props._tainted == 0
    //#pre[9] (bool isUpgradeRequired()): (soft) init'ed(this.db.type)
    //#pre[10] (bool isUpgradeRequired()): (soft) this.messages != null
    //#post(bool isUpgradeRequired()): init'ed(return_value)
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.ResultSet:next
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.util.List:add
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.String:length
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.DriverManager:getConnection
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:javax.sql.DataSource:getConnection
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.Connection:close
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.ResultSet:getString
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.Statement:executeQuery
    //#unanalyzed(bool isUpgradeRequired()): Effects-of-calling:java.sql.ResultSet:getInt
        int databaseVersion;
        try {
            databaseVersion = getDatabaseVersion();
        } catch (StartupException ex) {
            throw new RuntimeException(ex);
        }
        
        // if dbversion is unset then assume a new install, otherwise compare
        if (databaseVersion < 0) {
            // if this is a fresh db then we need to set the database version
            Connection con = null;
            try {
                con = db.getConnection();
                setDatabaseVersion(con, version);
    //#DatabaseInstaller.java:110: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.setDatabaseVersion: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool isUpgradeRequired()
    //#    basic block: bb_6
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.setDatabaseVersion(Connection, String)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 1251
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
            } catch (Exception ioe) {
    //#DatabaseInstaller.java:111: Warning: unused assignment
    //#    unused assignment into ioe
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool isUpgradeRequired()
                errorMessage("ERROR setting database version");
            } finally {
                try {
                    if (con != null) {
                        con.close();
                    }
                } catch (Exception ignored) {
                }
            }

            return false;
        } else {
            return databaseVersion < desiredVersion;
    //#DatabaseInstaller.java:124: end of method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.isUpgradeRequired()
        }
    }
    
    
    public List<String> getMessages() {
        return messages;
    //#DatabaseInstaller.java:130: method: List org.apache.roller.weblogger.business.startup.DatabaseInstaller.getMessages()
    //#input(List getMessages()): this
    //#input(List getMessages()): this.messages
    //#output(List getMessages()): return_value
    //#pre[2] (List getMessages()): init'ed(this.messages)
    //#post(List getMessages()): return_value == this.messages
    //#post(List getMessages()): init'ed(return_value)
    //#DatabaseInstaller.java:130: end of method: List org.apache.roller.weblogger.business.startup.DatabaseInstaller.getMessages()
    }
    
    
    private void errorMessage(String msg) {
        messages.add(msg);
    //#DatabaseInstaller.java:135: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.errorMessage(String)
    //#input(void errorMessage(String)): log
    //#input(void errorMessage(String)): msg
    //#input(void errorMessage(String)): this
    //#input(void errorMessage(String)): this.messages
    //#pre[1] (void errorMessage(String)): log != null
    //#pre[4] (void errorMessage(String)): this.messages != null
        log.error(msg);
    //#DatabaseInstaller.java:136: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void errorMessage(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object)
    }    
    //#DatabaseInstaller.java:137: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.errorMessage(String)
    
    
    private void errorMessage(String msg, Throwable t) {
        messages.add(msg);
    //#DatabaseInstaller.java:141: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.errorMessage(String, Throwable)
    //#input(void errorMessage(String, Throwable)): log
    //#input(void errorMessage(String, Throwable)): msg
    //#input(void errorMessage(String, Throwable)): t
    //#input(void errorMessage(String, Throwable)): this
    //#input(void errorMessage(String, Throwable)): this.messages
    //#pre[1] (void errorMessage(String, Throwable)): log != null
    //#pre[5] (void errorMessage(String, Throwable)): this.messages != null
        log.error(msg, t);
    //#DatabaseInstaller.java:142: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void errorMessage(String, Throwable)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
    }
    //#DatabaseInstaller.java:143: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.errorMessage(String, Throwable)
    
    
    private void successMessage(String msg) {
        messages.add(msg);
    //#DatabaseInstaller.java:147: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.successMessage(String)
    //#input(void successMessage(String)): log
    //#input(void successMessage(String)): msg
    //#input(void successMessage(String)): this
    //#input(void successMessage(String)): this.messages
    //#pre[1] (void successMessage(String)): log != null
    //#pre[4] (void successMessage(String)): this.messages != null
        log.trace(msg);
    //#DatabaseInstaller.java:148: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:trace(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void successMessage(String)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:trace(Object)
    }
    //#DatabaseInstaller.java:149: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.successMessage(String)
    
    
    /**
     * Create datatabase tables.
     */
    public void createDatabase() throws StartupException {
        
        log.info("Creating Roller Weblogger database tables.");
    //#DatabaseInstaller.java:157: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.createDatabase()
    //#DatabaseInstaller.java:157: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void createDatabase()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
    //#DatabaseInstaller.java:157: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void createDatabase()
    //#    suspicious precondition index: [14]
    //#input(void createDatabase()): " "._tainted
    //#input(void createDatabase()): ""._tainted
    //#input(void createDatabase()): "')"._tainted
    //#input(void createDatabase()): ".createdb.sql"._tainted
    //#input(void createDatabase()): ".dbscripts."._tainted
    //#input(void createDatabase()): "ERROR: SQLException executing SQL ["._tainted
    //#input(void createDatabase()): "Set database verstion to "._tainted
    //#input(void createDatabase()): "] : "._tainted
    //#input(void createDatabase()): "db2"._tainted
    //#input(void createDatabase()): "derby"._tainted
    //#input(void createDatabase()): "hsqldb"._tainted
    //#input(void createDatabase()): "insert into roller_properties values('roller.database.version', '"._tainted
    //#input(void createDatabase()): "mssql"._tainted
    //#input(void createDatabase()): "mysql"._tainted
    //#input(void createDatabase()): "oracle"._tainted
    //#input(void createDatabase()): "postgresql"._tainted
    //#input(void createDatabase()): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void createDatabase()): __Descendant_Table[others]
    //#input(void createDatabase()): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void createDatabase()): log
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType.JDBC_PROPERTIES
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[org/apache/roller/weblogger/business/DatabaseProvider]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[others]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getConnection()Ljava/sql/Connection;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getJdbcConnectionURL()Ljava/lang/String;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getType()Lorg/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void createDatabase()): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void createDatabase()): this
    //#input(void createDatabase()): this.__Tag
    //#input(void createDatabase()): this.db
    //#input(void createDatabase()): this.db.__Tag
    //#input(void createDatabase()): this.db.dataSource
    //#input(void createDatabase()): this.db.jdbcConnectionURL
    //#input(void createDatabase()): this.db.props
    //#input(void createDatabase()): this.db.props._tainted
    //#input(void createDatabase()): this.db.type
    //#input(void createDatabase()): this.messages
    //#input(void createDatabase()): this.scripts
    //#input(void createDatabase()): this.scripts.__Tag
    //#input(void createDatabase()): this.version
    //#input(void createDatabase()): this.version._tainted
    //#pre[1] (void createDatabase()): log != null
    //#pre[2] (void createDatabase()): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[4] (void createDatabase()): this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[5] (void createDatabase()): this.db != null
    //#pre[6] (void createDatabase()): this.db.__Tag == org/apache/roller/weblogger/business/DatabaseProvider
    //#pre[11] (void createDatabase()): init'ed(this.db.type)
    //#pre[12] (void createDatabase()): this.messages != null
    //#pre[13] (void createDatabase()): this.scripts != null
    //#pre[14] (void createDatabase()): this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#pre[15] (void createDatabase()): this.version != null
    //#pre[7] (void createDatabase()): (soft) this.db.dataSource != null
    //#pre[8] (void createDatabase()): (soft) init'ed(this.db.jdbcConnectionURL)
    //#pre[9] (void createDatabase()): (soft) this.db.props != null
    //#pre[10] (void createDatabase()): (soft) this.db.props._tainted == 0
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.util.List:add
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void createDatabase()): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void createDatabase()): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void createDatabase()): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void createDatabase()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.DriverManager:getConnection
    //#unanalyzed(void createDatabase()): Effects-of-calling:javax.sql.DataSource:getConnection
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void createDatabase()): Effects-of-calling:java.io.StringWriter:toString
        
        Connection con = null;
        SQLScriptRunner create = null;
        try {
            con = db.getConnection();
            String handle = getDatabaseHandle(con);
    //#DatabaseInstaller.java:163: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.getDatabaseHandle: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void createDatabase()
    //#    basic block: bb_2
    //#    assertion: getConnection(...) != null
    //#    callee: String org/apache/roller/weblogger/business/startup/DatabaseInstaller.getDatabaseHandle(Connection)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 1122
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
            create = new SQLScriptRunner(scripts.getDatabaseScript(handle + "/createdb.sql"));
            create.runScript(con, true);
    //#DatabaseInstaller.java:165: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void createDatabase()
    //#    basic block: bb_2
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
            messages.addAll(create.getMessages());
            
            setDatabaseVersion(con, version);
            
        } catch (SQLException sqle) {
            log.error("ERROR running SQL in database creation script", sqle);
            if (create != null) messages.addAll(create.getMessages());
            errorMessage("ERROR running SQL in database creation script");
            throw new StartupException("Error running sql script", sqle); 
            
        } catch (Exception ioe) {
            log.error("ERROR running database creation script", ioe);
            if (create != null) messages.addAll(create.getMessages());
            errorMessage("ERROR reading/parsing database creation script");
            throw new StartupException("Error running sql script", ioe);
            
        } finally {
            try { if (con != null) con.close(); } catch (Exception ignored) {}
    //#DatabaseInstaller.java:183: Warning: test always goes same way
    //#    test predetermined because con != null
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void createDatabase()
    //#    from bb: bb_3
    //#    live edge: bb_3-->bb_4
    //#    tested vn: getConnection(...) == null
    //#    tested vn values: {0}
        }
    }
    //#DatabaseInstaller.java:185: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.createDatabase()
    
    
    /**
     * Upgrade database if dbVersion is older than desiredVersion.
     */
    public void upgradeDatabase(boolean runScripts) throws StartupException {
        
        int myVersion = parseVersionString(version);
    //#DatabaseInstaller.java:193: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeDatabase(bool)
    //#DatabaseInstaller.java:193: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    suspicious precondition index: [15]
    //#    Attribs:  Soft
    //#input(void upgradeDatabase(bool)): " "._tainted
    //#input(void upgradeDatabase(bool)): " Lx category paths"._tainted
    //#input(void upgradeDatabase(bool)): " Lx folder paths"._tainted
    //#input(void upgradeDatabase(bool)): " for websites with no locale"._tainted
    //#input(void upgradeDatabase(bool)): ""._tainted
    //#input(void upgradeDatabase(bool)): "'"._tainted
    //#input(void upgradeDatabase(bool)): "."._tainted
    //#input(void upgradeDatabase(bool)): ".120-to-130-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".130-to-200-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".200-to-210-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".210-to-230-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".230-to-240-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".240-to-300-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".300-to-310-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".310-to-400-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".400-to-401-migration.sql"._tainted
    //#input(void upgradeDatabase(bool)): ".dbscripts."._tainted
    //#input(void upgradeDatabase(bool)): "Database is old, beginning upgrade to version "._tainted
    //#input(void upgradeDatabase(bool)): "Database version = "._tainted
    //#input(void upgradeDatabase(bool)): "Desired version = "._tainted
    //#input(void upgradeDatabase(bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeDatabase(bool)): "Processing website: "._tainted
    //#input(void upgradeDatabase(bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeDatabase(bool)): "Setting website locale to "._tainted
    //#input(void upgradeDatabase(bool)): "Updated "._tainted
    //#input(void upgradeDatabase(bool)): "Updated database verstion to "._tainted
    //#input(void upgradeDatabase(bool)): "] : "._tainted
    //#input(void upgradeDatabase(bool)): "db2"._tainted
    //#input(void upgradeDatabase(bool)): "delete from rag_group where handle = 'external'"._tainted
    //#input(void upgradeDatabase(bool)): "derby"._tainted
    //#input(void upgradeDatabase(bool)): "hsqldb"._tainted
    //#input(void upgradeDatabase(bool)): "insert into roller_properties(name,value) values(?,?)"._tainted
    //#input(void upgradeDatabase(bool)): "insert into roller_user_permissions (id, website_id, user_id, permission_mask, pending) values (?,?,?,?,?)"._tainted
    //#input(void upgradeDatabase(bool)): "insert into webpage(id, name, description, link, websiteid, template, updatetime) values(?,?,?,?,?,?,?)"._tainted
    //#input(void upgradeDatabase(bool)): "mssql"._tainted
    //#input(void upgradeDatabase(bool)): "mysql"._tainted
    //#input(void upgradeDatabase(bool)): "oracle"._tainted
    //#input(void upgradeDatabase(bool)): "p"._tainted
    //#input(void upgradeDatabase(bool)): "postgresql"._tainted
    //#input(void upgradeDatabase(bool)): "q"._tainted
    //#input(void upgradeDatabase(bool)): "roller.database.version"._tainted
    //#input(void upgradeDatabase(bool)): "select categoryid, ancestorid from weblogcategoryassoc where relation='PARENT'"._tainted
    //#input(void upgradeDatabase(bool)): "select f.id, f.name from folder f, folder p where f.parentid = p.id and p.parentid is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "select f.id, f.name from weblogcategory f, weblogcategory p where f.parentid = p.id and p.parentid is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "select f.id, f.name, p.path from folder f, folder p where f.parentid = p.id and p.path <> '.' and p.path is not NULL and f.path is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "select f.id, f.name, p.path from weblogcategory f, weblogcategory p wh ... tid = p.id and p.path <> '.' and p.path is not NULL and f.path is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "select folderid, ancestorid from folderassoc where relation='PARENT'"._tainted
    //#input(void upgradeDatabase(bool)): "select id from rag_group where handle = 'all'"._tainted
    //#input(void upgradeDatabase(bool)): "select id from rag_group where handle = 'external'"._tainted
    //#input(void upgradeDatabase(bool)): "select id from webpage where websiteid = ? and link = 'Weblog'"._tainted
    //#input(void upgradeDatabase(bool)): "select id,feed_url,author from rag_subscription"._tainted
    //#input(void upgradeDatabase(bool)): "select value from roller_properties where name = 'site.absoluteurl'"._tainted
    //#input(void upgradeDatabase(bool)): "select value from roller_properties where name = 'users.comments.autoformat'"._tainted
    //#input(void upgradeDatabase(bool)): "select value from roller_properties where name = 'users.comments.escapehtml'"._tainted
    //#input(void upgradeDatabase(bool)): "select w.id as wid, u.id as uid, u.username as uname from website as w, rolleruser as u where u.id=w.userid"._tainted
    //#input(void upgradeDatabase(bool)): "select weblogentry.id,website.locale from weblogentry,website where weblogentry.websiteid = website.id"._tainted
    //#input(void upgradeDatabase(bool)): "select website.id,template,website.handle from website,webpage where webpage.id = website.defaultpageid and webpage.link != 'Weblog'"._tainted
    //#input(void upgradeDatabase(bool)): "update folder set parentid=? where id=?"._tainted
    //#input(void upgradeDatabase(bool)): "update folder set path = '.' where parentid is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "update folder set path=? where id=?"._tainted
    //#input(void upgradeDatabase(bool)): "update rag_group set handle = 'all' where handle = 'external'"._tainted
    //#input(void upgradeDatabase(bool)): "update rag_group_subscription set group_id = ? where group_id = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update rag_subscription set last_updated=last_updated, feed_url = ? where id = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update roller_comment set posttime=posttime, contenttype = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update roller_comment set posttime=posttime, plugins = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeDatabase(bool)): "update weblogcategory set parentid=? where id=?"._tainted
    //#input(void upgradeDatabase(bool)): "update weblogcategory set path = '.' where parentid is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "update weblogcategory set path=? where id=?"._tainted
    //#input(void upgradeDatabase(bool)): "update weblogentry set locale = ? where id = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update weblogentry set userid=?, status=?, pubtime=pubtime, updatetime=updatetime where publishentry=? and websiteid=?"._tainted
    //#input(void upgradeDatabase(bool)): "update webpage set template = ? where id = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update website set defaultpageid = ? where id = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update website set editortheme = ?"._tainted
    //#input(void upgradeDatabase(bool)): "update website set handle=? where id=?"._tainted
    //#input(void upgradeDatabase(bool)): "update website set locale = ? where locale = ''"._tainted
    //#input(void upgradeDatabase(bool)): "update website set locale = ? where locale is NULL"._tainted
    //#input(void upgradeDatabase(bool)): "weblogger:"._tainted
    //#input(void upgradeDatabase(bool)): "where name = '"._tainted
    //#input(void upgradeDatabase(bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeDatabase(bool)): __Descendant_Table[others]
    //#input(void upgradeDatabase(bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeDatabase(bool)): log
    //#input(void upgradeDatabase(bool)): org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType.JDBC_PROPERTIES
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[org/apache/roller/weblogger/business/DatabaseProvider]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[others]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getConnection()Ljava/sql/Connection;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getJdbcConnectionURL()Ljava/lang/String;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getType()Lorg/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeDatabase(bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeDatabase(bool)): runScripts
    //#input(void upgradeDatabase(bool)): this
    //#input(void upgradeDatabase(bool)): this.__Tag
    //#input(void upgradeDatabase(bool)): this.db
    //#input(void upgradeDatabase(bool)): this.db.__Tag
    //#input(void upgradeDatabase(bool)): this.db.dataSource
    //#input(void upgradeDatabase(bool)): this.db.jdbcConnectionURL
    //#input(void upgradeDatabase(bool)): this.db.props
    //#input(void upgradeDatabase(bool)): this.db.props._tainted
    //#input(void upgradeDatabase(bool)): this.db.type
    //#input(void upgradeDatabase(bool)): this.messages
    //#input(void upgradeDatabase(bool)): this.scripts
    //#input(void upgradeDatabase(bool)): this.scripts.__Tag
    //#input(void upgradeDatabase(bool)): this.version
    //#input(void upgradeDatabase(bool)): this.version._tainted
    //#pre[16] (void upgradeDatabase(bool)): this.version != null
    //#pre[1] (void upgradeDatabase(bool)): (soft) log != null
    //#pre[2] (void upgradeDatabase(bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[5] (void upgradeDatabase(bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[6] (void upgradeDatabase(bool)): (soft) this.db != null
    //#pre[7] (void upgradeDatabase(bool)): (soft) this.db.__Tag == org/apache/roller/weblogger/business/DatabaseProvider
    //#pre[8] (void upgradeDatabase(bool)): (soft) this.db.dataSource != null
    //#pre[9] (void upgradeDatabase(bool)): (soft) init'ed(this.db.jdbcConnectionURL)
    //#pre[10] (void upgradeDatabase(bool)): (soft) this.db.props != null
    //#pre[11] (void upgradeDatabase(bool)): (soft) this.db.props._tainted == 0
    //#pre[12] (void upgradeDatabase(bool)): (soft) init'ed(this.db.type)
    //#pre[13] (void upgradeDatabase(bool)): (soft) this.messages != null
    //#pre[14] (void upgradeDatabase(bool)): (soft) this.scripts != null
    //#pre[15] (void upgradeDatabase(bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.ResultSet:next
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.ResultSet:getString
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.DriverManager:getConnection
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:javax.sql.DataSource:getConnection
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:close
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:getDatabaseScript
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.io.StringWriter:toString
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.List:addAll
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Connection:prepareStatement
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:executeQuery
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:clearParameters
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:setString
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:executeUpdate
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Date
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Date:getTime
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Date
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:setDate
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:setBoolean
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.PreparedStatement:setShort
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.Statement:executeQuery
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.sql.ResultSet:getInt
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Locale:getDefault
    //#unanalyzed(void upgradeDatabase(bool)): Effects-of-calling:java.util.Locale:getLanguage
        int dbversion = getDatabaseVersion();
        
        log.debug("Database version = "+dbversion);
    //#DatabaseInstaller.java:196: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        log.debug("Desired version = "+myVersion);
    //#DatabaseInstaller.java:197: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
       
        Connection con = null;
        try {
            con = db.getConnection();
            if(dbversion < 0) {
                String msg = "Cannot upgrade database tables, Roller database version cannot be determined";
                errorMessage(msg);
                throw new StartupException(msg);
    //#DatabaseInstaller.java:205: ?conditional throw
    //#    dbversion >= 0
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_2
    //#    assertion: dbversion >= 0
    //#    VN: getDatabaseVersion(...)
    //#    Expected: {0..+Inf}
    //#    Bad: {-2_147_483_648..-1}
    //#    Attribs:  Int  Bad overlaps +/-1000  Bad < Exp
            } else if(dbversion >= myVersion) {
                log.info("Database is current, no upgrade needed");
    //#DatabaseInstaller.java:207: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)
                return;
            }

            log.info("Database is old, beginning upgrade to version "+myVersion);
    //#DatabaseInstaller.java:211: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:info(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:info(Object)

            // iterate through each upgrade as needed
            // to add to the upgrade sequence simply add a new "if" statement
            // for whatever version needed and then define a new method upgradeXXX()
            if(dbversion < 130) {
                upgradeTo130(con, runScripts);
    //#DatabaseInstaller.java:217: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo130: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_13
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo130(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 269
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 130;
            }
            if (dbversion < 200) {
                upgradeTo200(con, runScripts);
    //#DatabaseInstaller.java:221: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo200: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_15
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo200(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 321
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 200;
            }
            if(dbversion < 210) {
                upgradeTo210(con, runScripts);
    //#DatabaseInstaller.java:225: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo210: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_17
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo210(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 409
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 210;
            }
            if(dbversion < 230) {
                upgradeTo230(con, runScripts);
    //#DatabaseInstaller.java:229: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo230: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_19
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo230(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 528
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 230;
            }
            if(dbversion < 240) {
                upgradeTo240(con, runScripts);
    //#DatabaseInstaller.java:233: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo240: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_21
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo240(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 554
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 240;
            }
            if(dbversion < 300) {
                upgradeTo300(con, runScripts);
    //#DatabaseInstaller.java:237: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo300: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_23
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo300(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 580
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 300;
            }
            if(dbversion < 310) {
                upgradeTo310(con, runScripts);
    //#DatabaseInstaller.java:241: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo310: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_25
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo310(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 664
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 310;
            }
            if(dbversion < 400) {
                upgradeTo400(con, runScripts);
    //#DatabaseInstaller.java:245: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo400: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_27
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo400(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 691
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 400;
            }
            if(dbversion < 401) {
                upgradeTo401(con, runScripts);
    //#DatabaseInstaller.java:249: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo401: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_29
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.upgradeTo401(Connection, bool)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 1200
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
                dbversion = 401;
    //#DatabaseInstaller.java:250: Warning: unused assignment
    //#    unused assignment into dbversion
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
            }

            // make sure the database version is the exact version
            // we are upgrading too.
            updateDatabaseVersion(con, myVersion);
    //#DatabaseInstaller.java:255: ?precondition failure
    //#    org/apache/roller/weblogger/business/startup/DatabaseInstaller.updateDatabaseVersion: con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    basic block: bb_30
    //#    assertion: getConnection(...) != null
    //#    callee: void org/apache/roller/weblogger/business/startup/DatabaseInstaller.updateDatabaseVersion(Connection, int)
    //#    callee assertion: con != null
    //#    callee file: DatabaseInstaller.java
    //#    callee precondition index: [1]
    //#    callee srcpos: 1280
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null}
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
        
        } catch (SQLException e) {
            throw new StartupException("ERROR obtaining connection");
        } finally {
            try { if (con != null) con.close(); } catch (Exception ignored) {}
    //#DatabaseInstaller.java:260: Warning: test always goes same way
    //#    test predetermined because con != null
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeDatabase(bool)
    //#    from bb: bb_31
    //#    live edge: bb_31-->bb_32
    //#    tested vn: getConnection(...) == null
    //#    tested vn values: {0}
        }
    }
    //#DatabaseInstaller.java:262: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeDatabase(bool)
    
    
    /**
     * Upgrade database for Roller 1.3.0
     */
    private void upgradeTo130(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:269: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo130(Connection, bool)
    //#DatabaseInstaller.java:269: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo130(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo130(Connection, bool)): " "._tainted
    //#input(void upgradeTo130(Connection, bool)): ""._tainted
    //#input(void upgradeTo130(Connection, bool)): "'"._tainted
    //#input(void upgradeTo130(Connection, bool)): ".120-to-130-migration.sql"._tainted
    //#input(void upgradeTo130(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo130(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo130(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo130(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo130(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo130(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo130(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo130(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo130(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo130(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo130(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo130(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo130(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo130(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo130(Connection, bool)): "update website set editortheme = ?"._tainted
    //#input(void upgradeTo130(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo130(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo130(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo130(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo130(Connection, bool)): con
    //#input(void upgradeTo130(Connection, bool)): log
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo130(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo130(Connection, bool)): runScripts
    //#input(void upgradeTo130(Connection, bool)): this
    //#input(void upgradeTo130(Connection, bool)): this.__Tag
    //#input(void upgradeTo130(Connection, bool)): this.messages
    //#input(void upgradeTo130(Connection, bool)): this.scripts
    //#input(void upgradeTo130(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo130(Connection, bool)): con != null
    //#pre[2] (void upgradeTo130(Connection, bool)): log != null
    //#pre[7] (void upgradeTo130(Connection, bool)): this.messages != null
    //#pre[3] (void upgradeTo130(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo130(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[8] (void upgradeTo130(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo130(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#presumption(void upgradeTo130(Connection, bool)): java.sql.Connection:prepareStatement(...)@296 != null
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo130(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo130(Connection, bool)): runScripts: {0}, {1}
    //#test_vector(void upgradeTo130(Connection, bool)): java.sql.Connection:getAutoCommit(...)@302: {1}, {0}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/120-to-130-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:276: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo130(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
            
            /*
             * The new theme management code is going into place and it uses
             * the old website.themeEditor attribute to store a users theme.
             *
             * In pre-1.3 Roller *all* websites are considered to be using a
             * custom theme, so we need to make sure this is properly defined
             * by setting the theme on all websites to custom.
             *
             * NOTE: If we don't do this then nothing would break, but some users
             * would be suprised that their template customizations are no longer
             * in effect because they are using a shared theme instead.
             */
            
            successMessage("Doing upgrade to 130 ...");
            successMessage("Ensuring that all website themes are set to custom");
            
            PreparedStatement setCustomThemeStmt = con.prepareStatement(
                    "update website set editortheme = ?");
            
            setCustomThemeStmt.setString(1, org.apache.roller.weblogger.pojos.WeblogTheme.CUSTOM);
            setCustomThemeStmt.executeUpdate();
            
            if (!con.getAutoCommit()) con.commit();
            
            successMessage("Upgrade to 130 complete.");
            
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 130", e);  
            throw new StartupException("Problem upgrading database to version 130", e);
        }
        
        updateDatabaseVersion(con, 130);
    }
    //#DatabaseInstaller.java:315: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo130(Connection, bool)
    
    /**
     * Upgrade database for Roller 2.0.0
     */
    private void upgradeTo200(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:321: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo200(Connection, bool)
    //#DatabaseInstaller.java:321: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo200(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo200(Connection, bool)): " "._tainted
    //#input(void upgradeTo200(Connection, bool)): ""._tainted
    //#input(void upgradeTo200(Connection, bool)): "'"._tainted
    //#input(void upgradeTo200(Connection, bool)): ".130-to-200-migration.sql"._tainted
    //#input(void upgradeTo200(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo200(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo200(Connection, bool)): "Processing website: "._tainted
    //#input(void upgradeTo200(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo200(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo200(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo200(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo200(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo200(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo200(Connection, bool)): "insert into roller_user_permissions (id, website_id, user_id, permission_mask, pending) values (?,?,?,?,?)"._tainted
    //#input(void upgradeTo200(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo200(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo200(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo200(Connection, bool)): "p"._tainted
    //#input(void upgradeTo200(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo200(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo200(Connection, bool)): "select w.id as wid, u.id as uid, u.username as uname from website as w, rolleruser as u where u.id=w.userid"._tainted
    //#input(void upgradeTo200(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo200(Connection, bool)): "update weblogentry set userid=?, status=?, pubtime=pubtime, updatetime=updatetime where publishentry=? and websiteid=?"._tainted
    //#input(void upgradeTo200(Connection, bool)): "update website set handle=? where id=?"._tainted
    //#input(void upgradeTo200(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo200(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo200(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo200(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo200(Connection, bool)): con
    //#input(void upgradeTo200(Connection, bool)): log
    //#input(void upgradeTo200(Connection, bool)): org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo200(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo200(Connection, bool)): runScripts
    //#input(void upgradeTo200(Connection, bool)): this
    //#input(void upgradeTo200(Connection, bool)): this.__Tag
    //#input(void upgradeTo200(Connection, bool)): this.messages
    //#input(void upgradeTo200(Connection, bool)): this.scripts
    //#input(void upgradeTo200(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo200(Connection, bool)): con != null
    //#pre[2] (void upgradeTo200(Connection, bool)): log != null
    //#pre[7] (void upgradeTo200(Connection, bool)): this.messages != null
    //#pre[3] (void upgradeTo200(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo200(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[8] (void upgradeTo200(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo200(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#presumption(void upgradeTo200(Connection, bool)): java.sql.Connection:prepareStatement(...)@335 != null
    //#presumption(void upgradeTo200(Connection, bool)): java.sql.Connection:prepareStatement(...)@338 != null
    //#presumption(void upgradeTo200(Connection, bool)): java.sql.Connection:prepareStatement(...)@340 != null
    //#presumption(void upgradeTo200(Connection, bool)): java.sql.Connection:prepareStatement(...)@344 != null
    //#presumption(void upgradeTo200(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@350 != null
    //#presumption(void upgradeTo200(Connection, bool)): init'ed(org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN)
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo200(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo200(Connection, bool)): runScripts: {0}, {1}
    //#test_vector(void upgradeTo200(Connection, bool)): java.sql.Connection:getAutoCommit(...)@389: {1}, {0}
    //#test_vector(void upgradeTo200(Connection, bool)): java.sql.ResultSet:next(...)@351: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/130-to-200-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:328: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo200(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
            
            successMessage("Doing upgrade to 200 ...");
            successMessage("Populating roller_user_permissions table");
            
            PreparedStatement websitesQuery = con.prepareStatement(
                    "select w.id as wid, u.id as uid, u.username as uname from "
                    + "website as w, rolleruser as u where u.id=w.userid");
            PreparedStatement websiteUpdate = con.prepareStatement(
                    "update website set handle=? where id=?");
            PreparedStatement entryUpdate = con.prepareStatement(
                    "update weblogentry set userid=?, status=?, "
                    + "pubtime=pubtime, updatetime=updatetime "
                    + "where publishentry=? and websiteid=?");
            PreparedStatement permsInsert = con.prepareStatement(
                    "insert into roller_user_permissions "
                    + "(id, website_id, user_id, permission_mask, pending) "
                    + "values (?,?,?,?,?)");
            
            // loop through websites, each has a user
            ResultSet websiteSet = websitesQuery.executeQuery();
            while (websiteSet.next()) {
                String websiteid = websiteSet.getString("wid");
                String userid = websiteSet.getString("uid");
                String handle = websiteSet.getString("uname");
                successMessage("Processing website: " + handle);
                
                // use website user's username as website handle
                websiteUpdate.clearParameters();
                websiteUpdate.setString(1, handle);
                websiteUpdate.setString(2, websiteid);
                websiteUpdate.executeUpdate();
                
                // update all of pubished entries to include userid and status
                entryUpdate.clearParameters();
                entryUpdate.setString( 1, userid);
                entryUpdate.setString( 2, "PUBLISHED");
                entryUpdate.setBoolean(3, true);
                entryUpdate.setString( 4, websiteid);
                entryUpdate.executeUpdate();
                
                // update all of draft entries to include userid and status
                entryUpdate.clearParameters();
                entryUpdate.setString( 1, userid);
                entryUpdate.setString( 2, "DRAFT");
                entryUpdate.setBoolean(3, false);
                entryUpdate.setString( 4, websiteid);
                entryUpdate.executeUpdate();
                
                // add  permission for user in website
                permsInsert.clearParameters();
                permsInsert.setString( 1, websiteid+"p");
                permsInsert.setString( 2, websiteid);
                permsInsert.setString( 3, userid);
                permsInsert.setShort(    4,WeblogPermission.ADMIN);
                permsInsert.setBoolean(5, false);
                permsInsert.executeUpdate();
            }
            
            if (!con.getAutoCommit()) con.commit();
            
            successMessage("Upgrade to 200 complete.");
            
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 200", e);
            throw new StartupException("Problem upgrading database to version 200", e);
        }
        
        updateDatabaseVersion(con, 200);
    }
    //#DatabaseInstaller.java:402: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo200(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 2.1.0
     */
    private void upgradeTo210(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:409: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo210(Connection, bool)
    //#DatabaseInstaller.java:409: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo210(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo210(Connection, bool)): " "._tainted
    //#input(void upgradeTo210(Connection, bool)): ""._tainted
    //#input(void upgradeTo210(Connection, bool)): "'"._tainted
    //#input(void upgradeTo210(Connection, bool)): ".200-to-210-migration.sql"._tainted
    //#input(void upgradeTo210(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo210(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo210(Connection, bool)): "Processing website: "._tainted
    //#input(void upgradeTo210(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo210(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo210(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo210(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo210(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo210(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo210(Connection, bool)): "insert into webpage(id, name, description, link, websiteid, template, updatetime) values(?,?,?,?,?,?,?)"._tainted
    //#input(void upgradeTo210(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo210(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo210(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo210(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo210(Connection, bool)): "q"._tainted
    //#input(void upgradeTo210(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo210(Connection, bool)): "select id from webpage where websiteid = ? and link = 'Weblog'"._tainted
    //#input(void upgradeTo210(Connection, bool)): "select website.id,template,website.handle from website,webpage where webpage.id = website.defaultpageid and webpage.link != 'Weblog'"._tainted
    //#input(void upgradeTo210(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo210(Connection, bool)): "update webpage set template = ? where id = ?"._tainted
    //#input(void upgradeTo210(Connection, bool)): "update website set defaultpageid = ? where id = ?"._tainted
    //#input(void upgradeTo210(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo210(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo210(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo210(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo210(Connection, bool)): con
    //#input(void upgradeTo210(Connection, bool)): log
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo210(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo210(Connection, bool)): runScripts
    //#input(void upgradeTo210(Connection, bool)): this
    //#input(void upgradeTo210(Connection, bool)): this.__Tag
    //#input(void upgradeTo210(Connection, bool)): this.messages
    //#input(void upgradeTo210(Connection, bool)): this.scripts
    //#input(void upgradeTo210(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo210(Connection, bool)): con != null
    //#pre[2] (void upgradeTo210(Connection, bool)): log != null
    //#pre[7] (void upgradeTo210(Connection, bool)): this.messages != null
    //#pre[3] (void upgradeTo210(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo210(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[8] (void upgradeTo210(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo210(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.Connection:prepareStatement(...)@434 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.Connection:prepareStatement(...)@439 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.Connection:prepareStatement(...)@442 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.Connection:prepareStatement(...)@446 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.Connection:prepareStatement(...)@452 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@458 != null
    //#presumption(void upgradeTo210(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@472 != null
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo210(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo210(Connection, bool)): runScripts: {0}, {1}
    //#test_vector(void upgradeTo210(Connection, bool)): java.sql.Connection:getAutoCommit(...)@508: {1}, {0}
    //#test_vector(void upgradeTo210(Connection, bool)): java.sql.ResultSet:next(...)@460: {0}, {1}
    //#test_vector(void upgradeTo210(Connection, bool)): java.sql.ResultSet:next(...)@473: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/200-to-210-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:416: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo210(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
            
            /*
             * For Roller 2.1.0 we are going to standardize some of the
             * weblog templates and make them less editable.  To do this
             * we need to do a little surgery.
             *
             * The goal for this upgrade is to ensure that ALL weblogs now have
             * the required "Weblog" template as their default template.
             */
            
            successMessage("Doing upgrade to 210 ...");
            successMessage("Ensuring that all weblogs use the 'Weblog' template as their default page");
            
            // this query will give us all websites that have modified their
            // default page to link to something other than "Weblog"
            PreparedStatement selectUpdateWeblogs = con.prepareStatement(
                    "select website.id,template,website.handle from website,webpage "+
                    "where webpage.id = website.defaultpageid "+
                    "and webpage.link != 'Weblog'");
            
            PreparedStatement selectWeblogTemplate = con.prepareStatement(
                    "select id from webpage where websiteid = ? and link = 'Weblog'");
            
            PreparedStatement updateWeblogTemplate = con.prepareStatement(
                    "update webpage set template = ? where id = ?");
            
            // insert a new template for a website
            PreparedStatement insertWeblogTemplate = con.prepareStatement(
                    "insert into webpage"+
                    "(id, name, description, link, websiteid, template, updatetime) "+
                    "values(?,?,?,?,?,?,?)");
            
            // update the default page for a website
            PreparedStatement updateDefaultPage = con.prepareStatement(
                    "update website set defaultpageid = ? "+
                    "where id = ?");
            
            String description = "This template is used to render the main "+
                    "page of your weblog.";
            ResultSet websiteSet = selectUpdateWeblogs.executeQuery();
            Date now = new Date();
            while (websiteSet.next()) {
                String websiteid = websiteSet.getString(1);
                String template = websiteSet.getString(2);
                String handle = websiteSet.getString(3);
                successMessage("Processing website: " + handle);
                
                String defaultpageid = null;
    //#DatabaseInstaller.java:466: Warning: unused assignment
    //#    unused assignment into defaultpageid
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo210(Connection, bool)
    //#    Attribs:  Uncertain
                
                // it's possible that this weblog has a "Weblog" template, but just
                // isn't using it as their default.  if so we need to fix that.
                selectWeblogTemplate.clearParameters();
                selectWeblogTemplate.setString(1, websiteid);
                ResultSet weblogPageSet = selectWeblogTemplate.executeQuery();
                if(weblogPageSet.next()) {
                    // this person already has a "Weblog" template, so update it
                    String id = weblogPageSet.getString(1);
                    
                    updateWeblogTemplate.clearParameters();
                    updateWeblogTemplate.setString(1, template);
                    updateWeblogTemplate.setString(2, id);
                    updateWeblogTemplate.executeUpdate();
                    
                    // make sure and adjust what default page id we want to use
                    defaultpageid = id;
                } else {
                    // no "Weblog" template, so insert a new one
                    insertWeblogTemplate.clearParameters();
                    insertWeblogTemplate.setString( 1, websiteid+"q");
                    insertWeblogTemplate.setString( 2, "Weblog");
                    insertWeblogTemplate.setString( 3, description);
                    insertWeblogTemplate.setString( 4, "Weblog");
                    insertWeblogTemplate.setString( 5, websiteid);
                    insertWeblogTemplate.setString( 6, template);
                    insertWeblogTemplate.setDate(   7, new java.sql.Date(now.getTime()));
                    insertWeblogTemplate.executeUpdate();
                    
                    // set the new default page id
                    defaultpageid = websiteid+"q";
                }
                
                // update defaultpageid value
                updateDefaultPage.clearParameters();
                updateDefaultPage.setString( 1, defaultpageid);
                updateDefaultPage.setString( 2, websiteid);
                updateDefaultPage.executeUpdate();
            }
            
            
            if (!con.getAutoCommit()) con.commit();
            
            successMessage("Upgrade to 210 complete.");
            
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            log.error("Problem upgrading database to version 210", e);
            throw new StartupException("Problem upgrading database to version 210", e);
        }
        
        updateDatabaseVersion(con, 210);
    }
    //#DatabaseInstaller.java:521: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo210(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 2.3.0
     */
    private void upgradeTo230(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:528: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo230(Connection, bool)
    //#DatabaseInstaller.java:528: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo230(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo230(Connection, bool)): " "._tainted
    //#input(void upgradeTo230(Connection, bool)): ""._tainted
    //#input(void upgradeTo230(Connection, bool)): "'"._tainted
    //#input(void upgradeTo230(Connection, bool)): ".210-to-230-migration.sql"._tainted
    //#input(void upgradeTo230(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo230(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo230(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo230(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo230(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo230(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo230(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo230(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo230(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo230(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo230(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo230(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo230(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo230(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo230(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo230(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo230(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo230(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo230(Connection, bool)): con
    //#input(void upgradeTo230(Connection, bool)): log
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo230(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo230(Connection, bool)): runScripts
    //#input(void upgradeTo230(Connection, bool)): this
    //#input(void upgradeTo230(Connection, bool)): this.__Tag
    //#input(void upgradeTo230(Connection, bool)): this.messages
    //#input(void upgradeTo230(Connection, bool)): this.scripts
    //#input(void upgradeTo230(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo230(Connection, bool)): con != null
    //#pre[2] (void upgradeTo230(Connection, bool)): log != null
    //#pre[3] (void upgradeTo230(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo230(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[7] (void upgradeTo230(Connection, bool)): (soft) this.messages != null
    //#pre[8] (void upgradeTo230(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo230(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo230(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo230(Connection, bool)): runScripts: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/210-to-230-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:535: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo230(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 230", e);
            throw new StartupException("Problem upgrading database to version 230", e);
        }
        
        updateDatabaseVersion(con, 230);
    }
    //#DatabaseInstaller.java:547: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo230(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 2.4.0
     */
    private void upgradeTo240(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:554: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo240(Connection, bool)
    //#DatabaseInstaller.java:554: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo240(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo240(Connection, bool)): " "._tainted
    //#input(void upgradeTo240(Connection, bool)): ""._tainted
    //#input(void upgradeTo240(Connection, bool)): "'"._tainted
    //#input(void upgradeTo240(Connection, bool)): ".230-to-240-migration.sql"._tainted
    //#input(void upgradeTo240(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo240(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo240(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo240(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo240(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo240(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo240(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo240(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo240(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo240(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo240(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo240(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo240(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo240(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo240(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo240(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo240(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo240(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo240(Connection, bool)): con
    //#input(void upgradeTo240(Connection, bool)): log
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo240(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo240(Connection, bool)): runScripts
    //#input(void upgradeTo240(Connection, bool)): this
    //#input(void upgradeTo240(Connection, bool)): this.__Tag
    //#input(void upgradeTo240(Connection, bool)): this.messages
    //#input(void upgradeTo240(Connection, bool)): this.scripts
    //#input(void upgradeTo240(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo240(Connection, bool)): con != null
    //#pre[2] (void upgradeTo240(Connection, bool)): log != null
    //#pre[3] (void upgradeTo240(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo240(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[7] (void upgradeTo240(Connection, bool)): (soft) this.messages != null
    //#pre[8] (void upgradeTo240(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo240(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo240(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo240(Connection, bool)): runScripts: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/230-to-240-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:561: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo240(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 240", e);
            throw new StartupException("Problem upgrading database to version 240", e);
        }
        
        updateDatabaseVersion(con, 240);
    }
    //#DatabaseInstaller.java:573: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo240(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 3.0.0
     */
    private void upgradeTo300(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:580: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo300(Connection, bool)
    //#DatabaseInstaller.java:580: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo300(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo300(Connection, bool)): " "._tainted
    //#input(void upgradeTo300(Connection, bool)): " for websites with no locale"._tainted
    //#input(void upgradeTo300(Connection, bool)): ""._tainted
    //#input(void upgradeTo300(Connection, bool)): "'"._tainted
    //#input(void upgradeTo300(Connection, bool)): ".240-to-300-migration.sql"._tainted
    //#input(void upgradeTo300(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo300(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo300(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo300(Connection, bool)): "Setting website locale to "._tainted
    //#input(void upgradeTo300(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo300(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo300(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo300(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo300(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo300(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo300(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo300(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo300(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo300(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo300(Connection, bool)): "select weblogentry.id,website.locale from weblogentry,website where weblogentry.websiteid = website.id"._tainted
    //#input(void upgradeTo300(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo300(Connection, bool)): "update weblogentry set locale = ? where id = ?"._tainted
    //#input(void upgradeTo300(Connection, bool)): "update website set locale = ? where locale = ''"._tainted
    //#input(void upgradeTo300(Connection, bool)): "update website set locale = ? where locale is NULL"._tainted
    //#input(void upgradeTo300(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo300(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo300(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo300(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo300(Connection, bool)): con
    //#input(void upgradeTo300(Connection, bool)): log
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo300(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo300(Connection, bool)): runScripts
    //#input(void upgradeTo300(Connection, bool)): this
    //#input(void upgradeTo300(Connection, bool)): this.__Tag
    //#input(void upgradeTo300(Connection, bool)): this.messages
    //#input(void upgradeTo300(Connection, bool)): this.scripts
    //#input(void upgradeTo300(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo300(Connection, bool)): con != null
    //#pre[2] (void upgradeTo300(Connection, bool)): log != null
    //#pre[7] (void upgradeTo300(Connection, bool)): this.messages != null
    //#pre[3] (void upgradeTo300(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo300(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[8] (void upgradeTo300(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo300(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#presumption(void upgradeTo300(Connection, bool)): java.sql.Connection:prepareStatement(...)@608 != null
    //#presumption(void upgradeTo300(Connection, bool)): java.sql.Connection:prepareStatement(...)@611 != null
    //#presumption(void upgradeTo300(Connection, bool)): java.sql.Connection:prepareStatement(...)@622 != null
    //#presumption(void upgradeTo300(Connection, bool)): java.sql.Connection:prepareStatement(...)@628 != null
    //#presumption(void upgradeTo300(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@631 != null
    //#presumption(void upgradeTo300(Connection, bool)): java.util.Locale:getDefault(...)@603 != null
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo300(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo300(Connection, bool)): runScripts: {0}, {1}
    //#test_vector(void upgradeTo300(Connection, bool)): java.sql.Connection:getAutoCommit(...)@644: {1}, {0}
    //#test_vector(void upgradeTo300(Connection, bool)): java.sql.ResultSet:next(...)@632: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/240-to-300-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:587: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo300(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
            
            /*
             * For Roller 3.0.0 we are allowing each weblogentry to track a
             * locale now so that we can support multi-lingual blogs.  As part
             * of the upgrade process we want to do 2 things ..
             *
             * 1. make sure all weblogs have a locale
             * 2. set the locale on all entries to the locale for the weblog
             */
            
            successMessage("Doing upgrade to 300 ...");
            
            // get system default language
            String locale = java.util.Locale.getDefault().getLanguage();
            
            successMessage("Setting website locale to "+locale+" for websites with no locale");
            
            // update all weblogs where locale is "null"
            PreparedStatement updateNullWeblogLocale = con.prepareStatement(
                    "update website set locale = ? where locale is NULL");
            // update all weblogs where locale is empty string ""
            PreparedStatement updateEmptyWeblogLocale = con.prepareStatement(
                    "update website set locale = ? where locale = ''");
            updateNullWeblogLocale.setString( 1, locale);
            updateEmptyWeblogLocale.setString( 1, locale);
            updateNullWeblogLocale.executeUpdate();
            updateEmptyWeblogLocale.executeUpdate();

            
            successMessage("Setting weblogentry locales to website locale");
            
            // get all entries and the locale of its website
            PreparedStatement selectWeblogsLocale = con.prepareStatement(
                    "select weblogentry.id,website.locale "+
                    "from weblogentry,website "+
                    "where weblogentry.websiteid = website.id");
            
            // set the locale for an entry
            PreparedStatement updateWeblogLocale = con.prepareStatement(
                    "update weblogentry set locale = ? where id = ?");
            
            ResultSet websiteSet = selectWeblogsLocale.executeQuery();
            while (websiteSet.next()) {
                String entryid = websiteSet.getString(1);
                String entrylocale = websiteSet.getString(2);
                
                // update entry locale
                updateWeblogLocale.clearParameters();
                updateWeblogLocale.setString( 1, entrylocale);
                updateWeblogLocale.setString( 2, entryid);
                updateWeblogLocale.executeUpdate();
            }
            
            
            if (!con.getAutoCommit()) con.commit();
            
            successMessage("Upgrade to 300 complete.");
            
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 300", e);
            throw new StartupException("Problem upgrading database to version 300", e);
        }
        
        updateDatabaseVersion(con, 300);
    }
    //#DatabaseInstaller.java:657: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo300(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 3.1.0
     */
    private void upgradeTo310(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:664: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo310(Connection, bool)
    //#DatabaseInstaller.java:664: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo310(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo310(Connection, bool)): " "._tainted
    //#input(void upgradeTo310(Connection, bool)): ""._tainted
    //#input(void upgradeTo310(Connection, bool)): "'"._tainted
    //#input(void upgradeTo310(Connection, bool)): ".300-to-310-migration.sql"._tainted
    //#input(void upgradeTo310(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo310(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo310(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo310(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo310(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo310(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo310(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo310(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo310(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo310(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo310(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo310(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo310(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo310(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo310(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo310(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo310(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo310(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo310(Connection, bool)): con
    //#input(void upgradeTo310(Connection, bool)): log
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo310(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo310(Connection, bool)): runScripts
    //#input(void upgradeTo310(Connection, bool)): this
    //#input(void upgradeTo310(Connection, bool)): this.__Tag
    //#input(void upgradeTo310(Connection, bool)): this.messages
    //#input(void upgradeTo310(Connection, bool)): this.scripts
    //#input(void upgradeTo310(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo310(Connection, bool)): con != null
    //#pre[2] (void upgradeTo310(Connection, bool)): log != null
    //#pre[3] (void upgradeTo310(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo310(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[7] (void upgradeTo310(Connection, bool)): (soft) this.messages != null
    //#pre[8] (void upgradeTo310(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo310(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo310(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo310(Connection, bool)): runScripts: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/300-to-310-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:671: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo310(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
        } catch (Exception e) {
            log.error("ERROR running 310 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 310", e);
            throw new StartupException("Problem upgrading database to version 310", e);
        }
        
        updateDatabaseVersion(con, 310);
    }
    //#DatabaseInstaller.java:683: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo310(Connection, bool)
    
    
    /**
     * Upgrade database for Roller 4.0.0
     */
    private void upgradeTo400(Connection con, boolean runScripts) throws StartupException {
        
        successMessage("Doing upgrade to 400 ...");
    //#DatabaseInstaller.java:691: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo400(Connection, bool)
    //#DatabaseInstaller.java:691: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo400(Connection, bool)): " "._tainted
    //#input(void upgradeTo400(Connection, bool)): " Lx category paths"._tainted
    //#input(void upgradeTo400(Connection, bool)): " Lx folder paths"._tainted
    //#input(void upgradeTo400(Connection, bool)): ""._tainted
    //#input(void upgradeTo400(Connection, bool)): "'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "."._tainted
    //#input(void upgradeTo400(Connection, bool)): ".310-to-400-migration.sql"._tainted
    //#input(void upgradeTo400(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo400(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo400(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo400(Connection, bool)): "Updated "._tainted
    //#input(void upgradeTo400(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo400(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo400(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo400(Connection, bool)): "delete from rag_group where handle = 'external'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo400(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo400(Connection, bool)): "insert into roller_properties(name,value) values(?,?)"._tainted
    //#input(void upgradeTo400(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo400(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo400(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo400(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo400(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select categoryid, ancestorid from weblogcategoryassoc where relation='PARENT'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select f.id, f.name from folder f, folder p where f.parentid = p.id and p.parentid is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select f.id, f.name from weblogcategory f, weblogcategory p where f.parentid = p.id and p.parentid is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select f.id, f.name, p.path from folder f, folder p where f.parentid = p.id and p.path <> '.' and p.path is not NULL and f.path is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select f.id, f.name, p.path from weblogcategory f, weblogcategory p wh ... tid = p.id and p.path <> '.' and p.path is not NULL and f.path is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select folderid, ancestorid from folderassoc where relation='PARENT'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select id from rag_group where handle = 'all'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select id from rag_group where handle = 'external'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select id,feed_url,author from rag_subscription"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select value from roller_properties where name = 'site.absoluteurl'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select value from roller_properties where name = 'users.comments.autoformat'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "select value from roller_properties where name = 'users.comments.escapehtml'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update folder set parentid=? where id=?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update folder set path = '.' where parentid is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update folder set path=? where id=?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update rag_group set handle = 'all' where handle = 'external'"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update rag_group_subscription set group_id = ? where group_id = ?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update rag_subscription set last_updated=last_updated, feed_url = ? where id = ?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update roller_comment set posttime=posttime, contenttype = ?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update roller_comment set posttime=posttime, plugins = ?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update weblogcategory set parentid=? where id=?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update weblogcategory set path = '.' where parentid is NULL"._tainted
    //#input(void upgradeTo400(Connection, bool)): "update weblogcategory set path=? where id=?"._tainted
    //#input(void upgradeTo400(Connection, bool)): "weblogger:"._tainted
    //#input(void upgradeTo400(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo400(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo400(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo400(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo400(Connection, bool)): con
    //#input(void upgradeTo400(Connection, bool)): log
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo400(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo400(Connection, bool)): runScripts
    //#input(void upgradeTo400(Connection, bool)): this
    //#input(void upgradeTo400(Connection, bool)): this.__Tag
    //#input(void upgradeTo400(Connection, bool)): this.messages
    //#input(void upgradeTo400(Connection, bool)): this.scripts
    //#input(void upgradeTo400(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo400(Connection, bool)): con != null
    //#pre[2] (void upgradeTo400(Connection, bool)): log != null
    //#pre[7] (void upgradeTo400(Connection, bool)): this.messages != null
    //#pre[3] (void upgradeTo400(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo400(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[8] (void upgradeTo400(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo400(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1030 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1043 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1055 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1082 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1090 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@1097 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@734 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@736 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@748 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@750 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@784 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@790 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@794 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@811 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@816 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@849 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@855 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@859 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@876 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@881 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@928 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@936 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@945 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@953 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@961 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@981 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@990 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.Connection:prepareStatement(...)@993 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@1032 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@1045 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@738 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@752 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@796 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@829 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@861 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@894 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@930 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@938 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@984 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.PreparedStatement:executeQuery(...)@996 != null
    //#presumption(void upgradeTo400(Connection, bool)): java.sql.ResultSet:getString(...)@999 != null
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo400(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo400(Connection, bool)): runScripts: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.lang.String:equals(...)@1035: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.lang.String:equals(...)@1049: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.lang.String:length(...)@989: {0}, {1..4_294_967_295}
    //#test_vector(void upgradeTo400(Connection, bool)): java.lang.String:startsWith(...)@1003: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.Connection:getAutoCommit(...)@1013: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.Connection:getAutoCommit(...)@1103: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.Connection:getAutoCommit(...)@762: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.Connection:getAutoCommit(...)@911: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.Connection:getAutoCommit(...)@966: {1}, {0}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:getString(...)@1034: Addr_Set{null}, Inverse{null}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:getString(...)@1047: Addr_Set{null}, Inverse{null}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@1033: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@1046: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@739: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@753: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@797: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@830: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@862: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@895: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@931: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@939: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@985: {0}, {1}
    //#test_vector(void upgradeTo400(Connection, bool)): java.sql.ResultSet:next(...)@997: {0}, {1}
        
        // first we need to run upgrade scripts 
        SQLScriptRunner runner = null;
        try {    
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/310-to-400-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);                
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:701: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
        } catch(Exception ex) {
            log.error("ERROR running 400 database upgrade script", ex);
            if (runner != null) messages.addAll(runner.getMessages());
            
            errorMessage("Problem upgrading database to version 400", ex);
            throw new StartupException("Problem upgrading database to version 400", ex);
        }
        
        
        // now upgrade hierarchical objects data model
        try {
            successMessage("Populating parentid columns for weblogcategory and folder tables");
            
            // Populate parentid in weblogcategory and folder tables.
            //
            // We'd like to do something like the below, but few databases 
            // support multiple table udpates, which are part of SQL-99
            //
            // update weblogcategory, weblogcategoryassoc 
            //   set weblogcategory.parentid = weblogcategoryassoc.ancestorid 
            //   where 
            //      weblogcategory.id = weblogcategoryassoc.categoryid 
            //      and weblogcategoryassoc.relation = 'PARENT';
            //
            // update folder,folderassoc 
            //   set folder.parentid = folderassoc.ancestorid 
            //   where 
            //      folder.id = folderassoc.folderid 
            //      and folderassoc.relation = 'PARENT';
            
            PreparedStatement selectParents = con.prepareStatement(
                "select categoryid, ancestorid from weblogcategoryassoc where relation='PARENT'");
            PreparedStatement updateParent = con.prepareStatement(
                "update weblogcategory set parentid=? where id=?");            
            ResultSet parentSet = selectParents.executeQuery();
            while (parentSet.next()) {
                String categoryid = parentSet.getString(1);
                String parentid = parentSet.getString(2);                
                updateParent.clearParameters();
                updateParent.setString( 1, parentid);
                updateParent.setString( 2, categoryid);
                updateParent.executeUpdate();
            }
            
            selectParents = con.prepareStatement(
                "select folderid, ancestorid from folderassoc where relation='PARENT'");
            updateParent = con.prepareStatement(
                "update folder set parentid=? where id=?");            
            parentSet = selectParents.executeQuery();
            while (parentSet.next()) {
                String folderid = parentSet.getString(1);
                String parentid = parentSet.getString(2);                
                updateParent.clearParameters();
                updateParent.setString( 1, parentid);
                updateParent.setString( 2, folderid);
                updateParent.executeUpdate();
            }
            
            if (!con.getAutoCommit()) con.commit();
           
            successMessage("Done populating parentid columns.");
            
        } catch (Exception e) {
            errorMessage("Problem upgrading database to version 320", e);
            throw new StartupException("Problem upgrading database to version 320", e);
        }
        
        
        try {
            successMessage("Populating path columns for weblogcategory and folder tables.");
                        
            // Populate path in weblogcategory and folder tables.
            //
            // It would be nice if there was a simple sql solution for doing
            // this, but sadly the only real way to do it is through brute
            // force walking the hierarchical trees.  Luckily, it seems that
            // most people don't create multi-level hierarchies, so hopefully
            // this won't be too bad
            
            // set path to '/' for nodes with no parents (aka root nodes)
            PreparedStatement setRootPaths = con.prepareStatement(
                "update weblogcategory set path = '/' where parentid is NULL");
            setRootPaths.clearParameters();
            setRootPaths.executeUpdate();
            
            // select all nodes whose parent has no parent (aka 1st level nodes)
            PreparedStatement selectL1Children = con.prepareStatement(
                "select f.id, f.name from weblogcategory f, weblogcategory p "+
                    "where f.parentid = p.id and p.parentid is NULL");
            // update L1 nodes with their path (/<name>)
            PreparedStatement updateL1Children = con.prepareStatement(
                "update weblogcategory set path=? where id=?");
            ResultSet L1Set = selectL1Children.executeQuery();
            while (L1Set.next()) {
                String id = L1Set.getString(1);
                String name = L1Set.getString(2);                
                updateL1Children.clearParameters();
                updateL1Children.setString( 1, "/"+name);
                updateL1Children.setString( 2, id);
                updateL1Children.executeUpdate();
            }
            
            // now for the complicated part =(
            // we need to keep iterating over L2, L3, etc nodes and setting
            // their path until all nodes have been updated.
            
            // select all nodes whose parent path has been set, excluding L1 nodes
            PreparedStatement selectLxChildren = con.prepareStatement(
                "select f.id, f.name, p.path from weblogcategory f, weblogcategory p "+
                    "where f.parentid = p.id and p.path <> '/' "+
                    "and p.path is not NULL and f.path is NULL");
            // update Lx nodes with their path (<parentPath>/<name>)
            PreparedStatement updateLxChildren = con.prepareStatement(
                "update weblogcategory set path=? where id=?");
            
            // this loop allows us to run this part of the upgrade process as
            // long as is necessary based on the depth of the hierarchy, and
            // we use the do/while construct to ensure it's run at least once
            int catNumCounted = 0;
    //#DatabaseInstaller.java:822: Warning: unused assignment
    //#    unused assignment into catNumCounted
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    Attribs:  Uncertain
            do {
                log.debug("Doing pass over Lx children for categories");
    //#DatabaseInstaller.java:824: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                
                // reset count for each iteration of outer loop
                catNumCounted = 0;
                
                ResultSet LxSet = selectLxChildren.executeQuery();
                while (LxSet.next()) {
                    String id = LxSet.getString(1);
                    String name = LxSet.getString(2);
                    String parentPath = LxSet.getString(3);
                    updateLxChildren.clearParameters();
                    updateLxChildren.setString( 1, parentPath+"/"+name);
                    updateLxChildren.setString( 2, id);
                    updateLxChildren.executeUpdate();
                    
                    // count the updated rows
                    catNumCounted++;
    //#DatabaseInstaller.java:840: ?overflow
    //#    catNumCounted in -2_147_483_649..4_294_967_294
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    basic block: bb_26
    //#    assertion: catNumCounted in -2_147_483_649..4_294_967_294
    //#    VN: catNumCounted + 1
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296}
    //#    Attribs:  Int  Bad singleton  Bad > Exp
                }
                
                log.debug("Updated "+catNumCounted+" Lx category paths");
    //#DatabaseInstaller.java:843: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            } while(catNumCounted > 0);
            
            
            
            // set path to '/' for nodes with no parents (aka root nodes)
            setRootPaths = con.prepareStatement(
                "update folder set path = '/' where parentid is NULL");
            setRootPaths.clearParameters();
            setRootPaths.executeUpdate();
            
            // select all nodes whose parent has no parent (aka 1st level nodes)
            selectL1Children = con.prepareStatement(
                "select f.id, f.name from folder f, folder p "+
                    "where f.parentid = p.id and p.parentid is NULL");
            // update L1 nodes with their path (/<name>)
            updateL1Children = con.prepareStatement(
                "update folder set path=? where id=?");
            L1Set = selectL1Children.executeQuery();
            while (L1Set.next()) {
                String id = L1Set.getString(1);
                String name = L1Set.getString(2);                
                updateL1Children.clearParameters();
                updateL1Children.setString( 1, "/"+name);
                updateL1Children.setString( 2, id);
                updateL1Children.executeUpdate();
            }
            
            // now for the complicated part =(
            // we need to keep iterating over L2, L3, etc nodes and setting
            // their path until all nodes have been updated.
            
            // select all nodes whose parent path has been set, excluding L1 nodes
            selectLxChildren = con.prepareStatement(
                "select f.id, f.name, p.path from folder f, folder p "+
                    "where f.parentid = p.id and p.path <> '/' "+
                    "and p.path is not NULL and f.path is NULL");
            // update Lx nodes with their path (/<name>)
            updateLxChildren = con.prepareStatement(
                "update folder set path=? where id=?");
            
            // this loop allows us to run this part of the upgrade process as
            // long as is necessary based on the depth of the hierarchy, and
            // we use the do/while construct to ensure it's run at least once
            int folderNumUpdated = 0;
    //#DatabaseInstaller.java:887: Warning: unused assignment
    //#    unused assignment into folderNumUpdated
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    Attribs:  Uncertain
            do {
                log.debug("Doing pass over Lx children for folders");
    //#DatabaseInstaller.java:889: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
                
                // reset count for each iteration of outer loop
                folderNumUpdated = 0;
                
                ResultSet LxSet = selectLxChildren.executeQuery();
                while (LxSet.next()) {
                    String id = LxSet.getString(1);
                    String name = LxSet.getString(2);
                    String parentPath = LxSet.getString(3);
                    updateLxChildren.clearParameters();
                    updateLxChildren.setString( 1, parentPath+"/"+name);
                    updateLxChildren.setString( 2, id);
                    updateLxChildren.executeUpdate();
                    
                    // count the updated rows
                    folderNumUpdated++;
    //#DatabaseInstaller.java:905: ?overflow
    //#    folderNumUpdated in -2_147_483_649..4_294_967_294
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    basic block: bb_34
    //#    assertion: folderNumUpdated in -2_147_483_649..4_294_967_294
    //#    VN: folderNumUpdated + 1
    //#    Expected: {-2_147_483_648..4_294_967_295, Invalid}
    //#    Bad: {4_294_967_296}
    //#    Attribs:  Int  Bad singleton  Bad > Exp
                }
                
                log.debug("Updated "+folderNumUpdated+" Lx folder paths");
    //#DatabaseInstaller.java:908: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            } while(folderNumUpdated > 0);
            
            if (!con.getAutoCommit()) con.commit();
           
            successMessage("Done populating path columns.");
            
        } catch (SQLException e) {
            log.error("Problem upgrading database to version 320", e);
            throw new StartupException("Problem upgrading database to version 320", e);
        }
        
        
        // 4.0 changes the planet data model a bit, so we need to clean that up
        try {
            successMessage("Merging planet groups 'all' and 'external'");
            
            // Move all subscriptions in the planet group 'external' to group 'all'
            
            String allGroupId = null;
            PreparedStatement selectAllGroupId = con.prepareStatement(
                "select id from rag_group where handle = 'all'");
            ResultSet rs = selectAllGroupId.executeQuery();
            if (rs.next()) {
                allGroupId = rs.getString(1);
            }
            
            String externalGroupId = null;
            PreparedStatement selectExternalGroupId = con.prepareStatement(
                "select id from rag_group where handle = 'external'");            
            rs = selectExternalGroupId.executeQuery();
            if (rs.next()) {
                externalGroupId = rs.getString(1);
            }
            
            // we only need to merge if both of those groups already existed
            if(allGroupId != null && externalGroupId != null) {
                PreparedStatement updateGroupSubs = con.prepareStatement(
                        "update rag_group_subscription set group_id = ? where group_id = ?");
                updateGroupSubs.clearParameters();
                updateGroupSubs.setString( 1, allGroupId);
                updateGroupSubs.setString( 2, externalGroupId);
                updateGroupSubs.executeUpdate();
                
                // we no longer need the group 'external'
                PreparedStatement deleteExternalGroup = con.prepareStatement(
                        "delete from rag_group where handle = 'external'");
                deleteExternalGroup.executeUpdate();
                
            // if we only have group 'external' then just rename it to 'all'
            } else if(allGroupId == null && externalGroupId != null) {
                
                // rename 'external' to 'all'
                PreparedStatement renameExternalGroup = con.prepareStatement(
                        "update rag_group set handle = 'all' where handle = 'external'");
                renameExternalGroup.executeUpdate();
            }
            
            if (!con.getAutoCommit()) con.commit();
           
            successMessage("Planet group 'external' merged into group 'all'.");
            
        } catch (Exception e) {
            errorMessage("Problem upgrading database to version 400", e);
            throw new StartupException("Problem upgrading database to version 400", e);
        }
        
        
        // update local planet subscriptions to use new local feed format
        try {
            successMessage("Upgrading local planet subscription feeds to new feed url format");
            
            // need to start by looking up absolute site url
            PreparedStatement selectAbsUrl = 
                    con.prepareStatement("select value from roller_properties where name = 'site.absoluteurl'");
            String absUrl = null;
            ResultSet rs = selectAbsUrl.executeQuery();
            if(rs.next()) {
                absUrl = rs.getString(1);
            }
            
            if(absUrl != null && absUrl.length() > 0) {
                PreparedStatement selectSubs = 
                        con.prepareStatement("select id,feed_url,author from rag_subscription");
            
            PreparedStatement updateSubUrl = 
                    con.prepareStatement("update rag_subscription set last_updated=last_updated, feed_url = ? where id = ?");
            
            ResultSet rset = selectSubs.executeQuery();
            while (rset.next()) {
                String id = rset.getString(1);
                String feed_url = rset.getString(2);
                String handle = rset.getString(3);
                
                // only work on local feed urls
                if (feed_url.startsWith(absUrl)) {
                    // update feed_url to 'weblogger:<handle>'
                    updateSubUrl.clearParameters();
                    updateSubUrl.setString( 1, "weblogger:"+handle);
                    updateSubUrl.setString( 2, id);
                    updateSubUrl.executeUpdate();
                }
            }
            }
            
            if (!con.getAutoCommit()) con.commit();
           
            successMessage("Comments successfully updated to use new comment plugins.");
            
        } catch (Exception e) {
            errorMessage("Problem upgrading database to version 400", e);
            throw new StartupException("Problem upgrading database to version 400", e);
        }
        
        
        // upgrade comments to use new plugin mechanism
        try {
            successMessage("Upgrading existing comments with content-type & plugins");
            
            // look in db and see if comment autoformatting is enabled
            boolean autoformatEnabled = false;
            String autoformat = null;
    //#DatabaseInstaller.java:1029: Warning: unused assignment
    //#    unused assignment into autoformat
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    Attribs:  Uncertain
            PreparedStatement selectIsAutoformtEnabled = con.prepareStatement(
                "select value from roller_properties where name = 'users.comments.autoformat'");
            ResultSet rs = selectIsAutoformtEnabled.executeQuery();
            if (rs.next()) {
                autoformat = rs.getString(1);
                if(autoformat != null && "true".equals(autoformat)) {
                    autoformatEnabled = true;
                }
            }
            
            // look in db and see if comment html escaping is enabled
            boolean htmlEnabled = false;
            String escapehtml = null;
    //#DatabaseInstaller.java:1042: Warning: unused assignment
    //#    unused assignment into escapehtml
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo400(Connection, bool)
    //#    Attribs:  Uncertain
            PreparedStatement selectIsEscapehtmlEnabled = con.prepareStatement(
                "select value from roller_properties where name = 'users.comments.escapehtml'");
            ResultSet rs1 = selectIsEscapehtmlEnabled.executeQuery();
            if (rs1.next()) {
                escapehtml = rs1.getString(1);
                // NOTE: we allow html only when html escaping is OFF
                if(escapehtml != null && !"true".equals(escapehtml)) {
                    htmlEnabled = true;
                }
            }
            
            // first lets set the new 'users.comments.htmlenabled' property
            PreparedStatement addCommentHtmlProp = con.prepareStatement("insert into roller_properties(name,value) values(?,?)");
            addCommentHtmlProp.clearParameters();
            addCommentHtmlProp.setString(1, "users.comments.htmlenabled");
            if(htmlEnabled) {
                addCommentHtmlProp.setString(2, "true");
            } else {
                addCommentHtmlProp.setString(2, "false");
            }
            addCommentHtmlProp.executeUpdate();
            
            // determine content-type for existing comments
            String contentType = "text/plain";
            if(htmlEnabled) {
                contentType = "text/html";
            }
            
            // determine plugins for existing comments
            String plugins = "";
            if(htmlEnabled && autoformatEnabled) {
                plugins = "HTMLSubset,AutoFormat";
            } else if(htmlEnabled) {
                plugins = "HTMLSubset";
            } else if(autoformatEnabled) {
                plugins = "AutoFormat";
            }
            
            // set new comment plugins configuration property 'users.comments.plugins'
            PreparedStatement addCommentPluginsProp = 
                    con.prepareStatement("insert into roller_properties(name,value) values(?,?)");
            addCommentPluginsProp.clearParameters();
            addCommentPluginsProp.setString(1, "users.comments.plugins");
            addCommentPluginsProp.setString(2, plugins);
            addCommentPluginsProp.executeUpdate();
            
            // set content-type for all existing comments
            PreparedStatement updateCommentsContentType = 
                    con.prepareStatement("update roller_comment set posttime=posttime, contenttype = ?");
            updateCommentsContentType.clearParameters();
            updateCommentsContentType.setString(1, contentType);
            updateCommentsContentType.executeUpdate();

            // set plugins for all existing comments
            PreparedStatement updateCommentsPlugins = 
                    con.prepareStatement("update roller_comment set posttime=posttime, plugins = ?");
            updateCommentsPlugins.clearParameters();
            updateCommentsPlugins.setString(1, plugins);
            updateCommentsPlugins.executeUpdate();
            
            if (!con.getAutoCommit()) con.commit();
           
            successMessage("Comments successfully updated to use new comment plugins.");
            
        } catch (Exception e) {
            errorMessage("Problem upgrading database to version 400", e);
            throw new StartupException("Problem upgrading database to version 400", e);
        }
        
        // finally, upgrade db version string to 400
        updateDatabaseVersion(con, 400);
    }
    //#DatabaseInstaller.java:1114: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo400(Connection, bool)
    
    
    /**
     * Use database product name to get the database script directory name.
     */
    public String getDatabaseHandle(Connection con) throws SQLException {
        
        String productName = con.getMetaData().getDatabaseProductName();
    //#DatabaseInstaller.java:1122: method: String org.apache.roller.weblogger.business.startup.DatabaseInstaller.getDatabaseHandle(Connection)
    //#input(String getDatabaseHandle(Connection)): con
    //#output(String getDatabaseHandle(Connection)): return_value
    //#pre[1] (String getDatabaseHandle(Connection)): con != null
    //#presumption(String getDatabaseHandle(Connection)): java.sql.Connection:getMetaData(...)@1122 != null
    //#presumption(String getDatabaseHandle(Connection)): java.sql.DatabaseMetaData:getDatabaseProductName(...)@1122 != null
    //#post(String getDatabaseHandle(Connection)): return_value in Addr_Set{&"mysql",&"derby",&"oracle",&"db2",&"mssql",&"postgresql",&"hsqldb"}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1124: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1126: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1128: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1130: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1132: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1134: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
    //#test_vector(String getDatabaseHandle(Connection)): java.lang.String:indexOf(...)@1136: {-1}, {-2_147_483_648..-2, 0..4_294_967_295}
        String handle = "mysql";
        if (       productName.toLowerCase().indexOf("mysql") != -1) {
            handle =  "mysql";
        } else if (productName.toLowerCase().indexOf("derby") != -1) {
            handle =  "derby";
        } else if (productName.toLowerCase().indexOf("hsql") != -1) {
            handle =  "hsqldb";
        } else if (productName.toLowerCase().indexOf("postgres") != -1) {
            handle =  "postgresql";
        } else if (productName.toLowerCase().indexOf("oracle") != -1) {
            handle =  "oracle";
        } else if (productName.toLowerCase().indexOf("microsoft") != -1) {
            handle =  "mssql";
        } else if (productName.toLowerCase().indexOf("db2") != -1) {   
            handle =  "db2";
        }
        
        return handle;
    //#DatabaseInstaller.java:1140: end of method: String org.apache.roller.weblogger.business.startup.DatabaseInstaller.getDatabaseHandle(Connection)
    }

    
    /**
     * Return true if named table exists in database.
     */
    private boolean tableExists(Connection con, String tableName) throws SQLException {
        String[] types = {"TABLE"};
    //#DatabaseInstaller.java:1148: method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.tableExists(Connection, String)
    //#DatabaseInstaller.java:1148: Warning: unused assignment
    //#    unused assignment into types
    //#    severity: LOW
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: bool tableExists(Connection, String)
    //#input(bool tableExists(Connection, String)): con
    //#input(bool tableExists(Connection, String)): tableName
    //#output(bool tableExists(Connection, String)): return_value
    //#pre[1] (bool tableExists(Connection, String)): con != null
    //#pre[2] (bool tableExists(Connection, String)): (soft) tableName != null
    //#presumption(bool tableExists(Connection, String)): java.sql.Connection:getMetaData(...)@1149 != null
    //#presumption(bool tableExists(Connection, String)): java.sql.DatabaseMetaData:getTables(...)@1149 != null
    //#presumption(bool tableExists(Connection, String)): java.sql.ResultSet:getString(...)@1151 != null
    //#post(bool tableExists(Connection, String)): init'ed(return_value)
    //#test_vector(bool tableExists(Connection, String)): java.lang.String:equals(...)@1151: {0}, {1}
    //#test_vector(bool tableExists(Connection, String)): java.sql.ResultSet:next(...)@1150: {0}, {1}
        ResultSet rs = con.getMetaData().getTables(null, null, "%", null);
        while (rs.next()) {
            if (tableName.toLowerCase().equals(rs.getString("TABLE_NAME").toLowerCase())) {
                return true;
            }
        }
        return false;
    //#DatabaseInstaller.java:1155: end of method: bool org.apache.roller.weblogger.business.startup.DatabaseInstaller.tableExists(Connection, String)
    }
    
    
    private int getDatabaseVersion() throws StartupException {
        int dbversion = -1;
    //#DatabaseInstaller.java:1160: method: int org.apache.roller.weblogger.business.startup.DatabaseInstaller.getDatabaseVersion()
    //#input(int getDatabaseVersion()): log
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType.JDBC_PROPERTIES
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[org/apache/roller/weblogger/business/DatabaseProvider]
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider.__Descendant_Table[others]
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getConnection()Ljava/sql/Connection;
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getJdbcConnectionURL()Ljava/lang/String;
    //#input(int getDatabaseVersion()): org/apache/roller/weblogger/business/DatabaseProvider.__Dispatch_Table.getType()Lorg/apache/roller/weblogger/business/DatabaseProvider$ConfigurationType;
    //#input(int getDatabaseVersion()): this
    //#input(int getDatabaseVersion()): this.db
    //#input(int getDatabaseVersion()): this.db.__Tag
    //#input(int getDatabaseVersion()): this.db.dataSource
    //#input(int getDatabaseVersion()): this.db.jdbcConnectionURL
    //#input(int getDatabaseVersion()): this.db.props
    //#input(int getDatabaseVersion()): this.db.props._tainted
    //#input(int getDatabaseVersion()): this.db.type
    //#output(int getDatabaseVersion()): return_value
    //#pre[1] (int getDatabaseVersion()): (soft) log != null
    //#pre[3] (int getDatabaseVersion()): (soft) this.db != null
    //#pre[4] (int getDatabaseVersion()): (soft) this.db.__Tag == org/apache/roller/weblogger/business/DatabaseProvider
    //#pre[5] (int getDatabaseVersion()): (soft) this.db.dataSource != null
    //#pre[6] (int getDatabaseVersion()): (soft) init'ed(this.db.jdbcConnectionURL)
    //#pre[7] (int getDatabaseVersion()): (soft) this.db.props != null
    //#pre[8] (int getDatabaseVersion()): (soft) this.db.props._tainted == 0
    //#pre[9] (int getDatabaseVersion()): (soft) init'ed(this.db.type)
    //#presumption(int getDatabaseVersion()): java.sql.Connection:createStatement(...)@1166 != null
    //#presumption(int getDatabaseVersion()): java.sql.Statement:executeQuery(...)@1169 != null
    //#presumption(int getDatabaseVersion()): java.sql.Statement:executeQuery(...)@1179 != null
    //#post(int getDatabaseVersion()): init'ed(return_value)
    //#unanalyzed(int getDatabaseVersion()): Effects-of-calling:java.sql.DriverManager:getConnection
    //#unanalyzed(int getDatabaseVersion()): Effects-of-calling:javax.sql.DataSource:getConnection
    //#test_vector(int getDatabaseVersion()): java.sql.ResultSet:next(...)@1172: {0}, {1}
        
        // get the current db version
        Connection con = null;
        try {
            con = db.getConnection();
            Statement stmt = con.createStatement();
    //#DatabaseInstaller.java:1166: ?null dereference
    //#    con != null
    //#    severity: MEDIUM
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: int getDatabaseVersion()
    //#    basic block: bb_2
    //#    assertion: con != null
    //#    VN: getConnection(...)
    //#    Expected: Inverse{null} or Invalid
    //#    Bad: Addr_Set{null}
    //#    Attribs:  Ptr  null in Bad
            
            // just check in the roller_properties table
            ResultSet rs = stmt.executeQuery(
                    "select value from roller_properties where name = '"+DBVERSION_PROP+"'");
            
            if(rs.next()) {
                dbversion = Integer.parseInt(rs.getString(1));
                
            } else {
                // tough to know if this is an upgrade with no db version :/
                // however, if roller_properties is not empty then we at least
                // we have someone upgrading from 1.2.x
                rs = stmt.executeQuery("select count(*) from roller_properties");
                if(rs.next()) {
                    if(rs.getInt(1) > 0)
                        dbversion = 120;
                }
            }
            
        } catch(Exception e) {
            // that's strange ... hopefully we didn't need to upgrade
            log.error("Couldn't lookup current database version", e);           
    //#DatabaseInstaller.java:1188: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: int getDatabaseVersion()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        } finally {
            try { if (con != null) con.close(); } catch (Exception ignored) {}
        }       
        return dbversion;
    //#DatabaseInstaller.java:1192: end of method: int org.apache.roller.weblogger.business.startup.DatabaseInstaller.getDatabaseVersion()
    }
    
    
    /**
     * Upgrade database for Roller 4.0.1
     */
    private void upgradeTo401(Connection con, boolean runScripts) throws StartupException {
        SQLScriptRunner runner = null;
    //#DatabaseInstaller.java:1200: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo401(Connection, bool)
    //#DatabaseInstaller.java:1200: Warning: suspicious precondition
    //#    the precondition for this.scripts.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo401(Connection, bool)
    //#    suspicious precondition index: [9]
    //#    Attribs:  Soft
    //#input(void upgradeTo401(Connection, bool)): " "._tainted
    //#input(void upgradeTo401(Connection, bool)): ""._tainted
    //#input(void upgradeTo401(Connection, bool)): "'"._tainted
    //#input(void upgradeTo401(Connection, bool)): ".400-to-401-migration.sql"._tainted
    //#input(void upgradeTo401(Connection, bool)): ".dbscripts."._tainted
    //#input(void upgradeTo401(Connection, bool)): "ERROR: SQLException executing SQL ["._tainted
    //#input(void upgradeTo401(Connection, bool)): "Running database upgrade script: "._tainted
    //#input(void upgradeTo401(Connection, bool)): "Updated database verstion to "._tainted
    //#input(void upgradeTo401(Connection, bool)): "] : "._tainted
    //#input(void upgradeTo401(Connection, bool)): "db2"._tainted
    //#input(void upgradeTo401(Connection, bool)): "derby"._tainted
    //#input(void upgradeTo401(Connection, bool)): "hsqldb"._tainted
    //#input(void upgradeTo401(Connection, bool)): "mssql"._tainted
    //#input(void upgradeTo401(Connection, bool)): "mysql"._tainted
    //#input(void upgradeTo401(Connection, bool)): "oracle"._tainted
    //#input(void upgradeTo401(Connection, bool)): "postgresql"._tainted
    //#input(void upgradeTo401(Connection, bool)): "roller.database.version"._tainted
    //#input(void upgradeTo401(Connection, bool)): "update roller_properties set value = '"._tainted
    //#input(void upgradeTo401(Connection, bool)): "where name = '"._tainted
    //#input(void upgradeTo401(Connection, bool)): __Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseInstaller]
    //#input(void upgradeTo401(Connection, bool)): __Descendant_Table[others]
    //#input(void upgradeTo401(Connection, bool)): __Dispatch_Table.getDatabaseHandle(Ljava/sql/Connection;)Ljava/lang/String;
    //#input(void upgradeTo401(Connection, bool)): con
    //#input(void upgradeTo401(Connection, bool)): log
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider]
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[org/apache/roller/weblogger/business/startup/DatabaseScriptProvider]
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Descendant_Table[others]
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/DatabaseScriptProvider.__Dispatch_Table.getDatabaseScript(Ljava/lang/String;)Ljava/io/InputStream;
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Descendant_Table[org/apache/roller/weblogger/business/startup/SQLScriptRunner]
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.getMessages()Ljava/util/List;
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.__Dispatch_Table.runScript(Ljava/sql/Connection;Z)V
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/SQLScriptRunner.log
    //#input(void upgradeTo401(Connection, bool)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void upgradeTo401(Connection, bool)): runScripts
    //#input(void upgradeTo401(Connection, bool)): this
    //#input(void upgradeTo401(Connection, bool)): this.__Tag
    //#input(void upgradeTo401(Connection, bool)): this.messages
    //#input(void upgradeTo401(Connection, bool)): this.scripts
    //#input(void upgradeTo401(Connection, bool)): this.scripts.__Tag
    //#pre[1] (void upgradeTo401(Connection, bool)): con != null
    //#pre[2] (void upgradeTo401(Connection, bool)): log != null
    //#pre[3] (void upgradeTo401(Connection, bool)): (soft) org/apache/roller/weblogger/business/startup/SQLScriptRunner.log != null
    //#pre[6] (void upgradeTo401(Connection, bool)): (soft) this.__Tag == org/apache/roller/weblogger/business/startup/DatabaseInstaller
    //#pre[7] (void upgradeTo401(Connection, bool)): (soft) this.messages != null
    //#pre[8] (void upgradeTo401(Connection, bool)): (soft) this.scripts != null
    //#pre[9] (void upgradeTo401(Connection, bool)): (soft) this.scripts.__Tag in {org/apache/roller/weblogger/business/startup/ClasspathDatabaseScriptProvider, org/apache/roller/weblogger/business/startup/DatabaseScriptProvider}
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.Connection:getMetaData
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:toLowerCase
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.util.List:add
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:org.apache.roller.RollerException
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:org.apache.commons.logging.Log:trace
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.DatabaseMetaData:getDatabaseProductName
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:indexOf
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.Class:getResourceAsStream
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.util.ArrayList
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.InputStreamReader
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.BufferedReader
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.BufferedReader:readLine
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:trim
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:startsWith
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:endsWith
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.BufferedReader:close
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.Connection:getAutoCommit
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.Connection:commit
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.SQLException:getLocalizedMessage
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.StringWriter
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.PrintWriter
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.sql.SQLException:printStackTrace
    //#unanalyzed(void upgradeTo401(Connection, bool)): Effects-of-calling:java.io.StringWriter:toString
    //#test_vector(void upgradeTo401(Connection, bool)): runScripts: {0}, {1}
        try {
            if (runScripts) {
                String handle = getDatabaseHandle(con);
                String scriptPath = handle + "/400-to-401-migration.sql";
                successMessage("Running database upgrade script: "+scriptPath);
                runner = new SQLScriptRunner(scripts.getDatabaseScript(scriptPath));
                runner.runScript(con, true);
    //#DatabaseInstaller.java:1207: ?!precondition failure
    //#    org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript: (soft) stopOnError == 0
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void upgradeTo401(Connection, bool)
    //#    basic block: bb_3
    //#    assertion: (soft) false
    //#    callee: void org/apache/roller/weblogger/business/startup/SQLScriptRunner.runScript(Connection, bool)
    //#    callee assertion: (soft) stopOnError == 0
    //#    callee file: SQLScriptRunner.java
    //#    callee precondition index: [2]
    //#    callee srcpos: 121
    //#    VN: 1
    //#    Expected: {0}
    //#    Bad: {1}
    //#    Attribs:  Int  Exp in +/-1000  Exp singleton  Bad singleton  Bad overlaps +/-1000  Soft  Bad > Exp
                messages.addAll(runner.getMessages());
            }
        } catch (Exception e) {
            log.error("ERROR running 401 database upgrade script", e);
            if (runner != null) messages.addAll(runner.getMessages());

            errorMessage("Problem upgrading database to version 401", e);
            throw new StartupException("Problem upgrading database to version 401", e);
        }

        updateDatabaseVersion(con, 310);
    }
    //#DatabaseInstaller.java:1219: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.upgradeTo401(Connection, bool)


    private int parseVersionString(String vstring) {        
        int myversion = 0;
    //#DatabaseInstaller.java:1223: method: int org.apache.roller.weblogger.business.startup.DatabaseInstaller.parseVersionString(String)
    //#input(int parseVersionString(String)): vstring
    //#input(int parseVersionString(String)): vstring._tainted
    //#output(int parseVersionString(String)): return_value
    //#pre[1] (int parseVersionString(String)): vstring != null
    //#presumption(int parseVersionString(String)): java.lang.Integer:parseInt(...)@1236 >= -214_748_364
    //#post(int parseVersionString(String)): (soft) return_value >= -2_147_483_640
    //#test_vector(int parseVersionString(String)): java.lang.Integer:parseInt(...)@1236: {100..4_294_967_295}, {-214_748_364..99}
    //#test_vector(int parseVersionString(String)): java.lang.String:length(...)@1231: {0..3}, {4..4_294_967_295}
        
        // NOTE: this assumes a maximum of 3 digits for the version number
        // so if we get to 10.0 then we'll need to upgrade this
        
        // strip out non-digits
        vstring = vstring.replaceAll("\\Q.\\E", "");
        vstring = vstring.replaceAll("\\D", "");
        if(vstring.length() > 3)
            vstring = vstring.substring(0, 3);
        
        // parse to an int
        try {
            int parsed = Integer.parseInt(vstring);            
            if(parsed < 100) myversion = parsed * 10;
            else myversion = parsed;
        } catch(Exception e) {}  
        
        return myversion;
    //#DatabaseInstaller.java:1241: end of method: int org.apache.roller.weblogger.business.startup.DatabaseInstaller.parseVersionString(String)
    }
    

    /**
     * Insert a new database.version property.
     * This should only be called once for new installations
     */
    private void setDatabaseVersion(Connection con, String version) 
            throws StartupException {
        setDatabaseVersion(con, parseVersionString(version));
    //#DatabaseInstaller.java:1251: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.setDatabaseVersion(Connection, String)
    //#input(void setDatabaseVersion(Connection, String)): "')"._tainted
    //#input(void setDatabaseVersion(Connection, String)): "Set database verstion to "._tainted
    //#input(void setDatabaseVersion(Connection, String)): "insert into roller_properties values('roller.database.version', '"._tainted
    //#input(void setDatabaseVersion(Connection, String)): con
    //#input(void setDatabaseVersion(Connection, String)): log
    //#input(void setDatabaseVersion(Connection, String)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void setDatabaseVersion(Connection, String)): this
    //#input(void setDatabaseVersion(Connection, String)): version
    //#input(void setDatabaseVersion(Connection, String)): version._tainted
    //#pre[1] (void setDatabaseVersion(Connection, String)): con != null
    //#pre[2] (void setDatabaseVersion(Connection, String)): log != null
    //#pre[4] (void setDatabaseVersion(Connection, String)): version != null
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.String:replaceAll
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.String:length
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.String:substring
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.Integer:parseInt
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.sql.Connection:createStatement
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.StringBuilder
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.StringBuilder:append
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.lang.StringBuilder:toString
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:java.sql.Statement:executeUpdate
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:org.apache.commons.logging.Log:debug
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void setDatabaseVersion(Connection, String)): Effects-of-calling:org.apache.roller.RollerException
    }
    //#DatabaseInstaller.java:1252: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.setDatabaseVersion(Connection, String)

    /**
     * Insert a new database.version property.
     * This should only be called once for new installations
     */
    private void setDatabaseVersion(Connection con, int version)
            throws StartupException {
        
        try {
            Statement stmt = con.createStatement();
    //#DatabaseInstaller.java:1262: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.setDatabaseVersion(Connection, int)
    //#input(void setDatabaseVersion(Connection, int)): "')"._tainted
    //#input(void setDatabaseVersion(Connection, int)): "Set database verstion to "._tainted
    //#input(void setDatabaseVersion(Connection, int)): "insert into roller_properties values('roller.database.version', '"._tainted
    //#input(void setDatabaseVersion(Connection, int)): con
    //#input(void setDatabaseVersion(Connection, int)): log
    //#input(void setDatabaseVersion(Connection, int)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void setDatabaseVersion(Connection, int)): version
    //#pre[1] (void setDatabaseVersion(Connection, int)): con != null
    //#pre[2] (void setDatabaseVersion(Connection, int)): log != null
    //#presumption(void setDatabaseVersion(Connection, int)): java.sql.Connection:createStatement(...)@1262 != null
    //#unanalyzed(void setDatabaseVersion(Connection, int)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void setDatabaseVersion(Connection, int)): Effects-of-calling:org.apache.roller.RollerException
            stmt.executeUpdate("insert into roller_properties "+
                    "values('"+DBVERSION_PROP+"', '"+version+"')");
            
            log.debug("Set database verstion to "+version);
    //#DatabaseInstaller.java:1266: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void setDatabaseVersion(Connection, int)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        } catch(SQLException se) {
            throw new StartupException("Error setting database version.", se);
        }
    }
    //#DatabaseInstaller.java:1270: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.setDatabaseVersion(Connection, int)
    
    
    /**
     * Update the existing database.version property
     */
    private void updateDatabaseVersion(Connection con, int version)
            throws StartupException {
        
        try {
            Statement stmt = con.createStatement();
    //#DatabaseInstaller.java:1280: method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.updateDatabaseVersion(Connection, int)
    //#input(void updateDatabaseVersion(Connection, int)): "'"._tainted
    //#input(void updateDatabaseVersion(Connection, int)): "Updated database verstion to "._tainted
    //#input(void updateDatabaseVersion(Connection, int)): "roller.database.version"._tainted
    //#input(void updateDatabaseVersion(Connection, int)): "update roller_properties set value = '"._tainted
    //#input(void updateDatabaseVersion(Connection, int)): "where name = '"._tainted
    //#input(void updateDatabaseVersion(Connection, int)): con
    //#input(void updateDatabaseVersion(Connection, int)): log
    //#input(void updateDatabaseVersion(Connection, int)): org/apache/roller/weblogger/business/startup/StartupException.java.util.Collections.EMPTY_LIST
    //#input(void updateDatabaseVersion(Connection, int)): version
    //#pre[1] (void updateDatabaseVersion(Connection, int)): con != null
    //#pre[2] (void updateDatabaseVersion(Connection, int)): log != null
    //#presumption(void updateDatabaseVersion(Connection, int)): java.sql.Connection:createStatement(...)@1280 != null
    //#unanalyzed(void updateDatabaseVersion(Connection, int)): Effects-of-calling:org.apache.roller.weblogger.WebloggerException
    //#unanalyzed(void updateDatabaseVersion(Connection, int)): Effects-of-calling:org.apache.roller.RollerException
            stmt.executeUpdate("update roller_properties "+
                    "set value = '"+version+"'"+
                    "where name = '"+DBVERSION_PROP+"'");
            
            log.debug("Updated database verstion to "+version);
    //#DatabaseInstaller.java:1285: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
    //#    method: void updateDatabaseVersion(Connection, int)
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        } catch(SQLException se) {
            throw new StartupException("Error setting database version.", se);
        } 
    }
    //#DatabaseInstaller.java:1289: end of method: void org.apache.roller.weblogger.business.startup.DatabaseInstaller.updateDatabaseVersion(Connection, int)
    
}
    //#DatabaseInstaller.java:: end of class: org.apache.roller.weblogger.business.startup.DatabaseInstaller
