You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Fiona Mahon <fm...@tssg.org> on 2009/06/12 11:15:04 UTC

Felix File Install - Spaces in watched directory name

Just in terms of the issue with the spaces, Guido suggested I put quotes 
around the directory. However this causes the system to go into an 
endless loop!

Behaviour is as follows:
When I define felix.fileinstall.dir=watchedDir (i.e. without quotes), 
and when 'watchedDir' actually resolves to E:\Documents and 
Settings\some\path\watchedDir, then I get the following error when I 
drop a bundle into that directory:

ERROR    20090612 10:01:28 bid#11       - Failed to install bundle: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar 
(java.net.URISyntaxException: Illegal character in path at index 13: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar)
java.net.URISyntaxException: Illegal character in path at index 13: 
/E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.checkChars(Unknown Source)
        at java.net.URI$Parser.parseHierarchical(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        at org.apache.felix.fileinstall.Jar.<init>(Jar.java:58)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
r.java:686)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
r.java:587)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWa
tcher.java:351)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:121)

When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
around the directory) I get the endless loop, when I start up the 
container. here's a bit of the output:
ERROR    20090612 10:08:33 bid#11       - In main loop, we have serious 
trouble
(java.lang.NullPointerException)
java.lang.NullPointerException
        at 
org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
er.java:439)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:120)
ERROR    20090612 10:08:33 bid#11       - In main loop, we have serious 
trouble
(java.lang.NullPointerException)
java.lang.NullPointerException
        at 
org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
er.java:439)
        at 
org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
va:120)

(this is an endless loop of output)

If I do the same things in a directory that doesn't contain spaces i.e. 
if I move the whole set up to directly under the E: directory, this 
doesn't happen.

