public void run() { try { inputStream = this.download(); SettingRecordStore settingRecordStore = new SettingRecordStore(); String clientVersion = settingRecordStore.get(SettingRecordStore.CLIENT_VERSION); LogMan.log(LogMan.INFO, "Network," + CLASS_TAG, "Client Version: " + clientVersion); if (clientVersion == "") { LogMan.log(LogMan.INFO, "Network," + CLASS_TAG, "Setting Client Version to: " + "2.8"); settingRecordStore.put(SettingRecordStore.CLIENT_VERSION, "2.8"); settingRecordStore.save(); } serverVersion = getServerVersion(); boolean isNewVersionAvailable = orgUnit.checkNewVersion(serverVersion); if (isNewVersionAvailable == true) { ConnectionManager.getDhisMIDlet().getUpdateNewVersionView().showView(); } else { handleLogIn(inputStream); } } catch (Exception e) { e.printStackTrace(); LogMan.log("Network,Authentication," + CLASS_TAG, e); LoginView loginView = ConnectionManager.getDhisMIDlet().getLoginView(); loginView.resetTextField(); loginView.switchDisplayable( Alerts.getErrorAlert(Text.ERROR(), e.getMessage()), loginView.getLoginForm()); } finally { try { if (inputStream != null) inputStream.close(); } catch (IOException e) { e.printStackTrace(); } System.gc(); } }