ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tbeerbo...@apache.org
Subject git commit: AMBARI-7007 - href is wrong for sub resource query of request resource
Date Tue, 26 Aug 2014 12:29:13 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 160abc549 -> 8bed25926


AMBARI-7007 - href is wrong for sub resource query of request resource


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8bed2592
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8bed2592
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8bed2592

Branch: refs/heads/trunk
Commit: 8bed25926031736ae6eed2f774e7996f230b5e13
Parents: 160abc5
Author: tbeerbower <tbeerbower@hortonworks.com>
Authored: Mon Aug 25 20:04:04 2014 -0400
Committer: tbeerbower <tbeerbower@hortonworks.com>
Committed: Tue Aug 26 08:28:45 2014 -0400

----------------------------------------------------------------------
 .../server/api/resources/RequestResourceDefinition.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8bed2592/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java
index a3920d1..291b01a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RequestResourceDefinition.java
@@ -83,15 +83,19 @@ public class RequestResourceDefinition extends BaseResourceDefinition
{
         sb.append(href);
         sb.append('/').append(requestId);
       } else {
-        // split the href up into its parts, intercepting "clusers" in order
+        // split the href up into its parts, intercepting "clusters" in order
         // to rewrite the href to be scoped for requests
         String[] tokens = href.split("/");
 
-        for (int i = 0; i < tokens.length; ++i) {
+        Integer tokenCount = tokens.length;
+        for (int i = 0; i < tokenCount; ++i) {
           String fragment = tokens[i];
-          sb.append(fragment).append('/');
+          sb.append(fragment);
+          if (i < tokenCount - 1 ) {
+            sb.append('/');
+          }
 
-          if ("clusters".equals(fragment) && i + 1 < tokens.length) {
+          if ("clusters".equals(fragment) && i + 1 < tokenCount) {
             String clusterName = tokens[i + 1];
             sb.append(clusterName).append("/");
             sb.append("requests/").append(requestId);


Mime
View raw message