public void addErrors(List<CounterError> counterErrorList) {
		assert errorCounter;
		if (counterErrorList.isEmpty()) {
			return;
		}
		synchronized (errors) {
			if (!errors.isEmpty() && errors.get(0).getTime() > counterErrorList.get(0).getTime()) {
				// tant que faire se peut on les met à peu près dans l'ordre pour le sort ci après
				errors.addAll(0, counterErrorList);
			} else {
				errors.addAll(counterErrorList);
			}
			if (errors.size() > 1) {
				// "sort" a les mêmes performances sur LinkedList que sur ArrayList car il y a un tableau intermédiaire
				// (selon Implementation Patterns, Kent Beck)
				errors.sort(COUNTER_ERROR_COMPARATOR);

				while (errors.size() > MAX_ERRORS_COUNT) {
					errors.removeFirst();
				}
			}
		}
	}
@Test
	public void testAddErrors() {
		final CounterError beforeError = new CounterError("before", null);
		assertNotNull("CounterError.toString()", beforeError.toString());
		try {
			Thread.sleep(50);
		} catch (final InterruptedException e) {
			throw new IllegalStateException(e);
		}
		final Counter errorCounter = new Counter(Counter.ERROR_COUNTER_NAME, null);

		CounterError.bindRequest(null);
		CounterError.unbindRequest();
		final HttpServletRequest httpRequest = createNiceMock(HttpServletRequest.class);
		expect(httpRequest.getAttribute(CounterError.REQUEST_KEY)).andReturn("/test GET");
		expect(httpRequest.getRemoteUser()).andReturn("me");
		replay(httpRequest);
		CounterError.bindRequest(httpRequest);
		assertNotNull("new CounterError", new CounterError("with request", null));
		CounterError.unbindRequest();
		verify(httpRequest);

		final int errorsCount = errorCounter.getErrorsCount();
		final List<CounterError> errors = new ArrayList<>();
		errors.add(new CounterError("erreur", null));
		errors.add(new CounterError("erreur", "stacktrace"));
		errorCounter.addErrors(errors);
		errors.add(0, beforeError);
		errorCounter.addErrors(errors);
		assertEquals("addErrors", errorsCount + 5, errorCounter.getErrorsCount());
		while (errorCounter.getErrorsCount() < Counter.MAX_ERRORS_COUNT) {
			errorCounter.addErrors(errors);
		}
		errorCounter.addErrors(errors);
	}