The order matters. If the stream enters a fail state no further processing of that stream can occur until the errors are cleared. This means that the clear() must be the first thing done.