You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/10/12 02:58:06 UTC

[18/50] git commit: minor cleanup of utility classes, mostly formatting

minor cleanup of utility classes, mostly formatting


Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/c09205f6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/c09205f6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/c09205f6

Branch: refs/heads/feature/SLIDER-481_allow_dedicated_handling_of_exports
Commit: c09205f66725438854456379664fae8a0fa298ab
Parents: 7f7bb5b
Author: Steve Loughran <st...@apache.org>
Authored: Tue Oct 7 15:41:14 2014 -0700
Committer: Steve Loughran <st...@apache.org>
Committed: Tue Oct 7 15:41:44 2014 -0700

----------------------------------------------------------------------
 .../slider/common/tools/CoreFileSystem.java     | 31 +++++++-------------
 .../apache/slider/common/tools/SliderUtils.java | 14 ++++-----
 2 files changed, 17 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c09205f6/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java b/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
index b6e6ecf..2ea371b 100644
--- a/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
+++ b/slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
@@ -158,11 +158,10 @@ public class CoreFileSystem {
    * @throws java.io.IOException                      trouble
    * @throws SliderException slider-specific exceptions
    */
-  public Path createClusterDirectories(String clustername, Configuration conf) throws
-                                                                               IOException,
-      SliderException {
-    
-    
+  public Path createClusterDirectories(String clustername, Configuration conf)
+      throws IOException, SliderException {
+
+
     Path clusterDirectory = buildClusterDirPath(clustername);
     InstancePaths instancePaths = new InstancePaths(clusterDirectory);
     createClusterDirectories(instancePaths);
@@ -204,8 +203,8 @@ public class CoreFileSystem {
    *
    * @param dir          directory
    * @param clusterPerms cluster permissions
-   * @throws IOException                                 IO problem
-   * @throws org.apache.slider.core.exceptions.BadClusterStateException any cluster state problem
+   * @throws IOException  IO problem
+   * @throws BadClusterStateException any cluster state problem
    */
   public void createWithPermissions(Path dir, FsPermission clusterPerms) throws
           IOException,
@@ -572,7 +571,7 @@ public class CoreFileSystem {
    *
    * @param clustername name of the cluster
    * @return the path to the spec.
-   * @throws IOException                      IO problems
+   * @throws IOException IO problems
    * @throws SliderException if the path isn't there
    */
   public Path locateInstanceDefinition(String clustername) throws IOException,
@@ -591,23 +590,15 @@ public class CoreFileSystem {
    * @throws IOException IO problems
    * @throws SliderException if the cluster specification is not present
    */
-  public void verifyClusterSpecExists(String clustername,
-                                             Path clusterSpecPath) throws
-                                                                   IOException,
+  public void verifyClusterSpecExists(String clustername, Path clusterSpecPath)
+      throws IOException,
       SliderException {
     if (!fileSystem.isFile(clusterSpecPath)) {
       log.debug("Missing specification file {}", clusterSpecPath);
-      throw UnknownApplicationInstanceException.unknownInstance(clustername
-                                                                +
-                                                                "\n (definition not found at "
-                                                                +
-                                                                clusterSpecPath);
+      throw UnknownApplicationInstanceException.unknownInstance(
+          clustername + "\n (definition not found at " + clusterSpecPath);
     }
   }
-  
-  public Path fileToPath(File file) {
-    return new Path(file.getAbsoluteFile().toURI());
 
-  }
   
 }

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/c09205f6/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
index 5313ab9..9c93753 100644
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
@@ -511,8 +511,7 @@ public final class SliderUtils {
     int length = separator.length();
     String s = b.toString();
     return (trailing || s.isEmpty()) ?
-           s
-                                     : (b.substring(0, b.length() - length));
+           s  : (b.substring(0, b.length() - length));
   }
 
   /**
@@ -1589,7 +1588,7 @@ public final class SliderUtils {
 
   }
 
-  protected static void verifyIsFile(String program, File exe) throws
+  public static void verifyIsFile(String program, File exe) throws
       FileNotFoundException {
     if (!exe.isFile()) {
       throw new FileNotFoundException(program
@@ -1599,7 +1598,7 @@ public final class SliderUtils {
     }
   }
 
-  protected static void verifyFileSize(String program,
+  public static void verifyFileSize(String program,
       File exe,
       int minFileSize) throws FileNotFoundException {
     if (exe.length() < minFileSize) {
@@ -1740,7 +1739,6 @@ public final class SliderUtils {
     } catch (InterruptedException e) {
       throw new InterruptedIOException(e.toString());
     } catch (TimeoutException e) {
-      log.debug("");
       errorText = e.toString();
     }
     // error text: non null ==> operation failed
@@ -1843,11 +1841,11 @@ public final class SliderUtils {
 	/**
 	 * validate if a file on HDFS can be open
 	 * 
-	 * @throws IOException
-	 *             : the file can't be found or open
+	 * @throws IOException the file can't be found or opened
 	 * @throws URISyntaxException
 	 */
-	public static void validateHDFSFile(SliderFileSystem sliderFileSystem, String pathStr) throws IOException, URISyntaxException{
+	public static void validateHDFSFile(SliderFileSystem sliderFileSystem, String pathStr)
+      throws IOException, URISyntaxException{
 	  URI pathURI = new URI(pathStr);
 	  InputStream inputStream = sliderFileSystem.getFileSystem().open(new Path(pathURI));
 	  if(inputStream == null){