modify Java decoder in a way it could be transpiled to exception unfriendly languages PiperOrigin-RevId: 769488037