Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning MalformedURLException when executing tests #73

Closed
simasch opened this issue May 30, 2018 · 5 comments
Closed

Warning MalformedURLException when executing tests #73

simasch opened this issue May 30, 2018 · 5 comments
Assignees
Labels

Comments

@simasch
Copy link

simasch commented May 30, 2018

In the console log I see multiple MalformedURLException:

10:32:08.043 [main] WARN com.tngtech.archunit.core.importer.UrlSource$From - Cannot parse URL from path C:\Program Files\Java\jdk1.8.0_112\jre\lib\resources.jar!/
java.net.MalformedURLException: invalid url: file://C:%5CProgram%20Files%5CJava%5Cjdk1.8.0_112%5Cjre%5Clib%5Cresources.jar!/ (java.net.MalformedURLException: For input string: "%5CProgram%20Files%5CJava%5Cjdk1.8.0_112%5Cjre%5Clib%5Cresources.jar")
	at java.net.URL.<init>(URL.java:627)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at com.tngtech.archunit.core.importer.UrlSource$From.newUrl(UrlSource.java:100)
	at com.tngtech.archunit.core.importer.UrlSource$From.newJarUri(UrlSource.java:95)
	at com.tngtech.archunit.core.importer.UrlSource$From.parseClassPathEntry(UrlSource.java:86)
	at com.tngtech.archunit.core.importer.UrlSource$From.findUrlsForClassPathProperty(UrlSource.java:79)
	at com.tngtech.archunit.core.importer.UrlSource$From.classPathSystemProperties(UrlSource.java:70)
	at com.tngtech.archunit.core.importer.LocationResolver$Legacy.resolveClassPath(LocationResolver.java:38)
	at com.tngtech.archunit.core.importer.Locations.getLocationsOf(Locations.java:88)
	at com.tngtech.archunit.core.importer.Locations.ofPackage(Locations.java:63)
	at com.tngtech.archunit.junit.ClassCache.locationsOf(ClassCache.java:136)
	at com.tngtech.archunit.junit.ClassCache.getLocationsOfPackages(ClassCache.java:103)
	at com.tngtech.archunit.junit.ClassCache.locationsToImport(ClassCache.java:91)
	at com.tngtech.archunit.junit.ClassCache.getClassesToAnalyzeFor(ClassCache.java:74)
	at com.tngtech.archunit.junit.ArchUnitRunner.runChild(ArchUnitRunner.java:133)
	at com.tngtech.archunit.junit.ArchUnitRunner.runChild(ArchUnitRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at com.tngtech.archunit.junit.ArchUnitRunner$1.evaluate(ArchUnitRunner.java:73)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NullPointerException: invalid url: file://C:%5CProgram%20Files%5CJava%5Cjdk1.8.0_112%5Cjre%5Clib%5Cresources.jar!/ (java.net.MalformedURLException: For input string: "%5CProgram%20Files%5CJava%5Cjdk1.8.0_112%5Cjre%5Clib%5Cresources.jar")
	at sun.net.www.protocol.jar.Handler.parseAbsoluteSpec(Handler.java:178)
	at sun.net.www.protocol.jar.Handler.parseURL(Handler.java:151)
	at java.net.URL.<init>(URL.java:622)
	... 28 common frames omitted

I'm running the tests on Windows.

Do these exception have any impact on the functionality of ArchUnit?

Btw. thanks a lot for this excellent tool!

@codecholeric
Copy link
Collaborator

Thanks for reporting this!! I saw this error, when a colleague started to develop recently ☹️
I testet 0.8.0 on Windows though, before I released it, and our big suite did run, so I don't think it affects the core functionality.
Since the tests did run in the past on Windows, I think this might have been added by #68 (which ironically fixed it on MacOS)
Too bad that the platforms always have to behave so differently...
I'll look into it, but as I said, I think typical use cases on Windows should work (if I have to change main code, I'll release a bug fix version though)

codecholeric added a commit that referenced this issue May 30, 2018
Issue: #73
Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
@codecholeric codecholeric self-assigned this May 30, 2018
@codecholeric
Copy link
Collaborator

I've tried to implement a fix on https://github.com/TNG/ArchUnit/tree/fix-windows-urls
Can you check, if that runs correctly in your environment?
I don't know under what circumstances exactly this would hit the current release, but the main code does seem like it's bugged under Windows under certain circumstances, so I will release a fixed version if this runs on your system, just in case.

@rweisleder
Copy link
Contributor

Relates to #58?

@simasch
Copy link
Author

simasch commented May 31, 2018

Looks good! No more warnings in the logfiles on Windows.

Thanks a lot!

@codecholeric
Copy link
Collaborator

That's good to hear 😃
As far as #58, the original problems I had fixed, the only thing left was that annoying random fail, because some folder couldn't be deleted on Windows sometimes, because it "was still in use" (I hate those problems on Windows) That was certainly no bug, but a test setup problem though.
But if this seems to be working now, I'll merge this, close this issue and release the bug fix...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants