From 04c19f969d8e5c0d81d33c5982c72715ba902ee8 Mon Sep 17 00:00:00 2001 From: Inhong Date: Mon, 9 May 2022 10:41:39 +0900 Subject: [PATCH] Modified to appropriate exception type (#4170) --- .../Tizen.Uix.InputMethod/EditorWindow.cs | 8 +- .../Tizen.Uix.InputMethod/InputMethodEditor.cs | 188 ++++++--------------- .../InputMethodExceptionFactory.cs | 4 +- 3 files changed, 61 insertions(+), 139 deletions(-) diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs index 25aaf63..f36e921 100755 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs @@ -66,11 +66,9 @@ namespace Tizen.Uix.InputMethod /// The height in the portrait mode. /// The width in the landscape mode. /// The height in the landscape mode. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to an invalid parameter. + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void SetSize(int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight) { diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs index dad1147..7ca461d 100644 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs @@ -1633,11 +1633,8 @@ namespace Tizen.Uix.InputMethod /// This is called when the IME application is hidden. /// It provides the context ID. /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) Operation failed. - /// + /// This exception can be due to permission denied. + /// This exception can be due to operation failed. /// 4 public static void Run(Action create, Action terminate, Action show, Action hide) { @@ -1673,11 +1670,8 @@ namespace Tizen.Uix.InputMethod /// The key code to be sent. /// The modifier key mask. /// The flag to send the key event directly to the edit field. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void SendKeyEvent(KeyCode keyCode, KeyMask keyMask, bool forwardKey = false) { @@ -1696,11 +1690,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// The string to be committed. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void CommitString(string str) { @@ -1718,11 +1709,8 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void ShowPreEditString() { @@ -1740,11 +1728,8 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void HidePreEditString() { @@ -1767,12 +1752,8 @@ namespace Tizen.Uix.InputMethod /// The list which has ime_preedit_attribute lists, strings can be composed of multiple string attributes: underline, highlight color, and reversal color. /// The attrs list can be empty if no attributes to set. /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void UpdatePreEditString(string str, IEnumerable attrs) { @@ -1806,10 +1787,11 @@ namespace Tizen.Uix.InputMethod /// /// The maximum length of the string to be retrieved before the cursor, -1 means unlimited. /// The maximum length of the string to be retrieved after the cursor, -1 means unlimited. + /// This exception can be due to permission denied. /// /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. + /// 1) The IME main loop has not started yet. + /// 2) The necessary event is not set. /// /// /// The requested surrounding text can be received using the SurroundingTextUpdated event, only if it is set. @@ -1833,12 +1815,9 @@ namespace Tizen.Uix.InputMethod /// /// The offset value from the cursor position. /// The length of the text to delete. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// + /// This exception can be due to an invalid parameter. + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void DeleteSurroundingText(int offset, int len) { @@ -1860,13 +1839,9 @@ namespace Tizen.Uix.InputMethod /// The maximum length of the string to be retrieved after the cursor, -1 means unlimited. /// The surrounding text. /// The cursor position. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// 4) Failed to obtain text due to out of memory. - /// + /// This exception can be due to out of memory. + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void GetSurroundingText(int maxLenBefore, int maxLenAfter, out string text, out int cursorPosition) { @@ -1888,12 +1863,9 @@ namespace Tizen.Uix.InputMethod /// /// The start cursor position in text (in characters not bytes). /// The end cursor position in text (in characters not bytes). - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// + /// This exception can be due to an invalid parameter. + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 4 public static void SetSelection(int start, int end) { @@ -1912,11 +1884,11 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// The input panel main window object on success, otherwise null. + /// This exception can be due to permission denied. /// /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Operation failed. + /// 1) The IME main loop has not started yet. + /// 2) Operation failed. /// /// 4 public static EditorWindow GetMainWindow() @@ -1938,11 +1910,8 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 5 public static void RequestHide() { @@ -1960,11 +1929,8 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) Operation failed. - /// + /// This exception can be due to permission denied. + /// This exception can be due to operation failed. /// 4 [EditorBrowsable(EditorBrowsableState.Never)] public static void Create() @@ -1992,11 +1958,7 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) Operation failed. - /// + /// This exception can be due to permission denied. /// 4 [EditorBrowsable(EditorBrowsableState.Never)] public static void Destroy() @@ -2017,11 +1979,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// true to set the floating mode to on and false to set it to off. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 5 public static void SetFloatingMode(bool floatingMode) { @@ -2042,11 +2001,8 @@ namespace Tizen.Uix.InputMethod /// /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect. /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 5 public static void SetFloatingDragStart() { @@ -2067,11 +2023,8 @@ namespace Tizen.Uix.InputMethod /// /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect. /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 5 public static void SetFloatingDragEnd() { @@ -2092,11 +2045,8 @@ namespace Tizen.Uix.InputMethod /// /// LanguageRequestedCallback is raised after this API is called when the App requests changed language information. /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static void SendLanguageUpdated() { @@ -2115,11 +2065,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// true if shift button is clicked, otherwise false. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static void SendShiftModeUpdated(bool enable) { @@ -2137,11 +2084,8 @@ namespace Tizen.Uix.InputMethod /// /// http://tizen.org/privilege/ime /// - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static void SendCustomGeometryUpdated() { @@ -2160,11 +2104,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// The selected text. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static string GetSelectedText() { @@ -2273,12 +2214,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// The UTF-8 string to be sent. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static void SendPrivateCommand(string command) { @@ -2299,12 +2236,8 @@ namespace Tizen.Uix.InputMethod /// The content URI to be sent. /// The content description. /// The MIME type received from the MimeTypeSetRequest - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// 3) Invalid parameter. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 6 public static void CommitContent(string content, string description, string mimeType) { @@ -2330,12 +2263,9 @@ namespace Tizen.Uix.InputMethod /// The height in the portrait mode. /// The width in the landscape mode. /// The height in the landscape mode. + /// This exception can be due to an invalid parameter. /// This exception can be due to permission denied. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// The IME main loop has not started yet. /// 9 public static void SetSize(IntPtr window, int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight) { @@ -2379,11 +2309,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// The cursor position in the preedit string. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 10 public static void UpdatePreeditCursor(uint position) { @@ -2402,11 +2329,8 @@ namespace Tizen.Uix.InputMethod /// http://tizen.org/privilege/ime /// /// true to show candidate strings, false otherwise. - /// - /// This can occur due to the following reasons: - /// 1) The application does not have the privilege to call this function. - /// 2) The IME main loop has not started yet. - /// + /// This exception can be due to permission denied. + /// The IME main loop has not started yet. /// 10 public static void SetCandidateVisibilityState(bool visible) { diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs index f978ae7..5a0998e 100755 --- a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs @@ -30,14 +30,14 @@ namespace Tizen.Uix.InputMethod { case ErrorCode.OutOfMemory: { - exp = new InvalidOperationException("Out Of Memory"); + exp = new OutOfMemoryException("Out Of Memory"); break; } case ErrorCode.InvalidParameter: { - exp = new InvalidOperationException("Invalid Parameters Provided"); + exp = new ArgumentException("Invalid Parameters Provided"); break; } -- 2.7.4