https://issues.apache.org/jira/browse/AMQ-4832 - apply patch from Matthew Walker with thanks