mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 326957 EFSExtensionProvider does not handle URI's correctly
This commit is contained in:
parent
8e355ea4b2
commit
5ca9b3b6d1
2 changed files with 42 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue