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

FileNotFoundException with spaces in path to user profile #4589

Closed
Fleex255 opened this issue Feb 4, 2019 · 4 comments
Closed

FileNotFoundException with spaces in path to user profile #4589

Fleex255 opened this issue Feb 4, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@Fleex255
Copy link

Fleex255 commented Feb 4, 2019

Description

When the path to the current Windows user's profile folder contains a space (e.g. C:\Users\John Smith), trying to run Robolectric tests will fail:

java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\John%20Smith\.m2\repository\org\robolectric\android-all\9-robolectric-4913185-2\android-all-9-robolectric-4913185-2.jar (The system cannot find the path specified)

It appears that the path is being inappropriately URL-encoded, replacing spaces with %20. We have worked around the problem by creating a symbolic link from e.g. John%20Smith to John Smith, but this is obviously not ideal.

Possibly related to #2171.

Steps to Reproduce

  1. Log into Windows as a user whose profile folder name contains a space
  2. Run any Robolectric test suite in Android Studio

Robolectric & Android Version

Robolectric 4.1, Android API level 28, JUnit 4.12, Windows 10

Link to a public git repo demonstrating the problem:

The problem does not appear to be related to any specific Robolectric-based test suite.

@xian
Copy link
Member

xian commented Feb 4, 2019

@Fleex255 — can you provide a full stacktrace?

@xian xian added the defect label Feb 4, 2019
@Fleex255
Copy link
Author

Fleex255 commented Feb 4, 2019

Here it is:

java.lang.RuntimeException: java.io.FileNotFoundException: C:\Users\Space%20Test\.m2\repository\org\robolectric\android-all\9-robolectric-4913185-2\android-all-9-robolectric-4913185-2.jar (The system cannot find the path specified)

	at org.robolectric.res.Fs$JarFs.<init>(Fs.java:101)
	at org.robolectric.res.Fs.fromJar(Fs.java:27)
	at org.robolectric.internal.SdkEnvironment.createRuntimeSdkResourcePath(SdkEnvironment.java:43)
	at org.robolectric.internal.SdkEnvironment.getSystemResourceTable(SdkEnvironment.java:34)
	at org.robolectric.ApkLoader.getSystemResourceTable(ApkLoader.java:32)
	at org.robolectric.android.internal.ParallelUniverse.injectResourceStuffForLegacy(ParallelUniverse.java:252)
	at org.robolectric.android.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:126)
	at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:379)
	at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:252)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:130)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:42)
	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 org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:84)
	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.io.FileNotFoundException: C:\Users\Space%20Test\.m2\repository\org\robolectric\android-all\9-robolectric-4913185-2\android-all-9-robolectric-4913185-2.jar (The system cannot find the path specified)
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:219)
	at java.util.zip.ZipFile.<init>(ZipFile.java:149)
	at java.util.jar.JarFile.<init>(JarFile.java:166)
	at java.util.jar.JarFile.<init>(JarFile.java:130)
	at org.robolectric.res.Fs$JarFs.<init>(Fs.java:99)
	... 22 more

@xian xian self-assigned this Feb 11, 2019
@xian xian modified the milestones: 4.2, 4.2.1 Feb 11, 2019
@xian
Copy link
Member

xian commented Mar 12, 2019

Confirmed fixed in 4.2.1 (release forthcoming).

@xian xian closed this as completed Mar 12, 2019
@xian
Copy link
Member

xian commented Mar 15, 2019

4.2.1 is released: https://github.com/robolectric/robolectric/releases/tag/robolectric-4.2.1

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

2 participants