ListIterator<ConfigurationOptionSetting> listIterator = newOptionSettings
.listIterator();
while (listIterator.hasNext()) {
ConfigurationOptionSetting curOptionSetting = listIterator.next();
/*
* Filters out harmful options
*
* I really mean harmful - If you mention a terminated environment
* settings, Elastic Beanstalk will accept, but this might lead to
* inconsistent states, specially when creating / listing environments.
*
* Trust me on this one.
*/
boolean bInvalid = isBlank(curOptionSetting.getValue());
if (!bInvalid)
bInvalid |= (curOptionSetting.getNamespace().equals(
"aws:cloudformation:template:parameter") && curOptionSetting
.getOptionName().equals("AppSource"));
if (!bInvalid)
bInvalid |= (curOptionSetting.getValue().contains(curEnv
.getEnvironmentId()));
if (bInvalid)
listIterator.remove();
}