Program: 10550
Project: 10550
Buggy source:
/** 
 * Retrieves properties from multiple managed objects.
 * @param mos       the array of managed objects which could be of single type or mixed types. When they are mix-typed,the moType must be super type of all these managed objects.
 * @param moType    the type of the managed object. This managed object type must have all the properties defined asin propPaths.
 * @param propPaths the array of property path which has dot as separator, for example, "name", "guest.toolsStatus".
 * @return an array of Hashtable whose order is the same as the mos array. Each Hashtable has the properties forone managed object. Note: some of the properties you want to retrieve might not be set, and therefore you don't have an entry in the Hashtable at all. In other words, it's possible for you to get null for a property from the resulted Hashtable.
 * @throws InvalidProperty
 * @throws RuntimeFault
 * @throws RemoteException
 */
public static Hashtable[] retrieveProperties(ManagedObject[] mos,String moType,String[] propPaths) throws InvalidProperty, RuntimeFault, RemoteException {
  if (mos == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mos.length == 0 || mos[0] == null) {
    return new Hashtable[]{};
  }
  PropertyCollector pc=mos[0].getServerConnection().getServiceInstance().getPropertyCollector();
  ObjectSpec[] oss=new ObjectSpec[mos.length];
  for (int i=0; i < oss.length; i++) {
    oss[i]=new ObjectSpec();
    oss[i].setObj(mos[i].getMOR());
  }
  PropertySpec pSpec=createPropertySpec(moType,false,propPaths);
  PropertyFilterSpec pfs=new PropertyFilterSpec();
  pfs.setObjectSet(oss);
  pfs.setPropSet(new PropertySpec[]{pSpec});
  ObjectContent[] objs=pc.retrieveProperties(new PropertyFilterSpec[]{pfs});
  Hashtable[] pTables=new Hashtable[mos.length];
  for (int i=0; objs != null && i < objs.length && objs[i] != null; i++) {
    DynamicProperty[] props=objs[i].getPropSet();
    ManagedObjectReference mor=objs[i].getObj();
    int index;
    if (mor.getType().equals(mos[i].getMOR().getType()) && mor.get_value().equals(mos[i].getMOR().get_value())) {
      index=i;
    }
 else {
      index=findIndex(mos,mor);
      if (index == -1) {
        throw new RuntimeException("String_Node_Str" + mor.getType() + "String_Node_Str"+ mor.get_value());
      }
    }
    pTables[index]=new Hashtable();
    for (int j=0; props != null && j < props.length; j++) {
      Object obj=convertProperty(props[j].getVal());
      if (obj == null) {
        obj=NULL;
      }
      pTables[index].put(props[j].getName(),obj);
    }
  }
  return pTables;
}

Fixed version (ground truth):
/** 
 * Retrieves properties from multiple managed objects.
 * @param mos       the array of managed objects which could be of single type or mixed types. When they are mix-typed,the moType must be super type of all these managed objects.
 * @param moType    the type of the managed object. This managed object type must have all the properties defined asin propPaths.
 * @param propPaths the array of property path which has dot as separator, for example, "name", "guest.toolsStatus".
 * @return an array of Hashtable whose order is the same as the mos array. Each Hashtable has the properties forone managed object. Note: some of the properties you want to retrieve might not be set, and therefore you don't have an entry in the Hashtable at all. In other words, it's possible for you to get null for a property from the resulted Hashtable.
 * @throws InvalidProperty
 * @throws RuntimeFault
 * @throws RemoteException
 */
public static Hashtable[] retrieveProperties(ManagedObject[] mos,String moType,String[] propPaths) throws InvalidProperty, RuntimeFault, RemoteException {
  if (mos == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (mos.length == 0 || mos[0] == null) {
    return new Hashtable[]{};
  }
  PropertyCollector pc=getPropertyCollector(mos[0]);
  ObjectSpec[] oss=new ObjectSpec[mos.length];
  for (int i=0; i < oss.length; i++) {
    oss[i]=new ObjectSpec();
    oss[i].setObj(mos[i].getMOR());
  }
  PropertySpec pSpec=createPropertySpec(moType,false,propPaths);
  PropertyFilterSpec pfs=new PropertyFilterSpec();
  pfs.setObjectSet(oss);
  pfs.setPropSet(new PropertySpec[]{pSpec});
  ObjectContent[] objs=pc.retrieveProperties(new PropertyFilterSpec[]{pfs});
  Hashtable[] pTables=new Hashtable[mos.length];
  for (int i=0; objs != null && i < objs.length && objs[i] != null; i++) {
    DynamicProperty[] props=objs[i].getPropSet();
    ManagedObjectReference mor=objs[i].getObj();
    int index;
    if (mor.getType().equals(mos[i].getMOR().getType()) && mor.get_value().equals(mos[i].getMOR().get_value())) {
      index=i;
    }
 else {
      index=findIndex(mos,mor);
      if (index == -1) {
        throw new RuntimeException("String_Node_Str" + mor.getType() + "String_Node_Str"+ mor.get_value());
      }
    }
    pTables[index]=new Hashtable();
    for (int j=0; props != null && j < props.length; j++) {
      Object obj=convertProperty(props[j].getVal());
      if (obj == null) {
        obj=NULL;
      }
      pTables[index].put(props[j].getName(),obj);
    }
  }
  return pTables;
}