Repository: cucumber/cucumber-jvm

Issue #1632: Error parsing feature file from jar when there is a space in path
Created: 2019-05-20T15:15:28Z
Summary
Error parsing feature file from jar when there is a space in path

Expected Behavior
File is parsed



Current Behavior



Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in opaque part at index 17: 
classpath:Example path/Feature.feature
	at java.net.URI.create(URI.java:852)
	at cucumber.runtime.io.ZipResource.getPath(ZipResource.java:22)
	at cucumber.runtime.model.FeatureParser.parseResource(FeatureParser.java:30)
	at cucumber.runtime.model.FeatureBuilder.parse(FeatureBuilder.java:25)
	at cucumber.runtime.model.FeatureLoader.loadFromFeaturePath(FeatureLoader.java:36)
	at cucumber.runtime.model.FeatureLoader.load(FeatureLoader.java:23)
	at cucumber.runtime.FeaturePathFeatureSupplier.get(FeaturePathFeatureSupplier.java:33)
	at cucumber.runtime.Runtime.run(Runtime.java:67)
	at cucumber.api.cli.Main.run(Main.java:26)
	at cucumber.api.cli.Main.main(Main.java:8)

Possible Solution
URI encode the path or just replace spaces with %20
Steps to Reproduce (for bugs)

Duplicate issue #1849: "Illegal character" error on Windows in Resources.java for backslash symbols in URI.create
Created: 2019-12-27T11:11:08Z
Feature files resources scan fails with exception "Illegal character" on Windows in Resources.java because "URI.create" don't support backslash symbols.
As a result JUnit don't see any feature file to execute.
Call stack:
Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID 'cucumber' failed to discover tests
	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:189)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:168)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.IllegalArgumentException: Illegal character in opaque part at index 18: classpath:features\Complete\AllL1PostProcessors\AdpPostProcessorL1\l1_adp_post_processor_stock_break_sod.feature
	at java.net.URI.create(URI.java:852)
	at io.cucumber.core.resource.Resources$ClasspathResource.<init>(Resources.java:41)
	at java.util.function.BiFunction.lambda$andThen$0(BiFunction.java:70)
	at io.cucumber.core.resource.ResourceScanner.lambda$null$2(ResourceScanner.java:128)
	at io.cucumber.core.resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:67)
	at io.cucumber.core.resource.PathScanner$ResourceFileVisitor.visitFile(PathScanner.java:52)
	at java.nio.file.Files.walkFileTree(Files.java:2670)
	at java.nio.file.Files.walkFileTree(Files.java:2742)
	at io.cucumber.core.resource.PathScanner.findResourcesForPath(PathScanner.java:46)
	at io.cucumber.core.resource.PathScanner.findResourcesForUri(PathScanner.java:26)
	at io.cucumber.core.resource.ResourceScanner.findResourcesForUri(ResourceScanner.java:111)
	at io.cucumber.core.resource.ResourceScanner.scanForResourcesInClasspathRoot(ResourceScanner.java:50)
	at io.cucumber.junit.platform.engine.FeatureResolver.resolveClasspathRoot(FeatureResolver.java:118)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at io.cucumber.junit.platform.engine.DiscoverySelectorResolver.resolve(DiscoverySelectorResolver.java:37)
	at io.cucumber.junit.platform.engine.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:24)
	at io.cucumber.junit.platform.engine.CucumberTestEngine.discover(CucumberTestEngine.java:26)
	at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:181)
	... 6 more
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 18: classpath:features\Complete\AllL1PostProcessors\AdpPostProcessorL1\l1_adp_post_processor_stock_break_sod.feature
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.parse(URI.java:3058)
	at java.net.URI.<init>(URI.java:588)
	at java.net.URI.create(URI.java:850)
	... 23 more`

To Reproduce
Steps to reproduce the behavior:
Reproduced this by running in intellij idea:

Right click root project item.
Select menu: Run\All Tests.
Wait for execution to finish.

Expected behavior
feature files to be successfully detected and run
Context & Motivation
Unable to run cucumber 5 tests with maven and JUnit 5 by "cucumber-junit-platform-engine".
Screenshots
If applicable, add screenshots to help explain your problem.
Your Environment

Versions: 5.0.0-RC2
Operating System: Windows 7
Build tool IDEA

Closing comment (2019-12-27T11:17:12Z): could be related to #1632