498375: fix 3 test failures in mylyn-all-snapshot

Change-Id: I71e9e550a8fd9ede375dc6b63cfe87e002265ef4
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=498375
Signed-off-by: Jaxsun McCarthy Huggan <jaxsun.mccarthy@tasktop.com>
diff --git a/org.eclipse.mylyn.discovery.core/src/org/eclipse/mylyn/internal/discovery/core/util/P2TransportService.java b/org.eclipse.mylyn.discovery.core/src/org/eclipse/mylyn/internal/discovery/core/util/P2TransportService.java
index 21caccc..b6d7be4 100644
--- a/org.eclipse.mylyn.discovery.core/src/org/eclipse/mylyn/internal/discovery/core/util/P2TransportService.java
+++ b/org.eclipse.mylyn.discovery.core/src/org/eclipse/mylyn/internal/discovery/core/util/P2TransportService.java
@@ -49,6 +49,9 @@
 				clazz = Class.forName("org.eclipse.equinox.internal.p2.repository.Transport"); //$NON-NLS-1$
 				transport = getTransportEclipse37();
 			}
+			if (transport == null) {
+				throw new ClassNotFoundException("Failed to load P2 transport"); //$NON-NLS-1$
+			}
 			downloadMethod = clazz.getDeclaredMethod("download", URI.class, OutputStream.class, IProgressMonitor.class); //$NON-NLS-1$
 			streamMethod = clazz.getDeclaredMethod("stream", URI.class, IProgressMonitor.class); //$NON-NLS-1$
 			getLastModifiedMethod = clazz.getDeclaredMethod("getLastModified", URI.class, IProgressMonitor.class); //$NON-NLS-1$
@@ -61,7 +64,8 @@
 
 	private Object getTransportEclipse37() throws Exception {
 		BundleContext bundleContext = Platform.getBundle(Platform.PI_RUNTIME).getBundleContext();
-		ServiceReference serviceReference = bundleContext.getServiceReference("org.eclipse.equinox.p2.core.IProvisioningAgent"); //$NON-NLS-1$
+		ServiceReference<?> serviceReference = bundleContext
+				.getServiceReference("org.eclipse.equinox.p2.core.IProvisioningAgent"); //$NON-NLS-1$
 		if (serviceReference != null) {
 			try {
 				Object agent = bundleContext.getService(serviceReference);