Crash on first creation of association when spaces in path

Issue #458 resolved
Matthias Schoettle created an issue

If TouchCORE is run from a path that contains spaces (or any other special characters I assume), upon attempting to load the Association Concern on association creation, an exception occurs:

[...]
Caused by: java.nio.file.FileSystemNotFoundException: /<pathToExecutable>/tool%20test/TouchCORE.jar
    at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:120)
    at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:139)
    at java.nio.file.FileSystems.newFileSystem(FileSystems.java:390)
    at ca.mcgill.sel.commons.FileManagerUtil.visitJar(FileManagerUtil.java:85)
    at ca.mcgill.sel.commons.FileManagerUtil.copyDirectoryFromJar(FileManagerUtil.java:65)
    at ca.mcgill.sel.commons.FileManagerUtil.copyDirectory(FileManagerUtil.java:45)
    at ca.mcgill.sel.core.util.COREModelUtil.getLocalConcern(COREModelUtil.java:102)
    at ca.mcgill.sel.ram.controller.AssociationController.createFeatureSelection(AssociationController.java:118)
[...]

Not sure if it also happens from the development environment.

It looks like the URI or URL of the code/binary location is encoded, which causes problems when FileSystem fs = FileSystems.newFileSystem(jarPath, null) is called.

Comments (2)

  1. Matthias Schoettle reporter

    This causes problems in Windows, because URI.createURI cannot handle the file separator used in Windows (back slash), causing a non-hierarchical URI to be detected.

    For some reason, the association concern location passed in contains the file: scheme at the beginning. I suspect this is because the full path contains a "query/location" within the JAR file. URI.createFileURI cannot be used because it cannot handle the scheme at the beginning.

    Therefore, the only solution I can think of is to convert the file path in order to only use the / separator, which allows the use of URI.createURI (which then provides a proper file string and is decoded at the same time).

  2. Log in to comment