Program: 8749
Project: 8749
Buggy source:
/** 
 * Tries to retrieve the tree corresponding to specified   {@code versionTree}outside of the version storage based on versionable path information stored with the version history. The following cases are distinguished: <ul> <li>Version History: If the given tree is a version history the associated versionable tree in the specified workspace is being returned based on the information stored in the versionable path property. If no versionable path property is present   {@code null} is returned.</li><li>Version: Same as for version history.</li> <li>Version Labels: Same as for version history.</li> <li>Frozen Node: If the given tree forms part of a frozen node the path of the target node is computed from the versionable path and the relative path of the frozen node.</li> <li>Other Nodes: If the specified tree is not part of the tree structure defined by a version history,  {@code null} will be returned.</li></ul> Please note that this method will not verify if the tree at the versionable path or the computed subtree actually exists. This must be asserted by the caller before operating on the tree.
 * @param versionTree The tree from within the version storage for whichthat versionable correspondent should be retrieved.
 * @param workspaceName The name of the workspace for which the target should be retrieved.
 * @return A existing or non-existing tree pointing to the location of thecorrespondent tree outside of the version storage or  {@code null} if theversionable path property for the specified workspace is missing or if the given tree is not located within the tree structure defined by a version history.
 * @see {@link VersionablePathHook}
 * @see {@link VersionConstants#MIX_REP_VERSIONABLE_PATHS}
 */
@CheckForNull public Tree getVersionable(@Nonnull Tree versionTree,@Nonnull String workspaceName){
  Root root=getWorkspaceRoot();
  String relPath="String_Node_Str";
  Tree t=versionTree;
  while (t.exists() && !isVersionStoreTree(t) && !t.isRoot()) {
    String ntName=TreeUtil.getPrimaryTypeName(t);
    if (VersionConstants.NT_FROZENNODE.equals(ntName)) {
      relPath=PathUtils.relativize(t.getPath(),versionTree.getPath());
    }
 else     if (JcrConstants.NT_VERSIONHISTORY.equals(ntName)) {
      PropertyState prop=t.getProperty(workspaceName);
      if (prop != null) {
        return root.getTree(PathUtils.concat(prop.getValue(Type.PATH),relPath));
      }
 else {
        log.warn("String_Node_Str",workspaceName,t.getPath());
        break;
      }
    }
    t=t.getParent();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Tries to retrieve the tree corresponding to specified   {@code versionTree}outside of the version storage based on versionable path information stored with the version history. The following cases are distinguished: <ul> <li>Version History: If the given tree is a version history the associated versionable tree in the specified workspace is being returned based on the information stored in the versionable path property. If no versionable path property is present   {@code null} is returned.</li><li>Version: Same as for version history.</li> <li>Version Labels: Same as for version history.</li> <li>Frozen Node: If the given tree forms part of a frozen node the path of the target node is computed from the versionable path and the relative path of the frozen node.</li> <li>Other Nodes: If the specified tree is not part of the tree structure defined by a version history,  {@code null} will be returned.</li></ul> Please note that this method will not verify if the tree at the versionable path or the computed subtree actually exists. This must be asserted by the caller before operating on the tree.
 * @param versionTree The tree from within the version storage for whichthat versionable correspondent should be retrieved.
 * @param workspaceName The name of the workspace for which the target should be retrieved.
 * @return A existing or non-existing tree pointing to the location of thecorrespondent tree outside of the version storage or  {@code null} if theversionable path property for the specified workspace is missing or if the given tree is not located within the tree structure defined by a version history.
 * @see VersionablePathHook
 * @see VersionConstants#MIX_REP_VERSIONABLE_PATHS
 */
@CheckForNull public Tree getVersionable(@Nonnull Tree versionTree,@Nonnull String workspaceName){
  Root root=getWorkspaceRoot();
  String relPath="String_Node_Str";
  Tree t=versionTree;
  while (t.exists() && !isVersionStoreTree(t) && !t.isRoot()) {
    String ntName=TreeUtil.getPrimaryTypeName(t);
    if (VersionConstants.NT_FROZENNODE.equals(ntName)) {
      relPath=PathUtils.relativize(t.getPath(),versionTree.getPath());
    }
 else     if (JcrConstants.NT_VERSIONHISTORY.equals(ntName)) {
      PropertyState prop=t.getProperty(workspaceName);
      if (prop != null) {
        return root.getTree(PathUtils.concat(prop.getValue(Type.PATH),relPath));
      }
 else {
        log.warn("String_Node_Str",workspaceName,t.getPath());
        break;
      }
    }
    t=t.getParent();
  }
  return null;
}