diff --git a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java index dbfa0aac4b7..e05d2756de4 100644 --- a/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java +++ b/core/org.eclipse.cdt.core.tests/misc/org/eclipse/cdt/core/internal/efsextension/tests/EFSExtensionTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -129,6 +129,44 @@ public class EFSExtensionTests extends TestCase { assertEquals(expected, uri); } + public void testReplaceURIWithAuthority() { + URI originalURI = null; + URI expected = null; + try { + originalURI = new URI("rse", "recoskie@dbgaix3.torolab.ibm.com:1000", "/home/recoskie", null, null); + expected = new URI("rse", "recoskie@dbgaix3.torolab.ibm.com:1000", "/home/recoskie/subdirectory", null, null); + } catch (URISyntaxException e) { + fail(e.getMessage()); + } + String workingDirPath = EFSExtensionManager.getDefault() + .getPathFromURI(originalURI); + IPath path = new Path("subdirectory"); + IPath newPath = new Path(workingDirPath).append(path).makeAbsolute(); + URI uri = EFSExtensionManager.getDefault() + .createNewURIFromPath(originalURI, newPath.toString()); + + assertEquals(expected, uri); + } + + public void testReplaceURIWithAuthority2() { + URI originalURI = null; + URI expected = null; + try { + originalURI = new URI("rse", "recoskie@dbgaix3.torolab.ibm.com:1000", "/home/recoskie", null, null); + expected = new URI("rse", "recoskie", "dbgaix3.torolab.ibm.com", 1000, "/home/recoskie/subdirectory", null, null); + } catch (URISyntaxException e) { + fail(e.getMessage()); + } + String workingDirPath = EFSExtensionManager.getDefault() + .getPathFromURI(originalURI); + IPath path = new Path("subdirectory"); + IPath newPath = new Path(workingDirPath).append(path).makeAbsolute(); + URI uri = EFSExtensionManager.getDefault() + .createNewURIFromPath(originalURI, newPath.toString()); + + assertEquals(expected, uri); + } + public void testAppendinRSEURI() { URI originalURI = null; URI expected = null; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/EFSExtensionProvider.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/EFSExtensionProvider.java index 669a4a02c82..10053b70211 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/EFSExtensionProvider.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/EFSExtensionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -101,7 +101,8 @@ public abstract class EFSExtensionProvider { pathBuf.append(pathString); try { - return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), pathBuf.toString(), // replaced! + //Bug 326957 - EFSExtensionProvider does not handle URI's correctly + return new URI(uri.getScheme(), uri.getAuthority(), pathBuf.toString(), // replaced! uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { CCorePlugin.log(e);