code: private Stack<String> truncatePathStack(int pLevel) {
          if (pathStack.size() < pLevel) {
              return new Stack<String>();
          } else {
              // Trim of domain and MBean properties
              // pathStack gets cloned here since the processing will eat it up
              Stack<String> ret = (Stack<String>) pathStack.clone();
              for (int i = 0;i < pLevel;i++) {
                  ret.pop();
              }
              return ret;
          }
      }
docs: Trim down the stack by some value or return an empty stack