logger.debug("Creating dunnings");
ArrayList<Dunning> createdDunnings = new ArrayList<Dunning>();
Iterator<Invoice> it = invoices.iterator();
while (it.hasNext()) {
Invoice invoice = it.next();
//Try to get the dunning-group from the customer of the invoice:
DunningGroup dunningGroup = null;
if ((invoice.getAddress() != null) && (invoice.getAddress() instanceof Customer)) {
if (logger.isDebugEnabled()) {
logger.debug("Looking for dunning group of customer " + invoice.getAddress().getId());
}
dunningGroup = ((Customer) invoice.getAddress()).getDunningGroup();
}
//If no customer-dunning-group was found use the default dunning-group
if (dunningGroup == null) {
if (logger.isDebugEnabled()) {