Repository: reef
Updated Branches:
  refs/heads/master fba47fa2c -> 3cc39310b


[REEF-1542] Fix CoreCLR incompatibilities related to use of SystemException

This change replaces all uses of SystemException with custom 
ReefRuntimeException.

JIRA:
  [REEF-1542](https://issues.apache.org/jira/browse/REEF-1542)

Pull request:
  This closes #1112


Project: http://git-wip-us.apache.org/repos/asf/reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/3cc39310
Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/3cc39310
Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/3cc39310

Branch: refs/heads/master
Commit: 3cc39310b2f899cf5b5be4f97cf1cd70d0f94f30
Parents: fba47fa
Author: inchiosa <[email protected]>
Authored: Wed Aug 31 20:24:08 2016 -0700
Committer: Mariia Mykhailova <[email protected]>
Committed: Thu Sep 8 15:02:57 2016 -0700

----------------------------------------------------------------------
 .../Runtime/Evaluator/Context/ContextRuntime.cs |  2 +-
 .../Runtime/Evaluator/EvaluatorRuntime.cs       |  5 +-
 .../Group/Task/Impl/GroupCommClient.cs          |  3 +-
 .../Group/Task/Impl/OperatorTopology.cs         |  2 +-
 .../Exceptions/BindException.cs                 |  2 +-
 .../Exceptions/ClassHierarchyException.cs       |  2 +-
 .../Exceptions/ReefRuntimeException.cs          | 52 ++++++++++++++++++++
 .../Org.Apache.REEF.Tang.csproj                 |  1 +
 .../Functional/IMRU/TestTaskExceptions.cs       |  5 +-
 .../Time/Runtime/RuntimeClock.cs                |  3 +-
 10 files changed, 66 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
index e05335a..21839f8 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Context/ContextRuntime.cs
@@ -325,7 +325,7 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator.Context
                 }
                 catch (Exception e)
                 {
-                    throw new SystemException("System error in starting 
Task.", e);
+                    throw new ReefRuntimeException("System error in starting 
Task.", e);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs 
b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
index 077ba31..0144573 100644
--- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
+++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/EvaluatorRuntime.cs
@@ -22,6 +22,7 @@ using Org.Apache.REEF.Common.Exceptions;
 using Org.Apache.REEF.Common.Protobuf.ReefProtocol;
 using Org.Apache.REEF.Common.Runtime.Evaluator.Context;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Utilities;
 using Org.Apache.REEF.Utilities.Diagnostics;
 using Org.Apache.REEF.Utilities.Logging;
@@ -215,11 +216,11 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator
                     const string msg = "RuntimeStopHandler invoked in state 
RUNNING.";
                     if (runtimeStop.Exception != null)
                     {
-                        OnException(new SystemException(msg, 
runtimeStop.Exception));
+                        OnException(new ReefRuntimeException(msg, 
runtimeStop.Exception));
                     }
                     else
                     {
-                        OnException(new SystemException(msg));
+                        OnException(new ReefRuntimeException(msg));
                     }
                 }
                 else

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs 
b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
index b4f8374..c88e59c 100644
--- a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
+++ b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/GroupCommClient.cs
@@ -17,7 +17,6 @@
 
 using System;
 using System.Collections.Generic;
-using System.Globalization;
 using Org.Apache.REEF.Common.Tasks;
 using Org.Apache.REEF.Network.Group.Config;
 using Org.Apache.REEF.Network.Group.Driver.Impl;
@@ -80,7 +79,7 @@ namespace Org.Apache.REEF.Network.Group.Task.Impl
                     group.WaitingForRegistration();
                 }
             }
