Connection con = null;  try { con = DbConnectionManager.getConnection(); DatabaseUtil.upgradeDatabase(con); } catch (Exception e) { Log.error(e); } finally { DbConnectionManager.closeConnection(con); }
    public void init() {        Log.info("Initializing Asterisk-IM Plugin");        try {            initAsteriskManager();        }        catch (Throwable e) {            // Make sure we catch all exceptions show we can Log anything that might be            // going on            Log.error(e.getMessage(), e);            Log.error("Asterisk-IM not Initializing because of errors");            return;        }        // only register the component if we are enabled        if (JiveGlobals.getBooleanProperty(Properties.ENABLED, false)) {            try {                Log.info("Registering phone plugin as a component");                ComponentManagerFactory.getComponentManager().addComponent(NAME, this);            }            catch (ComponentException e) {                Log.error(e.getMessage(), e);                // Do nothing. Should never happen.                ComponentManagerFactory.getComponentManager().getLog().error(e);            }        }        // Register a packet interceptor for handling on on phone presence changes        InterceptorManager.getInstance().addInterceptor(onPhoneInterceptor);        // Register OnPhonePacketInterceptor as a session event listener        SessionEventDispatcher.addListener(onPhoneInterceptor);    }