[
https://issues.apache.org/jira/browse/TUSCANY-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12671836#action_12671836
]
Marcin Kawelski commented on TUSCANY-574:
-----------------------------------------
In which version is it resolved? I have 2.1.0-M1 and it seems to be still not
solved.
> URISyntaxException from launcher when jars reside in windows Maven repository
> -----------------------------------------------------------------------------
>
> Key: TUSCANY-574
> URL: https://issues.apache.org/jira/browse/TUSCANY-574
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Core Runtime
> Environment: Win XP, J2RE 1.5.0 IBM Windows 32 build
> pwi32dev-20060511 (SR2)
> Reporter: Matthew Sykes
> Assignee: Jeremy Boynes
> Priority: Trivial
>
> When attempting to run maven from various samples directories:
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> C:\cygwin\home\sykesm\oss-code\tuscany\java\samples\sca\calculator\target\surefire-reports
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running calculator.CalculatorTestCase
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.38 sec <<<
> FAILURE!
> testCalculator(calculator.CalculatorTestCase) Time elapsed: 0.31 sec <<<
> ERROR!
> java.lang.IllegalArgumentException
> at java.net.URI.create(URI.java:854)
> at
> org.apache.tuscany.core.launcher.Launcher.getInstallDirectory(Launcher.java:177)
> at
> org.apache.tuscany.core.launcher.Launcher.bootRuntime(Launcher.java:104)
> at org.apache.tuscany.test.SCATestCase.setUp(SCATestCase.java:40)
> at calculator.CalculatorTestCase.setUp(CalculatorTestCase.java:32)
> at junit.framework.TestCase.runBare(TestCase.java:125)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:615)
> at
> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:615)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
> Caused by: java.net.URISyntaxException: Illegal character in path at index
> 18: file:/C:/Documents and
> Settings/sykesm/.m2/repository/org/apache/tuscany/core/1.0-SNAPSHOT/core-1.0-SNAPSHOT.jar
> at java.net.URI$Parser.fail(URI.java:2821)
> at java.net.URI$Parser.checkChars(URI.java:2994)
> at java.net.URI$Parser.parseHierarchical(URI.java:3078)
> at java.net.URI$Parser.parse(URI.java:3026)
> at java.net.URI.<init>(URI.java:590)
> at java.net.URI.create(URI.java:852)
> This appears to be due to how the Launcher teases out the directory
> containing the Tuscany code. Since the default location for the maven
> repository on windows has spaces in the directory names, the "URI" that was
> used was not valid. In order to get past this I made a very simple change:
> $ svn diff
> Index: sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
> ===================================================================
> --- sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
> (revision 425392)
> +++ sca/core/src/main/java/org/apache/tuscany/core/launcher/Launcher.java
> (working copy)
> @@ -168,13 +168,15 @@
> if (!"jar".equals(url.getProtocol())) {
> throw new IllegalStateException("Must be run from a jar: " +
> url);
> }
> +
> String jarLocation = url.toString();
> jarLocation = jarLocation.substring(4,
> jarLocation.lastIndexOf("!/"));
> if (!jarLocation.startsWith("file:")) {
> throw new IllegalStateException("Must be run from a local
> filesystem: " + jarLocation);
> }
> + jarLocation = jarLocation.substring(5);
>
> - File jarFile = new File(URI.create(jarLocation));
> + File jarFile = new File(jarLocation);
> return jarFile.getParentFile().getParentFile();
> }
> }
> This may not be an appropriate change but it did resolve the problem I was
> seeing.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.