SLIDE 149; sync with YARN-913 which has moved to specific exception for 
NoPathPermissions (as hadoop.fs one didn't let me set text; propagate through 
the codebase)


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

Branch: refs/heads/develop
Commit: 969b734fc03ac5684cbbcd326d475f44810560c0
Parents: a3e5b37
Author: Steve Loughran <ste...@apache.org>
Authored: Sun Sep 28 11:22:47 2014 +0100
Committer: Steve Loughran <ste...@apache.org>
Committed: Sun Sep 28 11:22:47 2014 +0100

----------------------------------------------------------------------
 .../appmaster/web/rest/registry/PathEntryResource.java  |  8 +-------
 .../appmaster/web/rest/registry/RegistryResource.java   | 12 +++---------
 .../web/rest/registry/TestRegistryRestResources.groovy  |  2 +-
 3 files changed, 5 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/969b734f/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
index 8790871..91da408 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/PathEntryResource.java
@@ -18,16 +18,10 @@
 
 package org.apache.slider.server.appmaster.web.rest.registry;
 
-import org.apache.commons.logging.Log;
-import org.apache.hadoop.yarn.registry.client.api.RegistryOperations;
-import 
org.apache.hadoop.yarn.registry.client.exceptions.InvalidRecordException;
 import org.apache.hadoop.yarn.registry.client.types.ServiceRecord;
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
 import java.util.List;
 
 /**
@@ -38,7 +32,7 @@ import java.util.List;
 public class PathEntryResource {
 
   /**
-   * Child nodes: as the full path to each element
+   * Child nodes: as the short path to each element
    */
   public List<String> nodes;
 

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/969b734f/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
----------------------------------------------------------------------
diff --git 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
index 23f7261..fc41e7d 100644
--- 
a/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
+++ 
b/slider-core/src/main/java/org/apache/slider/server/appmaster/web/rest/registry/RegistryResource.java
@@ -19,22 +19,19 @@
 package org.apache.slider.server.appmaster.web.rest.registry;
 
 import com.google.inject.Singleton;
-import org.apache.hadoop.fs.PathAccessDeniedException;
 import org.apache.hadoop.fs.PathNotFoundException;
 import org.apache.hadoop.yarn.registry.client.api.RegistryOperations;
 import 
org.apache.hadoop.yarn.registry.client.exceptions.AuthenticationFailedException;
 import 
org.apache.hadoop.yarn.registry.client.exceptions.InvalidRecordException;
+import 
org.apache.hadoop.yarn.registry.client.exceptions.NoPathPermissionsException;
 import org.apache.hadoop.yarn.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.yarn.registry.client.types.RegistryPathStatus;
 import org.apache.hadoop.yarn.webapp.ForbiddenException;
 import org.apache.hadoop.yarn.webapp.NotFoundException;
-import org.apache.hadoop.yarn.webapp.WebAppException;
 import org.apache.slider.server.appmaster.web.WebAppApi;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -42,13 +39,11 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import java.io.IOException;
-import java.util.List;
 
 /**
- * This is the read-only view of the slider YARN registry
+ * This is the read-only view of the YARN registry.
  * 
  * Model:
  * <ol>
@@ -126,7 +121,7 @@ public class RegistryResource {
       throw new NotFoundException("Not found: " + path);
     } catch (AuthenticationFailedException e) {
       throw new ForbiddenException(path);
-    } catch (PathAccessDeniedException e) {
+    } catch (NoPathPermissionsException e) {
       throw new ForbiddenException(path);
     } catch (Exception e) {
       log.error("Error during generation of response: {}", e, e);
@@ -139,7 +134,6 @@ public class RegistryResource {
    * Build from the registry, filling up the children and service records.
    * If there is no service record at the end of the path, that entry is 
    * null
-   * @param registry registry operations
    * @param path path to query
    * @return the built up record
    * @throws IOException problems

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/969b734f/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy
----------------------------------------------------------------------
diff --git 
a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy
 
b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy
index 877ba56..9dd3092 100644
--- 
a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy
+++ 
b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy
@@ -125,7 +125,7 @@ class TestRegistryRestResources extends AgentTestBase {
     def responseStr = processResponse(userServicesURL, response)
 
     assert responseStr.contains("\"nodes\"")
-    assert responseStr.contains("/${SliderKeys.APP_TYPE}")
+    assert responseStr.contains(SliderKeys.APP_TYPE)
 
     entryResource = jsonBuilder.get(PathEntryResource.class)
     assert entryResource.nodes.size() == 1;

Reply via email to