try {   if (myProp.getExperimentValues() != null) { List experimentValues = myProp.getExperimentValues(); Object newValue = Array.newInstance(myProp.getPropertyClass(), experimentValues.size()); for (int j = 0; j < experimentValues.size(); j++) Array.set(newValue, j, PropertyHelper.validateValue(myProp, experimentValues.get(j))); hisProp.setExperimentValues(Arrays.asList((Object[])newValue)); hisProp.setValue(null); } else { Object o = PropertyHelper.validateValue(myProp, myProp.getValue()); if (o != null) { hisProp.setValue(o); }
if (hisProp == null) { if (log.isErrorEnabled()) { log.error("Report bug 1377: Using " + CSMART.writeDebug() + " couldn't find " + hisPropName.toString() + " in " + result.getFullName().toString() + " copying from " + name.toString() + " in " + this.getFullName().toString());
  public BaseComponent copy(BaseComponent result) {    // Make sure we're copying apples into apples    // The result can be a sub-class, but we want it    // to at least have the same set of properties    if (! (this.getClass().isAssignableFrom(result.getClass())))      return null;    Iterator iter = getSortedLocalPropertyNames();    while(iter.hasNext()) {      CompositeName name = (CompositeName)iter.next();      Property myProp = getProperty(name);      // compose the correct name for the property      // name must be prepended by new society name      String s = name.last().toString();      ComponentName hisPropName = new ComponentName(result, s);      Property hisProp = result.getProperty(hisPropName);      try {	// if have experimental values, then copy those	// else copy the property value	if (myProp.getExperimentValues() != null) {	  List experimentValues = myProp.getExperimentValues();	  Object newValue = Array.newInstance(myProp.getPropertyClass(),					      experimentValues.size());	  for (int j = 0; j < experimentValues.size(); j++)	    Array.set(newValue, j,		      PropertyHelper.validateValue(myProp, 						   experimentValues.get(j)));	  hisProp.setExperimentValues(Arrays.asList((Object[])newValue));	  hisProp.setValue(null); // no specific value	} else {	  Object o = PropertyHelper.validateValue(myProp, myProp.getValue());	  if (o != null) {            hisProp.setValue(o);          }	}      } catch (InvalidPropertyValueException e) {        if(log.isErrorEnabled()) {          log.error("Caught InvalidPropertyValueException: " + getClass().getName() + e);        }      }    }    // Now, clone my children    for(int i=0; i < getChildCount(); i++) {      ConfigurableComponent cc = (ConfigurableComponent)getChild(i);      BaseComponent co =         (BaseComponent)result.getChild(cc.getFullName().last());      if(co != null) {	cc.copy(co);      }    }    return result;  }