Skip to content

Fix issue when the project path contains whitespaces #60

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/java/com/jparams/verifier/tostring/PackageScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -44,7 +45,7 @@ public static List<Class<?>> findClasses(final String packageName, final boolean

while (resources.hasMoreElements())
{
final File directory = new File(resources.nextElement().getFile());
final File directory = new File(getResourcePath(resources.nextElement()));
rootDirectories.add(directory);
}

Expand All @@ -54,6 +55,16 @@ public static List<Class<?>> findClasses(final String packageName, final boolean
.collect(Collectors.toList());
}

private static String getResourcePath(URL r) {
try
{
return r.toURI().getPath();
} catch (URISyntaxException e)
{
throw new PackageScanException(e);
}
}

private static List<Class<?>> findClasses(final File rootDirectory, final String packageName, final boolean recursively)
{
final File[] files;
Expand Down