Skip to content

Commit

Permalink
Use forward-slash instead of File.separator for resource URLs
Browse files Browse the repository at this point in the history
Previously, we were calling getClassLoader().getResource(String) with a
path that used File.separator. Since getResource expects a URL, this is
incorrect, and, unfortunately, fails on Windows, where File.separator
incidentally isn't a forward slash.

Fix the code to always use a forward slash here.
  • Loading branch information
kohlschuetter authored and slachiewicz committed Jul 16, 2023
1 parent 9a632cb commit c583759
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void initiate()

public static MavenProject createProjectForITExample( String exampleName )
{
String load = exampleName + File.separator + "pom.xml";
String load = exampleName + '/' + "pom.xml";
URL pomUrl = MavenProjectStub.class.getClassLoader().getResource( load );
assert pomUrl != null : "Could not load: " + load;
String pomPath = pomUrl.getPath();
Expand Down

0 comments on commit c583759

Please # to comment.