type = PropertyType.UNDEFINED;
} else {
type = values[0].getType();
}
BitSet status = new BitSet();
PropertyImpl prop = getOrCreateProperty(name, type, true, false, status);
try {
if (prop.getDefinition().getRequiredType() == PropertyType.UNDEFINED
&& type != PropertyType.UNDEFINED) {
prop.setValue(ValueHelper.convert(values, type, session.getValueFactory()));
} else {
prop.setValue(values);
}
} catch (RepositoryException re) {
if (status.get(CREATED)) {
// setting value failed, get rid of newly created property
removeChildProperty(name);
}
// rethrow
throw re;