Program: 126825
Project: 126825
Buggy source:
/** 
 * DOC ggu Comment method "findRealContextType". Find the context type for the node. If element, return element type. If other, return content type. Also, if the type is sub type, need find out the item type.
 * @param node
 * @return
 */
private ERepositoryObjectType findRealContextType(final RepositoryNode node){
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService != null && hadoopClusterService.isHadoopSubnode(node)) {
    return hadoopClusterService.getHadoopClusterType();
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITransformService.class)) {
    ITransformService transformService=(ITransformService)GlobalServiceRegister.getDefault().getService(ITransformService.class);
    if (transformService.isTransformNode(node)) {
      return transformService.getTransformRootType();
    }
  }
  ERepositoryObjectType contentType=null;
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    contentType=node.getObjectType();
  }
  if (contentType == null) {
    contentType=node.getContentType();
  }
  if (contentType != null) {
    if (contentType.isSubItem()) {
      ERepositoryObjectType itemType=null;
      if (node.getObject() != null) {
        Property property=node.getObject().getProperty();
        if (property != null) {
          try {
            itemType=ERepositoryObjectType.getItemType(property.getItem());
          }
 catch (          IllegalStateException e) {
          }
        }
      }
      contentType=itemType;
    }
  }
  return contentType;
}

Fixed version (ground truth):
/** 
 * DOC ggu Comment method "findRealContextType". Find the context type for the node. If element, return element type. If other, return content type. Also, if the type is sub type, need find out the item type.
 * @param node
 * @return
 */
private ERepositoryObjectType findRealContextType(final RepositoryNode node){
  IHadoopClusterService hadoopClusterService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IHadoopClusterService.class)) {
    hadoopClusterService=(IHadoopClusterService)GlobalServiceRegister.getDefault().getService(IHadoopClusterService.class);
  }
  if (hadoopClusterService != null && hadoopClusterService.isHadoopSubnode(node)) {
    return hadoopClusterService.getHadoopClusterType();
  }
  for (  IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
    ERepositoryObjectType objectType=nodeHandler.getRootType(node);
    if (objectType != null) {
      return objectType;
    }
  }
  ERepositoryObjectType contentType=null;
  if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
    contentType=node.getObjectType();
  }
  if (contentType == null) {
    contentType=node.getContentType();
  }
  if (contentType != null) {
    if (contentType.isSubItem()) {
      ERepositoryObjectType itemType=null;
      if (node.getObject() != null) {
        Property property=node.getObject().getProperty();
        if (property != null) {
          try {
            itemType=ERepositoryObjectType.getItemType(property.getItem());
          }
 catch (          IllegalStateException e) {
          }
        }
      }
      contentType=itemType;
    }
  }
  return contentType;
}