https://issues.apache.org/jira/browse/AMQ-5384 - apply variant of patch from Tomasz Skorka with thanks