-            catch (SystemException e)
+            catch (ReefRuntimeException e)
             {
                 networkService.Unregister();
                 networkService.Dispose();

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs 
b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
index 80b4dd3..202cfc4 100644
--- a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
+++ b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs
@@ -392,7 +392,7 @@ namespace Org.Apache.REEF.Network.Group.Task.Impl
 
                 var leftOver = string.Join(",", identifiers.Where(e => 
!foundList.Contains(e)));
                 Logger.Log(Level.Error, "For node {0}, cannot find registered 
parent/children: {1}.", _selfId, leftOver);
-                Exceptions.Throw(new SystemException("Failed to initialize 
operator topology for node: " + _selfId), Logger);
+                Exceptions.Throw(new ReefRuntimeException("Failed to 
initialize operator topology for node: " + _selfId), Logger);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs 
b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
index ee4135f..018fb8f 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs
@@ -19,7 +19,7 @@ using System;
 
 namespace Org.Apache.REEF.Tang.Exceptions
 {
-    public class BindException : SystemException
+    public class BindException : ReefRuntimeException
     {
         internal BindException(string message)
             : base(message)

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs 
b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
index b6ceb5e..9253949 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs
@@ -19,7 +19,7 @@ using System;
 
 namespace Org.Apache.REEF.Tang.Exceptions
 {
-    public sealed class ClassHierarchyException : SystemException
+    public sealed class ClassHierarchyException : ReefRuntimeException
     {
         internal ClassHierarchyException(string msg) : base(msg)
         {           

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs 
b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs
new file mode 100644
index 0000000..abb7c14
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ReefRuntimeException.cs
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Org.Apache.REEF.Tang.Exceptions
+{
+    /// <summary>
+    /// A serializable exception that represents a general Reef error.
+    /// </summary>
+    [Serializable]
+    public class ReefRuntimeException : Exception
+    {
+        /// <summary>
+        /// Constructor. A serializable exception object that represents a 
general Reef error.
+        /// </summary>
+        public ReefRuntimeException(string message)
+            : base(message)
+        {
+        }
+
+        /// <summary>
+        /// Constructor. A serializable exception object that represents a 
general Reef error and wraps an inner exception
+        /// </summary>
+        /// <param name="message"></param>
+        /// <param name="innerException"></param>
+        public ReefRuntimeException(string message, Exception innerException)
+            : base(message, innerException)
+        {
+        }
+
+        public ReefRuntimeException(SerializationInfo info, StreamingContext 
context)
+            : base(info, context)
+        {
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj 
b/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
index 922e059..f0145ba 100644
--- a/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
+++ b/lang/cs/Org.Apache.REEF.Tang/Org.Apache.REEF.Tang.csproj
@@ -57,6 +57,7 @@ under the License.
     <Compile Include="Exceptions\InjectionException.cs" />
     <Compile Include="Exceptions\NameResolutionException.cs" />
     <Compile Include="Exceptions\ParseException.cs" />
+    <Compile Include="Exceptions\ReefRuntimeException.cs" />
     <Compile Include="Exceptions\TangApplicationException.cs" />
     <Compile 
Include="Formats\AvroConfigurationDataContract\AvroConfiguration.cs" />
     <Compile 
Include="Formats\AvroConfigurationDataContract\ConfigurationEntry.cs" />

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
----------------------------------------------------------------------
diff --git 
a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs 
b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
index 08816cb..0156bd0 100644
--- a/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
+++ b/lang/cs/Org.Apache.REEF.Tests/Functional/IMRU/TestTaskExceptions.cs
@@ -24,6 +24,7 @@ using Org.Apache.REEF.Driver.Task;
 using Org.Apache.REEF.IMRU.OnREEF.Driver;
 using Org.Apache.REEF.IMRU.OnREEF.IMRUTasks;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Tang.Formats;
 using Org.Apache.REEF.Tang.Implementations.Configuration;
 using Org.Apache.REEF.Tang.Implementations.Tang;
@@ -185,7 +186,7 @@ namespace Org.Apache.REEF.Tests.Functional.IMRU
                     }
 
                     Assert.Equal(InnerExceptionMessage, 
value.AsError().InnerException.Message);
-                    Assert.True(value.AsError().InnerException is 
System.SystemException);
+                    Assert.True(value.AsError().InnerException is 
ReefRuntimeException);
                 }
                 Logger.Log(Level.Info, ValidFailedTaskMessage);
                 value.GetActiveContext().Value.Dispose();
@@ -240,7 +241,7 @@ namespace Org.Apache.REEF.Tests.Functional.IMRU
                     case TaskManager.TaskGroupCommunicationError:
                         throw new 
IMRUTaskGroupCommunicationException(_taskExceptionMessage);
                     default:
-                        throw new 
IMRUTaskSystemException(_taskExceptionMessage, new 
SystemException(InnerExceptionMessage));
+                        throw new 
IMRUTaskSystemException(_taskExceptionMessage, new 
ReefRuntimeException(InnerExceptionMessage));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/reef/blob/3cc39310/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs 
b/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
index dc5fd0a..5340b9f 100644
--- a/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
+++ b/lang/cs/Org.Apache.REEF.Wake/Time/Runtime/RuntimeClock.cs
@@ -20,6 +20,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
 using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
 using Org.Apache.REEF.Tang.Implementations.InjectionPlan;
 using Org.Apache.REEF.Utilities;
 using Org.Apache.REEF.Utilities.Collections;
@@ -168,7 +169,7 @@ namespace Org.Apache.REEF.Wake.Time.Runtime
             }
             catch (Exception e)
             {
-                runtimeException = Optional<Exception>.Of(new 
SystemException("Caught Exception in clock, failing the Evaluator.", e));
+                runtimeException = Optional<Exception>.Of(new 
ReefRuntimeException("Caught Exception in clock, failing the Evaluator.", e));
             }
 
             var runtimeStop = runtimeException.IsPresent()

Reply via email to