This is actually an issue since I can't guarantee that anyone else who 
will checkout and use this code will not be also on Windows and in their 
home directory (i.e. C:/Documents and Settings/${username}. Really it 
becomes useless to me as a project solution.

Thanks,
Fiona.
 
Fiona Mahon wrote:
> Beautiful! Works a treat now.
> Thanks Filippo and Guido
>
> Just a couple of things to watch for:
> - as you said Filippo, I had to define "felix.fileinstall.dir" as the 
> full path from where I started Knopflerfish and not from where the 
> config file was located i.e. 
> felix.fileinstall.dir=watchedDir/watchedSubDir
> - also seems to have problems with spaces in the filenames. I'm 
> running on windows and when the FileInstall resolves the location of 
> the config files as E:/Documents and Settings/<some path> it throws an 
> error. If I put Knopflerfish directly under E:/ all is ok! I'm not 
> specifying this path in any file, it is just resolved to that by the 
> bundle.
>
> Thanks again,
> Fiona.
>
>
> Filippo Diotalevi wrote:
>> On Thu, Jun 11, 2009 at 9:42 AM, Guido Spadotto<gs...@soluta.net> 
>> wrote:
>>  
>>> Hi Filippo,
>>> I've had a quick look at the Compendium R4, V4.1.
>>> On Section 104.4.2 it reads:
>>>
>>> /The value of the property may be of the following types:
>>> type ::= simple | vector | arrays
>>> simple ::= String | Integer | Long | Float | Double| Byte | Short |
>>> Character | Boolean
>>> primitive ::= long | int | short | char | byte | double | float | 
>>> boolean
>>> arrays ::= primitive ‘[]’ | simple ‘[]’
>>> vector ::= Vector of simple
>>> /
>>> So, apart from this particular case with KF-specific properties, it 
>>> might
>>> still
>>> be worth to be aware of 'simple' (not 'primitive') property types in 
>>> the
>>> Configuration Dictionary.
>>>     
>>
>> Hi,
>>   so I was able to reproduce easily the problem with Knopflerfish, and
>> submitted a patch for that at
>> https://issues.apache.org/jira/browse/FELIX-1216
>>
>> As for the original Fiona's email, I hope the patch fixes her bug too,
>> since the file she was referring to (props.xargs file) is indeed a
>> Knopflerfish file.
>>
>>
>>   
>
>


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Fiona Mahon <fm...@tssg.org>.
Hi Sahoo,

I can verify that this works. Thanks,
Fiona.

Sahoo wrote:
> Guido Spadotto wrote:
>> Sahoo wrote:
>>> I think I have a solution for the URISyntaxError. Can you please 
>>> file a bug and I shall upload a patch for the same?
>> There it is:
>> https://issues.apache.org/jira/browse/FELIX-1228
> Second reminder to verify the patch and update the issue.
>
> Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


-- 
Fiona Mahon
Pervasive Communication Services(PCS),
Applied Research

Telecommunications Software & Systems Group (TSSG),
ArcLabs Research and Innovation Building,
Waterford Institute of Technology,
Carriganore Campus, Carriganore,
Co. Waterford, Ireland
	
www: www.tssg.org/people/fmahon
tel: +353 (0)51 302 928   
fax: +353 (0)51 341 100  
e-mail: fmahon@tssg.org
Skype: fiona_mahon




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Guido Spadotto wrote:
> Sahoo wrote:
>> I think I have a solution for the URISyntaxError. Can you please file 
>> a bug and I shall upload a patch for the same?
> There it is:
> https://issues.apache.org/jira/browse/FELIX-1228
Second reminder to verify the patch and update the issue.

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> I think I have a solution for the URISyntaxError. Can you please file 
> a bug and I shall upload a patch for the same?
There it is:
https://issues.apache.org/jira/browse/FELIX-1228
-- 
Logo
Guido Spadotto
Soluta.net, Italy
http://www.soluta.net



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> Yes, the suggested fix definitely avoids the NPE, but that essentially 
> masks the configuration problem. So, I am not sure if that's the right 
> behavior. Instead, we should be checking if watchedDirectory exists or 
> not. So, we should replace:
>
>        this.watchedDirectory.mkdirs();
>
> by
>
>        if(!this.watchedDirectory.mkdirs()) { throw new 
> Exception("Faild to create " + watchedDirectory.getAbsolutePath());}
>
> in DirectoryWatcher's constructor.
>
> I suggest we separate this issue from 1228 to keep things clean.
>
> Thanks,
> Sahoo

I've created http://issues.apache.org/jira/browse/FELIX-1235
which contains a couple of suggestions.

Thank you
-- 
Guido Spadotto

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Guido Spadotto wrote:
> Sahoo wrote:
>> Fiona,
>>
>> I think I have a solution for the URISyntaxError. Can you please file 
>> a bug and I shall upload a patch for the same?
>>
>> Thanks,
>> Sahoo
>>
>> Fiona Mahon wrote:
>>> [...]
>>>
>>> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
>>> around the directory) I get the endless loop, when I start up the 
>>> container. here's a bit of the output:
>>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>>> serious trouble
>>> (java.lang.NullPointerException)
>>> java.lang.NullPointerException
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>>> er.java:439)
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>>> va:120)
>>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>>> serious trouble
>>> (java.lang.NullPointerException)
>>> java.lang.NullPointerException
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>>> er.java:439)
>>>        at 
>>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>>> va:120)
>>>
>>> (this is an endless loop of output)
>>>
>
> Hi Sahoo, I was able to reproduce the "looping NullPointerException" 
> scenario above.
>
> I've taken a look at the code and I think that this is due to these 
> lines in DirectoryWatcher:
>
> void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
>    {
>        String list[] = jardir.list();
>        for (int i = 0; i < list.length; i++)
>
> which, IMHO, should become:
>
> void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
>    {
>        String list[] = jardir.list();
>        for (int i = 0; (list!=null) && (i < list.length); i++)
>
> jardir.list() will return null if the jardir File object is not
> associated to a Directory (see [1]).
>
> [1]: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list()
>
Yes, the suggested fix definitely avoids the NPE, but that essentially 
masks the configuration problem. So, I am not sure if that's the right 
behavior. Instead, we should be checking if watchedDirectory exists or 
not. So, we should replace:

        this.watchedDirectory.mkdirs();

by

        if(!this.watchedDirectory.mkdirs()) { throw new Exception("Faild 
to create " + watchedDirectory.getAbsolutePath());}

in DirectoryWatcher's constructor.

I suggest we separate this issue from 1228 to keep things clean.

Thanks,
Sahoo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Guido Spadotto <gs...@soluta.net>.
Sahoo wrote:
> Fiona,
>
> I think I have a solution for the URISyntaxError. Can you please file 
> a bug and I shall upload a patch for the same?
>
> Thanks,
> Sahoo
>
> Fiona Mahon wrote:
>> [...]
>>
>> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
>> around the directory) I get the endless loop, when I start up the 
>> container. here's a bit of the output:
>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>> serious trouble
>> (java.lang.NullPointerException)
>> java.lang.NullPointerException
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>> er.java:439)
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>> va:120)
>> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
>> serious trouble
>> (java.lang.NullPointerException)
>> java.lang.NullPointerException
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
>> er.java:439)
>>        at 
>> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
>> va:120)
>>
>> (this is an endless loop of output)
>>

Hi Sahoo, I was able to reproduce the "looping NullPointerException" 
scenario above.

I've taken a look at the code and I think that this is due to these 
lines in DirectoryWatcher:

