https://issues.apache.org/jira/browse/AMQ-5092 - apply patch from Dhiraj Bokde with thanks