Method org.nuxeo.ecm.core.api.DocumentModelComparator.compare(DocumentModel, DocumentModel) should ignore the case when checking the orderBy asc / ASC.
Indeed, if you query a Directory with an orderBy "ASC" in uppercase instead of "asc" in lowercase, it fails (see org.nuxeo.ecm.directory.AbstractDirectory.orderEntries(List<DocumentModel>, Map<String, String>)).
So we should change final boolean asc = ORDER_ASC.equals(e.getValue()); into final boolean asc = ORDER_ASC.equalsIgnoreCase(e.getValue());