462543: CatalogRegistry lookup needs to ignore HTTP vs HTTPS

Bug: 462543
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=462543
diff --git a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/URLUtil.java b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/URLUtil.java
index f3cfd47..7c7e6c3 100644
--- a/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/URLUtil.java
+++ b/org.eclipse.epp.mpc.core/src/org/eclipse/epp/internal/mpc/core/util/URLUtil.java
@@ -77,4 +77,13 @@
 	private static String encodeQuery(String query) {
 		return query == null ? null : query.replace(" ", "+"); //$NON-NLS-1$//$NON-NLS-2$
 	}
+
+	public static String toggleHttps(String url) {
+		if (url.startsWith("http:")) { //$NON-NLS-1$
+			url = "https:" + url.substring("http:".length()); //$NON-NLS-1$ //$NON-NLS-2$
+		} else if (url.startsWith("https:")) { //$NON-NLS-1$
+			url = "http:" + url.substring("https:".length()); //$NON-NLS-1$//$NON-NLS-2$
+		}
+		return url;
+	}
 }
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java
index ad26ca4..f02db39 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/CatalogRegistry.java
@@ -17,6 +17,7 @@
 import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
 
+import org.eclipse.epp.internal.mpc.core.util.URLUtil;
 import org.eclipse.epp.mpc.core.model.ICatalogBranding;
 import org.eclipse.epp.mpc.core.model.INews;
 import org.eclipse.epp.mpc.ui.CatalogDescriptor;
@@ -98,6 +99,12 @@
 				return catalogDescriptor;
 			}
 		}
+		url = URLUtil.toggleHttps(url);
+		for (CatalogDescriptor catalogDescriptor : catalogDescriptors) {
+			if (url.startsWith(catalogDescriptor.getUrl().toExternalForm())) {
+				return catalogDescriptor;
+			}
+		}
 		return null;
 	}
 }