[513449] Installer fails due the broken unrelated p2 profile

https://bugs.eclipse.org/bugs/show_bug.cgi?id=513449

Change-Id: Icbc7b950174542dda0cd87633f143972e7b88266
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/internal/core/LazyProfileRegistry.java b/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/internal/core/LazyProfileRegistry.java
index d4dfe79..64d306f 100644
--- a/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/internal/core/LazyProfileRegistry.java
+++ b/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/internal/core/LazyProfileRegistry.java
@@ -18,6 +18,7 @@
 import org.eclipse.emf.common.CommonPlugin;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.equinox.internal.p2.engine.EngineActivator;
 import org.eclipse.equinox.internal.p2.engine.Profile;
@@ -39,7 +40,9 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -123,6 +126,27 @@
   }
 
   @Override
+  public synchronized IProfile[] getProfiles()
+  {
+    Map<String, Profile> profileMap = getProfileMap();
+    List<Profile> result = new ArrayList<Profile>(profileMap.size());
+    for (Profile profile : profileMap.values())
+    {
+      try
+      {
+        Profile snapshot = profile.snapshot();
+        result.add(snapshot);
+      }
+      catch (RuntimeException ex)
+      {
+        P2CorePlugin.INSTANCE.log(ex, IStatus.WARNING);
+      }
+    }
+
+    return result.toArray(new Profile[result.size()]);
+  }
+
+  @Override
   public synchronized void removeProfile(String id, long timestamp) throws ProvisionException
   {
     if (SELF.equals(id))