Wednesday, February 6, 2019

Robolectric doesn't like spaces in the path to the user profile

Some students were trying to run our Robolectric tests, but found that they crashed with a FileNotFoundException:

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 looks like a path to some kind of cache folder is getting URL-encoded, which turns spaces into %20, making the path wrong. Therefore, users with spaces in their user profile folder name are unable to run Robolectric tests.

For now, we're working around it by creating symbolic links (mklink /d) in C:\Users from the mangled name to the real one.

No comments:

Post a Comment