[Packagemanager] Use ToLowerInvariant instead of ToLower (#4789)
authorjeremy-jang <35089715+jeremy-jang@users.noreply.github.com>
Fri, 2 Dec 2022 09:30:14 +0000 (18:30 +0900)
committerGitHub <noreply@github.com>
Fri, 2 Dec 2022 09:30:14 +0000 (18:30 +0900)
ToLower can cause unexpected error when system is busy.

Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs
src/Tizen.Applications.PackageManager/Tizen.Applications/PackageType.cs

index 5e24330..7305e44 100755 (executable)
@@ -683,7 +683,7 @@ namespace Tizen.Applications
             {
                 if (type != PackageType.UNKNOWN)
                 {
-                    err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower());
+                    err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLowerInvariant());
                     if (err != Interop.PackageManager.ErrorCode.None)
                     {
                         Log.Warn(LogTag, string.Format("Failed to install packages. Error in setting request package type. err = {0}", err));
@@ -893,7 +893,7 @@ namespace Tizen.Applications
 
             try
             {
-                err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower());
+                err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLowerInvariant());
                 if (err != Interop.PackageManager.ErrorCode.None)
                 {
                     Log.Warn(LogTag, string.Format("Failed to uninstall package {0}. Error in setting request package type. err = {1}", packageId, err));
@@ -1024,7 +1024,7 @@ namespace Tizen.Applications
             try
             {
                 bool result = true;
-                err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower());
+                err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLowerInvariant());
                 if (err != Interop.PackageManager.ErrorCode.None)
                 {
                     Log.Warn(LogTag, string.Format("Failed to move package. Error in setting request package type. err = {0}", err));
index c7ef31d..b70ff3f 100644 (file)
@@ -52,7 +52,7 @@ namespace Tizen.Applications
                 throw PackageManagerErrorFactory.GetException(Interop.PackageManager.ErrorCode.InvalidParameter, "type can't be null or empty");
             }
 
-            string lowerType = type.ToLower();
+            string lowerType = type.ToLowerInvariant();
             if (lowerType == "tpk")
             {
                 return PackageType.TPK;