You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Michael Bolz (JIRA)" <ji...@apache.org> on 2014/04/10 14:27:15 UTC
[jira] [Commented] (OLINGO-239) ClassHelper doesn't find classes
when there's a space in the path
[ https://issues.apache.org/jira/browse/OLINGO-239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13965290#comment-13965290 ]
Michael Bolz commented on OLINGO-239:
-------------------------------------
Hi Gerben,
I started to check this issue but in current and {{1.2.0}} version I can not find the mentioned problem.
In the [ClassHelper|https://git-wip-us.apache.org/repos/asf?p=olingo-odata2.git;a=blob;f=odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java;h=22ba73c858b2b639e539ca887918e13c4796a468;hb=df769309acae25ce1f525152c3ffdbda8094a516] following code in method {{loadClasses}} (line 65ff) is used to get the path:
{{File folder = new File(url.getFile());}}
Which work with spaces in the path.
Can you please check which version are you using.
Kind regards,
Michael
>From [ClassHelper|https://git-wip-us.apache.org/repos/asf?p=olingo-odata2.git;a=blob;f=odata2-annotation-processor/annotation-processor-core/src/main/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelper.java;h=22ba73c858b2b639e539ca887918e13c4796a468;hb=df769309acae25ce1f525152c3ffdbda8094a516] line *74-82*:
{code}
final Collection<String> fqnForClasses;
File folder = new File(url.getFile());
if (folder.isDirectory()) {
fqnForClasses = getClassFqnFromDir(ff, folder, packageToScan);
} else if (isJarFile(url)) {
fqnForClasses = getClassFqnFromJar(url.getFile().substring(5), packageToScan);
} else {
fqnForClasses = null;
}
{code}
> ClassHelper doesn't find classes when there's a space in the path
> -----------------------------------------------------------------
>
> Key: OLINGO-239
> URL: https://issues.apache.org/jira/browse/OLINGO-239
> Project: Olingo
> Issue Type: Bug
> Components: odata2-annotation
> Affects Versions: V2 1.2.0
> Reporter: Gerben Kegel
> Assignee: Michael Bolz
> Priority: Trivial
>
> When you have space in your path and ask the ClassHelper to loadClasses(...), it doesn't find anything. The problem is because an URL class is used where the space converted to a %20. This URL does not point to a file anymore.
> Please call the following function (using .toUri().getPath()) to fill fqnForClasses in line 71.
> {{
> private static Collection<String> getFqnForClasses(String packageToScan, URL url, FilenameFilter ff) {
> try {
> File folder = new File(url.toURI().getPath());
> if (folder.isDirectory()) {
> return getClassFqnFromDir(ff, folder, packageToScan);
> } else if (isJarFile(url)) {
> return getClassFqnFromJar(url.getFile().substring(5), packageToScan);
> }
> } catch (URISyntaxException ex) {
> }
> return null;
> }
> }}
> Thank you
--
This message was sent by Atlassian JIRA
(v6.2#6252)