if (log.isDebugEnabled()) {
log.debug("Modifying argument: " + arg);
}
List<Argument> possibleReplacements = new ArrayList<Argument>();
PropertyIterator iter = args.iterator();
Argument replacementArg;
while (iter.hasNext()) {
replacementArg = (Argument) iter.next().getObjectValue();
try {
if (HtmlParsingUtils.isArgumentMatched(replacementArg, arg)) {
possibleReplacements.add(replacementArg);
}
} catch (Exception ex) {
log.error("Problem adding Argument", ex);
}
}
if (possibleReplacements.size() > 0) {
replacementArg = possibleReplacements.get(rand.nextInt(possibleReplacements.size()));
arg.setName(replacementArg.getName());
arg.setValue(replacementArg.getValue());
if (log.isDebugEnabled()) {
log.debug("Just set argument to values: " + arg.getName() + " = " + arg.getValue());
}
args.removeArgument(replacementArg);
}