11/*******************************************************************************
2- * Copyright (c) 2009, 2013 Wind River Systems and others.
2+ * Copyright (c) 2009, 2025 Wind River Systems and others.
33 *
44 * This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License 2.0
1616
1717import java .io .File ;
1818import java .io .IOException ;
19+ import java .net .URI ;
20+ import java .net .URISyntaxException ;
1921import java .net .URL ;
2022
2123import org .eclipse .core .resources .IProject ;
2426import org .eclipse .core .resources .ResourcesPlugin ;
2527import org .eclipse .core .runtime .CoreException ;
2628import org .eclipse .core .runtime .FileLocator ;
27- import org .eclipse .core .runtime .IPath ;
2829import org .osgi .framework .Bundle ;
2930import org .osgi .framework .FrameworkUtil ;
3031
@@ -38,23 +39,26 @@ public class TestsPlugin {
3839 public static final String PLUGIN_ID = "org.eclipse.debug.tests" ; //$NON-NLS-1$
3940
4041 /**
41- * Returns the file corresponding to the specified path from within this bundle
42- * @return the file corresponding to the specified path from within this bundle, or
43- * <code>null</code> if not found
42+ * Returns the file corresponding to the specified path from within this
43+ * bundle
44+ *
45+ * @return the file corresponding to the specified path from within this
46+ * bundle, or <code>null</code> if not found
4447 */
45- public static File getFileInPlugin (IPath path ) {
48+ public static File getFileInPlugin (String path ) {
4649 try {
4750 Bundle bundle = FrameworkUtil .getBundle (TestsPlugin .class );
48- URL installURL = new URL (bundle .getEntry ("/" ), path .toString ()); //$NON-NLS-1$
49- URL localURL = FileLocator .toFileURL (installURL ); //Platform.asLocalURL(installURL );
51+ URI installURI = new URI (bundle .getEntry ("/" ) + path .toString ()); //$NON-NLS-1$
52+ URL localURL = FileLocator .toFileURL (installURI . toURL () );
5053 return new File (localURL .getFile ());
51- } catch (IOException e ) {
54+ } catch (IOException | URISyntaxException e ) {
5255 return null ;
5356 }
5457 }
5558
5659 /**
5760 * Creates a new project with the specified name
61+ *
5862 * @return a new project with the specified name
5963 */
6064 public static IProject createProject (String projectName ) throws CoreException {
0 commit comments