Author: shawkins
Date: 2009-06-11 13:23:45 -0400 (Thu, 11 Jun 2009)
New Revision: 1040
Modified:
trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java
trunk/common-core/src/test/java/com/metamatrix/common/protocol/TestURLHelper.java
Log:
TEIID-656 fix for urlhelper's handling of windows abosolute paths with the mmrofile
protocol. reviewed by rr.
Modified: trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java
===================================================================
---
trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java 2009-06-11
16:06:06 UTC (rev 1039)
+++
trunk/common-core/src/main/java/com/metamatrix/common/protocol/URLHelper.java 2009-06-11
17:23:45 UTC (rev 1040)
@@ -139,7 +139,7 @@
} else if (contextURL.startsWith(MMFileURLConnection.PROTOCOL+ SEPARATOR)) {
return new URL(context, filename,new
com.metamatrix.common.protocol.mmfile.Handler());
} else if (contextURL.startsWith(MMROFileURLConnection.PROTOCOL+ SEPARATOR)) {
- return URLHelper.buildURL(new URL(context, filename,new
com.metamatrix.common.protocol.mmfile.Handler()).getPath());
+ return new URL(URLHelper.buildURL(context.getPath()), filename,new
com.metamatrix.common.protocol.mmfile.Handler());
}
}
return new URL(context, url);
Modified:
trunk/common-core/src/test/java/com/metamatrix/common/protocol/TestURLHelper.java
===================================================================
---
trunk/common-core/src/test/java/com/metamatrix/common/protocol/TestURLHelper.java 2009-06-11
16:06:06 UTC (rev 1039)
+++
trunk/common-core/src/test/java/com/metamatrix/common/protocol/TestURLHelper.java 2009-06-11
17:23:45 UTC (rev 1040)
@@ -112,7 +112,7 @@
@Test public void testMMROFileContext() throws Exception {
URL context = URLHelper.buildURL("mmrofile:/metamatrix/bar.txt");
//$NON-NLS-1$
assertEquals("mmfile:/d:/foo.txt", URLHelper.buildURL(context,
"d:/foo.txt").toString()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("mmfile:/foo.txt", URLHelper.buildURL(context,
"/foo.txt").toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("mmfile:/foo.txt?xyz=m", URLHelper.buildURL(context,
"/foo.txt?xyz=m").toString()); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("mmfile:/metamatrix/foo.txt", URLHelper.buildURL(context,
"foo.txt").toString()); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("mmfile:/metamatrix/foo.txt", URLHelper.buildURL(context,
"./foo.txt").toString()); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("mmfile:/foo.txt", URLHelper.buildURL(context,
"../foo.txt").toString()); //$NON-NLS-1$ //$NON-NLS-2$