You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Mark Slater (JIRA)" <ji...@apache.org> on 2006/02/26 22:59:13 UTC

[jira] Created: (JCR-328) TransitoryRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

TransitoryRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
----------------------------------------------------------------------------------------------------

         Key: JCR-328
         URL: http://issues.apache.org/jira/browse/JCR-328
     Project: Jackrabbit
        Type: Bug
  Components: core  
    Reporter: Mark Slater


I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:

    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
        <param name="path" value="${rep.home}/repository"/>
    </FileSystem>

I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.

I'm not sure what the best solution is, but some thoughts I've had are:
- don't set the "root" property to null when closing a LocalFileSystem
- make RepositoryConfig re-init the FileSystem variable when it is accessed.
- don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (JCR-328) TransitoryRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-328?page=all ]

Stefan Guggisberg reassigned JCR-328:
-------------------------------------

    Assign To: Stefan Guggisberg

> TransitoryRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ----------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Reporter: Mark Slater
>     Assignee: Stefan Guggisberg

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-328) TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-328?page=comments#action_12371069 ] 

Jukka Zitting commented on JCR-328:
-----------------------------------

> There's a syntax error on the example code's return line.

Good catch, thanks!

Is there interest to have the TransientRepository(RepositoryConfig) constructor back? Now that JCR-331 is resolved, there should be no problem restoring the constructor.

> TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ---------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Versions: 0.9
>     Reporter: Mark Slater
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-328) TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-328?page=all ]

Jukka Zitting updated JCR-328:
------------------------------

        Summary: TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'  (was: TransitoryRepository with LocalFileSystem eventually causes Repository data to be stored at path '/')
    Fix Version: 1.0
        Version: 0.9
      Assign To: Jukka Zitting  (was: Stefan Guggisberg)

> TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ---------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Versions: 0.9
>     Reporter: Mark Slater
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-328) TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Mark Slater (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-328?page=comments#action_12371151 ] 

Mark Slater commented on JCR-328:
---------------------------------

Sure. That would make my JUnit code somewhat cleaner.

> TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ---------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Versions: 0.9
>     Reporter: Mark Slater
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-328) TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Mark Slater (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-328?page=comments#action_12371068 ] 

Mark Slater commented on JCR-328:
---------------------------------

There's a syntax error on the example code's return line. The code should read:

final RepositoryConfig config = ...; 
    Repository repository = new TransientRepository( 
        new TransientRepository.RepositoryFactory() { 
            public RepositoryImpl getRepository() throws RepositoryException { 
                return RepositoryImpl.create(config); 
            } 
        });



> TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ---------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Versions: 0.9
>     Reporter: Mark Slater
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JCR-328) TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-328?page=all ]
     
Jukka Zitting resolved JCR-328:
-------------------------------

    Resolution: Fixed

Fixed by removing the TransientRepository(RepositoryConfig) constructor in revision 382213.

It is possible to implement the removed functionality in client code like this:

    final RepositoryConfig config = ...;
    Repository repository = new TransientRepository(
        new TransientRepository.RepositoryFactory() {
            public RepositoryImpl getRepository() throws RepositoryException {
                return new RepositoryImpl.create(config);
            }
        });

This should only be done when the mentioned problem in the file system configuration is fixed. A separate issue should be opened for that if anyone needs such functionality.

> TransientRepository with LocalFileSystem eventually causes Repository data to be stored at path '/'
> ---------------------------------------------------------------------------------------------------
>
>          Key: JCR-328
>          URL: http://issues.apache.org/jira/browse/JCR-328
>      Project: Jackrabbit
>         Type: Bug
>   Components: core
>     Versions: 0.9
>     Reporter: Mark Slater
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> I'm using a TransitoryRepository for my unit testing, with the repository's file system specified as:
>     <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
> I noticed today that when I run my unit tests Jackrabbit is creating four directories at the root of my hard drive: "meta", "namespaces", "nodetypes", and "data". I tracked the problem the fact that when a LocalFileSystem is closed, it sets the "root" to null - an invalid state. But when using a TransitoryRepository, the invalid state is never discovered because the LocalFileSystem object itself is not released, or re-initialized. It is simply used to create BasedFileSystem objects in RepositoryImpl. Calls to BasedFileSystem defer to the LocalFileSystem object that now has a null root. Inside the LocalFileSystem, all the calls to Java's io.File constructor have a "null" parent parameter, causing File to fall back to its single argument constructor which sees the path "/meta" and happily creates files at the root of the disk.
> I'm not sure what the best solution is, but some thoughts I've had are:
> - don't set the "root" property to null when closing a LocalFileSystem
> - make RepositoryConfig re-init the FileSystem variable when it is accessed.
> - don't cache the RepositoryConfig in TransitoryRepository (this might also require a new constructor that takes a class-path resource for the repository configuration file)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira