Java : Error handling: exception when argument of type boolean takes some specific value