From 60b97051af391cbe8744b5e0710d12d5643e0d51 Mon Sep 17 00:00:00 2001 From: Yiyang Song Date: Tue, 28 Jun 2016 15:13:51 -0400 Subject: [PATCH 1/2] Set the array instead of add into array to ensure it's not growing --- .../webservices/data/autodiscover/AutodiscoverService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java index 147a61c7f..11105eb9f 100644 --- a/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java +++ b/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java @@ -601,7 +601,7 @@ TSettings internalGetLegacyUserSettings( settings .getRedirectTarget())); - urls.add(currentUrlIndex, new URI( + urls.set(currentUrlIndex, new URI( settings.getRedirectTarget())); break; From 4f854c8bcca6639b7d4b9a634cfeba45499107f0 Mon Sep 17 00:00:00 2001 From: Yiyang Song Date: Tue, 28 Jun 2016 18:02:58 -0400 Subject: [PATCH 2/2] Make a copy of original urls list to ensure everytime the new url(not redirected) being discovered, will reset the currentHop --- .../webservices/data/autodiscover/AutodiscoverService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java b/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java index 11105eb9f..b5ba37ed9 100644 --- a/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java +++ b/src/main/java/microsoft/exchange/webservices/data/autodiscover/AutodiscoverService.java @@ -549,6 +549,7 @@ TSettings internalGetLegacyUserSettings( int scpUrlCount; OutParam outParamInt = new OutParam(); List urls = this.getAutodiscoverServiceUrls(domainName, outParamInt); + List origUrls = new ArrayList(urls); scpUrlCount = outParamInt.getParam(); if (urls.size() == 0) { throw new ServiceValidationException( @@ -570,6 +571,9 @@ TSettings internalGetLegacyUserSettings( do { URI autodiscoverUrl = urls.get(currentUrlIndex); + if (origUrls.contains(autodiscoverUrl)) { + currentHop.setParam(1); + } boolean isScpUrl = currentUrlIndex < scpUrlCount; try {