You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/06/26 13:42:11 UTC
[05/21] git commit: Manual URL manipulation leads to invalid results.
Manual URL manipulation leads to invalid results.
The test was working by accident on UNIX - with an absolute path the
beginning of the string would be file:///, which is the expected prefix.
On Windows though the result was an invalid URL. Use the platform
provided functionality to construct the URL and remove invalid
statement in the comment.
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/e25b0292
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/e25b0292
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/e25b0292
Branch: refs/heads/master
Commit: e25b0292ce4f6b7b7d7ee6b7ed7a0112d5ad451b
Parents: 37e30f9
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Fri Jun 6 17:54:08 2014 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Wed Jun 25 18:28:51 2014 +0300
----------------------------------------------------------------------
core/src/test/java/brooklyn/util/ResourceUtilsTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/e25b0292/core/src/test/java/brooklyn/util/ResourceUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/util/ResourceUtilsTest.java b/core/src/test/java/brooklyn/util/ResourceUtilsTest.java
index 495fb57..e6371b4 100644
--- a/core/src/test/java/brooklyn/util/ResourceUtilsTest.java
+++ b/core/src/test/java/brooklyn/util/ResourceUtilsTest.java
@@ -87,9 +87,12 @@ public class ResourceUtilsTest {
@Test
public void testGetResourceViaFileWithPrefix() throws Exception {
- // on windows the correct syntax is file:///c:/path (note the extra /);
- // however our routines also accept file://c:/path so the following is portable
- InputStream stream = utils.getResourceFromUrl("file://"+tempFile.getAbsolutePath());
+ // The correct format for file URLs is file:///<absolute path>.
+ // On UNIX file:///tmp.
+ // On Windows both file:/C:/temp and file:///C:/temp are supported by Java,
+ // while Windows itself supports the latter only.
+ // Note that file://C:/temp is *wrong*, because C: is interpreted as the host
+ InputStream stream = utils.getResourceFromUrl(tempFile.toURI().toURL().toString());
assertEquals(Streams.readFullyString(stream), tempFileContents);
}