summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanish.r <manish.r@samsung.com>2016-07-08 11:44:17 +0530
committermanish.r <manish.r@samsung.com>2016-07-08 15:22:42 +0530
commitbd0ee8b799c59ae3cbf5ce17157932b9ac032ec2 (patch)
treecb0f55c9aaeeaf84a1ba5045c19cfac537e35b74
parentb6e650d4a767624b8a8ca4a04693a577a64cbd33 (diff)
downloadpush-bd0ee8b799c59ae3cbf5ce17157932b9ac032ec2.tar.gz
push-bd0ee8b799c59ae3cbf5ce17157932b9ac032ec2.tar.bz2
push-bd0ee8b799c59ae3cbf5ce17157932b9ac032ec2.zip
Adding Null Check and Error Enum Updation
Change-Id: I400b9aa12372531bb7f9b05e1e2b566929f65881 Signed-off-by: manish.r <manish.r@samsung.com>
-rwxr-xr-xTizen.Messaging.Push/Interop/Interop.Push.cs16
-rwxr-xr-xTizen.Messaging.Push/Tizen.Messaging.Push/Push.cs2
-rwxr-xr-xTizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs2
-rwxr-xr-xTizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs46
4 files changed, 35 insertions, 31 deletions
diff --git a/Tizen.Messaging.Push/Interop/Interop.Push.cs b/Tizen.Messaging.Push/Interop/Interop.Push.cs
index 637f237..e568909 100755
--- a/Tizen.Messaging.Push/Interop/Interop.Push.cs
+++ b/Tizen.Messaging.Push/Interop/Interop.Push.cs
@@ -17,14 +17,14 @@ internal static partial class Interop
internal enum ServiceError
{
- None,
- OutOfMemory,
- InvalidParameter,
- NotConnected,
- NoData,
- OpearationFailed,
- PermissionDenied,
- NotSupported
+ None = Tizen.Internals.Errors.ErrorCode.None,
+ OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
+ InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
+ NotConnected = Tizen.Internals.Errors.ErrorCode.EndpointNotConnected,
+ NoData = Tizen.Internals.Errors.ErrorCode.NoData,
+ OpearationFailed = Tizen.Internals.Errors.ErrorCode.Unknown,
+ PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
+ NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported
};
internal enum State
diff --git a/Tizen.Messaging.Push/Tizen.Messaging.Push/Push.cs b/Tizen.Messaging.Push/Tizen.Messaging.Push/Push.cs
index 4601c96..88bc0f4 100755
--- a/Tizen.Messaging.Push/Tizen.Messaging.Push/Push.cs
+++ b/Tizen.Messaging.Push/Tizen.Messaging.Push/Push.cs
@@ -112,7 +112,7 @@ namespace Tizen.Messaging.Push
public static void PushServiceDisconnect()
{
PushImpl.Instance.PushServiceDisconnect();
- PushImpl.Reset();
+ //PushImpl.Reset();
}
diff --git a/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs b/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs
index 4697876..37e06df 100755
--- a/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs
+++ b/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs
@@ -21,7 +21,7 @@ namespace Tizen.Messaging.Push
case Interop.Push.ServiceError.InvalidParameter:
{
Tizen.Log.Error(Interop.Push.LogTag, "Interop.Push.ServiceError.InvalidParameter");
- exp = new ArgumentException("The Parameter Passed was Invalid");
+ exp = new InvalidOperationException("The Parameter Passed was Invalid or Invalid Operation Intented");
break;
}
case Interop.Push.ServiceError.NotConnected:
diff --git a/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs b/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs
index ed2f9f9..3db58f1 100755
--- a/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs
+++ b/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs
@@ -38,6 +38,10 @@ namespace Tizen.Messaging.Push
{
Interop.Push.VoidStateChangedCallback stateDelegate = (int state, string err, IntPtr userData) =>
{
+ if (err == null)
+ {
+ err = "";
+ }
PushConnectionStateEventArgs args = new PushConnectionStateEventArgs((PushConnectionStateEventArgs.PushState)state, err);
Push.StateChange(args);
};
@@ -51,50 +55,50 @@ namespace Tizen.Messaging.Push
{
ob.AppData = data;
}
- else
- {
- ob.AppData = "";
- }
+ else
+ {
+ ob.AppData = "";
+ }
string message;
result = Interop.Push.GetNotificationMessage(notification, out message);
if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(message)))
{
ob.Message = message;
}
- else
- {
- ob.Message = "";
- }
+ else
+ {
+ ob.Message = "";
+ }
string sender;
result = Interop.Push.GetNotificationSender(notification, out sender);
if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sender)))
{
ob.Sender = sender;
}
- else
- {
- ob.Sender = "";
- }
+ else
+ {
+ ob.Sender = "";
+ }
string sessioninfo;
result = Interop.Push.GetNotificationSessionInfo(notification, out sessioninfo);
if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sessioninfo)))
{
ob.SessionInfo = sessioninfo;
}
- else
- {
- ob.SessionInfo = "";
- }
+ else
+ {
+ ob.SessionInfo = "";
+ }
string requestid;
result = Interop.Push.GetNotificationRequestId(notification, out requestid);
if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(requestid)))
{
ob.RequestId = requestid;
}
- else
- {
- ob.RequestId = "";
- }
+ else
+ {
+ ob.RequestId = "";
+ }
int time;
result = Interop.Push.GetNotificationTime(notification, out time);
DateTime utc;
@@ -122,7 +126,7 @@ namespace Tizen.Messaging.Push
Interop.Push.ServiceError connectResult = Interop.Push.ServiceConnect(pushAppId, stateDelegate, notifyDelegate, IntPtr.Zero, out _connection);
if (connectResult != Interop.Push.ServiceError.None)
{
- Log.Error(Interop.Push.LogTag, "Connect failed with "+ connectResult);
+ Log.Error(Interop.Push.LogTag, "Connect failed with " + connectResult);
throw PushExceptionFactory.CreateResponseException(connectResult);
}
}