rest call exception and null pointer handling