void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
    {
        String list[] = jardir.list();
        for (int i = 0; i < list.length; i++)

which, IMHO, should become:

void traverse(Map/* <String, Jar> */ jars, Set configs, File jardir)
    {
        String list[] = jardir.list();
        for (int i = 0; (list!=null) && (i < list.length); i++)

jardir.list() will return null if the jardir File object is not
associated to a Directory (see [1]).

[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#list()

-- 
Guido

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Felix File Install - Spaces in watched directory name

Posted by Sahoo <Sa...@Sun.COM>.
Fiona,

I think I have a solution for the URISyntaxError. Can you please file a 
bug and I shall upload a patch for the same?

Thanks,
Sahoo

Fiona Mahon wrote:
> Just in terms of the issue with the spaces, Guido suggested I put 
> quotes around the directory. However this causes the system to go into 
> an endless loop!
>
> Behaviour is as follows:
> When I define felix.fileinstall.dir=watchedDir (i.e. without quotes), 
> and when 'watchedDir' actually resolves to E:\Documents and 
> Settings\some\path\watchedDir, then I get the following error when I 
> drop a bundle into that directory:
>
> ERROR    20090612 10:01:28 bid#11       - Failed to install bundle: 
> /E:/Documents and 
> Settings/some/path/watchedDir/print-service-0.0.2.jar 
> (java.net.URISyntaxException: Illegal character in path at index 13: 
> /E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar)
> java.net.URISyntaxException: Illegal character in path at index 13: 
> /E:/Documents and Settings/some/path/watchedDir/print-service-0.0.2.jar
>        at java.net.URI$Parser.fail(Unknown Source)
>        at java.net.URI$Parser.checkChars(Unknown Source)
>        at java.net.URI$Parser.parseHierarchical(Unknown Source)
>        at java.net.URI$Parser.parse(Unknown Source)
>        at java.net.URI.<init>(Unknown Source)
>        at org.apache.felix.fileinstall.Jar.<init>(Jar.java:58)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
> r.java:686)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.install(DirectoryWatche
> r.java:587)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.doInstalled(DirectoryWa
> tcher.java:351)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:121)
>
> When I define felix.fileinstall.dir="watchedDir" (i.e. with quotes 
> around the directory) I get the endless loop, when I start up the 
> container. here's a bit of the output:
> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
> serious trouble
> (java.lang.NullPointerException)
> java.lang.NullPointerException
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
> er.java:439)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:120)
> ERROR    20090612 10:08:33 bid#11       - In main loop, we have 
> serious trouble
> (java.lang.NullPointerException)
> java.lang.NullPointerException
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.traverse(DirectoryWatch
> er.java:439)
>        at 
> org.apache.felix.fileinstall.DirectoryWatcher.run(DirectoryWatcher.ja
> va:120)
>
> (this is an endless loop of output)
>
> If I do the same things in a directory that doesn't contain spaces 
> i.e. if I move the whole set up to directly under the E: directory, 
> this doesn't happen.
>
> This is actually an issue since I can't guarantee that anyone else who 
> will checkout and use this code will not be also on Windows and in 
> their home directory (i.e. C:/Documents and Settings/${username}. 
> Really it becomes useless to me as a project solution.
>
> Thanks,
> Fiona.
>
> Fiona Mahon wrote:
>> Beautiful! Works a treat now.
>> Thanks Filippo and Guido
>>
>> Just a couple of things to watch for:
>> - as you said Filippo, I had to define "felix.fileinstall.dir" as the 
>> full path from where I started Knopflerfish and not from where the 
>> config file was located i.e. 
>> felix.fileinstall.dir=watchedDir/watchedSubDir
>> - also seems to have problems with spaces in the filenames. I'm 
>> running on windows and when the FileInstall resolves the location of 
>> the config files as E:/Documents and Settings/<some path> it throws 
>> an error. If I put Knopflerfish directly under E:/ all is ok! I'm not 
>> specifying this path in any file, it is just resolved to that by the 
>> bundle.
>>
>> Thanks again,
>> Fiona.
>>
>>
>> Filippo Diotalevi wrote:
>>> On Thu, Jun 11, 2009 at 9:42 AM, Guido 
>>> Spadotto<gs...@soluta.net> wrote:
>>>  
>>>> Hi Filippo,
>>>> I've had a quick look at the Compendium R4, V4.1.
>>>> On Section 104.4.2 it reads:
>>>>
>>>> /The value of the property may be of the following types:
>>>> type ::= simple | vector | arrays
>>>> simple ::= String | Integer | Long | Float | Double| Byte | Short |
>>>> Character | Boolean
>>>> primitive ::= long | int | short | char | byte | double | float | 
>>>> boolean
>>>> arrays ::= primitive ‘[]’ | simple ‘[]’
>>>> vector ::= Vector of simple
>>>> /
>>>> So, apart from this particular case with KF-specific properties, it 
>>>> might
>>>> still
>>>> be worth to be aware of 'simple' (not 'primitive') property types 
>>>> in the
>>>> Configuration Dictionary.
>>>>     
>>>
>>> Hi,
>>>   so I was able to reproduce easily the problem with Knopflerfish, and
>>> submitted a patch for that at
>>> https://issues.apache.org/jira/browse/FELIX-1216
>>>
>>> As for the original Fiona's email, I hope the patch fixes her bug too,
>>> since the file she was referring to (props.xargs file) is indeed a
>>> Knopflerfish file.
>>>
>>>
>>>   
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org