From: shihyun.kim Date: Thu, 17 Jan 2013 11:55:50 +0000 (+0900) Subject: [Title]MSG : NullPointException X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ec363cdf7626eb9061e3e21f7ffe08d3b4b1c37d;p=sdk%2Finstaller%2Finstall-manager.git [Title]MSG : NullPointException [Desc.] * Variable is not checked null value. [Issue] [Title]MSG : NumberFormatException [Desc.] * Port number is not checked NumberFormatException. [Issue] --- diff --git a/InstallManager_java/src/org/tizen/installmanager/lib/exception/IMNetworkException.java b/InstallManager_java/src/org/tizen/installmanager/lib/exception/IMNetworkException.java index 715939a..61dca29 100644 --- a/InstallManager_java/src/org/tizen/installmanager/lib/exception/IMNetworkException.java +++ b/InstallManager_java/src/org/tizen/installmanager/lib/exception/IMNetworkException.java @@ -67,7 +67,7 @@ public class IMNetworkException extends Exception { if (errorCode != null) { return errorCode.getErrorMessage(); } else { - if (responseMessage.equalsIgnoreCase("OK")) { + if (responseMessage == null || responseMessage.equalsIgnoreCase("OK")) { return ErrorController.getErrorMessage(); } else { return responseMessage; diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/dialog/ProxySettingsDialog.java b/InstallManager_java/src/org/tizen/installmanager/ui/dialog/ProxySettingsDialog.java index 2034811..893d75a 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/dialog/ProxySettingsDialog.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/dialog/ProxySettingsDialog.java @@ -41,6 +41,8 @@ import org.eclipse.swt.widgets.Text; import org.tizen.installmanager.core.Config; import org.tizen.installmanager.core.Options; import org.tizen.installmanager.lib.Downloader; +import org.tizen.installmanager.lib.ErrorController.ErrorCode; +import org.tizen.installmanager.lib.Log; import org.tizen.installmanager.lib.NetworkProxy.ProxyType; import org.tizen.installmanager.ui.InstallManagerWindow; import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType; @@ -290,7 +292,7 @@ public class ProxySettingsDialog extends Dialog { this.proxyType = findProxyType(type); this.proxyHost = proxyHost; - if (port <= 0) { + if (port < 0) { this.proxyPort = ""; } else { try { @@ -343,8 +345,17 @@ public class ProxySettingsDialog extends Dialog { @Override protected void okPressed() { - if (proxyType == ProxyType.MANUAL) { - int port = Integer.parseInt(proxyPort); + if (proxyType == ProxyType.MANUAL) { + int port = 0; + try { + port = Integer.parseInt(proxyPort); + } catch (NumberFormatException e) { + Log.ExceptionLog(e); + + MessageBoxDlg.showDlg( + this.getShell(), "Proxy settings", "Port number is invalid.", DialogType.NOTIFY, false); + return; + } if (!Downloader.isAvailableURL(proxyHost, port)) { MessageBoxDlg.showDlg( diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java index 6d4619c..c3979a0 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java @@ -221,7 +221,11 @@ public class ViewController { * Check to need new installation. * @return If it needs new installation, return true. otherwise return false. */ - public boolean isNewInstallation() { + public boolean isNewInstallation() { +// if (packageManager == null) { +// return false; +// } + if (packageManager.isReInstallable()) { return true; } else {