From c248bb4acf820a4563208d0236211f012fd4b7ff Mon Sep 17 00:00:00 2001 From: mguessan Date: Sun, 28 Dec 2008 21:48:33 +0000 Subject: [PATCH] Fix : avoid duplicate entries on email detection (Authentication failure with Exchange 2007) git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@264 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index a15e6f79..5f86678d 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -1127,7 +1127,12 @@ public class ExchangeSession { if (status != HttpStatus.SC_OK) { throw new IOException("Unable to get user email from: " + getMethod.getPath()); } - email = XMLStreamUtil.getElementContentByLocalName(getMethod.getResponseBodyAsStream(), "EM"); + Map> results = XMLStreamUtil.getElementContentsAsMap(getMethod.getResponseBodyAsStream(), "item", "AN"); + Map result = results.get(userName); + if (result != null) { + email = result.get("EM"); + } + } finally { getMethod.releaseConnection(); }