Repository: reef Updated Branches: refs/heads/master ffaf90655 -> 3483e3d25
[REEF-1899] Remove use of `Exceptions` in O.A.R.Client This removes all use of the `Exceptions` class in O.A.R.Client JIRA: [REEF-1899](https://issues.apache.org/jira/browse/REEF-1899) Pull Request: This closes #1387 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/3483e3d2 Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/3483e3d2 Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/3483e3d2 Branch: refs/heads/master Commit: 3483e3d25a108934f118961dcf335410090b2d4b Parents: ffaf906 Author: Markus Weimer <[email protected]> Authored: Thu Oct 12 11:48:14 2017 +0200 Committer: Doug Service <[email protected]> Committed: Fri Oct 13 20:57:17 2017 +0000 ---------------------------------------------------------------------- .../Common/JavaClientLauncher.cs | 17 ++++++----------- .../Common/ResourceArchiveFileGenerator.cs | 5 ++--- .../YARN/LegacyJobResourceUploader.cs | 9 ++------- .../RESTClient/FileSystemJobResourceUploader.cs | 5 +---- .../YARN/YarnCommandLineEnvironment.cs | 20 +++++--------------- 5 files changed, 16 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/3483e3d2/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs index 2f7e62f..bc90c44 100644 --- a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs +++ b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs @@ -24,7 +24,6 @@ using System.Linq; using System.Threading.Tasks; using Org.Apache.REEF.Client.API.Exceptions; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Utilities.Diagnostics; using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Client.Common @@ -136,14 +135,12 @@ namespace Org.Apache.REEF.Client.Common if (string.IsNullOrWhiteSpace(javaHomePath)) { // TODO: Attempt to find java via the registry. - Exceptions.Throw( - new JavaNotFoundException("JAVA_HOME isn't set. Please install Java and make set JAVA_HOME"), Logger); + throw new JavaNotFoundException("JAVA_HOME isn't set. Please install Java and make set JAVA_HOME"); } if (!Directory.Exists(javaHomePath)) { - Exceptions.Throw( - new JavaNotFoundException("JAVA_HOME references a folder that doesn't exist.", javaHomePath), Logger); + throw new JavaNotFoundException("JAVA_HOME references a folder that doesn't exist.", javaHomePath); } var javaBinPath = Path.Combine(javaHomePath, "bin"); @@ -157,10 +154,8 @@ namespace Org.Apache.REEF.Client.Common var javaPath = Path.Combine(javaBinPath, "java.exe"); if (!File.Exists(javaPath)) { - Exceptions.Throw( - new JavaNotFoundException( - "Could not find java.exe on this machine. Is Java installed and JAVA_HOME set?", javaPath), - Logger); + throw new JavaNotFoundException( + "Could not find java.exe on this machine. Is Java installed and JAVA_HOME set?", javaPath); } return javaPath; } @@ -179,8 +174,8 @@ namespace Org.Apache.REEF.Client.Common if (files.Count == 0) { - Exceptions.Throw(new ClasspathException( - "Unable to assemble classpath. Make sure the REEF JAR is in the current working directory."), Logger); + throw new ClasspathException( + "Unable to assemble classpath. Make sure the REEF JAR is in the current working directory."); } var classpathEntries = new List<string>(_additionalClasspathEntries).Concat(files); http://git-wip-us.apache.org/repos/asf/reef/blob/3483e3d2/lang/cs/Org.Apache.REEF.Client/Common/ResourceArchiveFileGenerator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Common/ResourceArchiveFileGenerator.cs b/lang/cs/Org.Apache.REEF.Client/Common/ResourceArchiveFileGenerator.cs index 97a47dc..2ca4d3c 100644 --- a/lang/cs/Org.Apache.REEF.Client/Common/ResourceArchiveFileGenerator.cs +++ b/lang/cs/Org.Apache.REEF.Client/Common/ResourceArchiveFileGenerator.cs @@ -20,7 +20,6 @@ using System.IO; using System.IO.Compression; using Org.Apache.REEF.Common.Files; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Utilities.Diagnostics; using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Client.Common @@ -45,12 +44,12 @@ namespace Org.Apache.REEF.Client.Common string reefFolder = Path.Combine(folderPath, _reefFileNames.GetReefFolderName()); if (!Directory.Exists(reefFolder)) { - Exceptions.Throw(new DirectoryNotFoundException("Cannot find directory " + reefFolder), Log); + throw new DirectoryNotFoundException("Cannot find directory " + reefFolder); } if (File.Exists(archivePath)) { - Exceptions.Throw(new InvalidOperationException("Archive file already exists " + archivePath), Log); + throw new InvalidOperationException("Archive file already exists " + archivePath); } ZipFile.CreateFromDirectory(reefFolder, archivePath); http://git-wip-us.apache.org/repos/asf/reef/blob/3483e3d2/lang/cs/Org.Apache.REEF.Client/YARN/LegacyJobResourceUploader.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/LegacyJobResourceUploader.cs b/lang/cs/Org.Apache.REEF.Client/YARN/LegacyJobResourceUploader.cs index 03deae5..97b2087 100644 --- a/lang/cs/Org.Apache.REEF.Client/YARN/LegacyJobResourceUploader.cs +++ b/lang/cs/Org.Apache.REEF.Client/YARN/LegacyJobResourceUploader.cs @@ -22,7 +22,6 @@ using Org.Apache.REEF.Client.Common; using Org.Apache.REEF.Client.YARN.RestClient.DataModel; using Org.Apache.REEF.Common.Files; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Utilities.Diagnostics; using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Client.Yarn @@ -83,9 +82,7 @@ namespace Org.Apache.REEF.Client.Yarn { if (!_file.Exists(filePath)) { - Exceptions.Throw( - new FileNotFoundException("Could not find resource file " + filePath), - Log); + throw new FileNotFoundException("Could not find resource file " + filePath); } var detailsOutputPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N")); @@ -116,9 +113,7 @@ namespace Org.Apache.REEF.Client.Yarn { if (!_file.Exists(resourceDetailsOutputPath)) { - Exceptions.Throw( - new FileNotFoundException("Could not find resource details file " + resourceDetailsOutputPath), - Log); + throw new FileNotFoundException("Could not find resource details file " + resourceDetailsOutputPath); } // Single line file, easier to deal with sync read http://git-wip-us.apache.org/repos/asf/reef/blob/3483e3d2/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/FileSystemJobResourceUploader.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/FileSystemJobResourceUploader.cs b/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/FileSystemJobResourceUploader.cs index 9647994..0d45d79 100644 --- a/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/FileSystemJobResourceUploader.cs +++ b/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/FileSystemJobResourceUploader.cs @@ -24,7 +24,6 @@ using Org.Apache.REEF.Client.YARN.RestClient.DataModel; using Org.Apache.REEF.Common.Files; using Org.Apache.REEF.IO.FileSystem; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Utilities.Diagnostics; using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Client.YARN.RestClient @@ -85,9 +84,7 @@ namespace Org.Apache.REEF.Client.YARN.RestClient { if (!_file.Exists(filePath)) { - Exceptions.Throw( - new FileNotFoundException("Could not find resource file " + filePath), - Log); + throw new FileNotFoundException("Could not find resource file " + filePath); } var destinationPath = driverUploadPath + Path.GetFileName(filePath); http://git-wip-us.apache.org/repos/asf/reef/blob/3483e3d2/lang/cs/Org.Apache.REEF.Client/YARN/YarnCommandLineEnvironment.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/YarnCommandLineEnvironment.cs b/lang/cs/Org.Apache.REEF.Client/YARN/YarnCommandLineEnvironment.cs index 39dd789..2e350e0 100644 --- a/lang/cs/Org.Apache.REEF.Client/YARN/YarnCommandLineEnvironment.cs +++ b/lang/cs/Org.Apache.REEF.Client/YARN/YarnCommandLineEnvironment.cs @@ -22,7 +22,6 @@ using System.IO; using System.Linq; using System.Text; using Org.Apache.REEF.Tang.Annotations; -using Org.Apache.REEF.Utilities.Diagnostics; using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Client.Yarn @@ -57,18 +56,14 @@ namespace Org.Apache.REEF.Client.Yarn var path = Environment.GetEnvironmentVariable("HADOOP_HOME"); if (string.IsNullOrWhiteSpace(path)) { - var ex = new FileNotFoundException("HADOOP_HOME isn't set."); - Exceptions.Throw(ex, Logger); - throw ex; + throw new FileNotFoundException("HADOOP_HOME isn't set."); } var fullPath = Path.GetFullPath(path); if (!Directory.Exists(fullPath)) { - var ex = new FileNotFoundException("HADOOP_HOME points to [" + fullPath + "] which doesn't exist."); - Exceptions.Throw(ex, Logger); - throw ex; + throw new FileNotFoundException("HADOOP_HOME points to [" + fullPath + "] which doesn't exist."); } return fullPath; } @@ -82,9 +77,7 @@ namespace Org.Apache.REEF.Client.Yarn var result = Path.Combine(GetHadoopHomePath(), "bin", "yarn.cmd"); if (!File.Exists(result)) { - var ex = new FileNotFoundException("Couldn't find yarn.cmd", result); - Exceptions.Throw(ex, Logger); - throw ex; + throw new FileNotFoundException("Couldn't find yarn.cmd", result); } return result; } @@ -120,15 +113,12 @@ namespace Org.Apache.REEF.Client.Yarn if (process.ExitCode != 0) { - var ex = new Exception("YARN process exited with non-zero error code."); - Exceptions.Throw(ex, Logger); + throw new Exception("YARN process exited with non-zero error code."); } } else { - var ex = new Exception("YARN process didn't start."); - Exceptions.Throw(ex, Logger); - throw ex; + throw new Exception("YARN process didn't start."); } return output.ToString(); }
