Fixed JERSEY-1612 and added unit test.