https://issues.apache.org/jira/browse/AMQ-5182 - apply patch from colin mondesir with thanks