db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Che Chen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-646) In-memory backend storage support
Date Tue, 17 Feb 2009 07:07:59 GMT

    [ https://issues.apache.org/jira/browse/DERBY-646?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674113#action_12674113

Cheng Che Chen commented on DERBY-646:

BTW, there appears to be a discrepancy between code in the constructor of (StorageFactoryService)
and documentation for StorageFactory.newStorageFile(String path).

In the constructor of (StorageFactoryService), there is this block of code:

     rootStorageFactory = getStorageFactoryInstance( true, null, null, null);
     if( home != null)
       StorageFile rootDir = rootStorageFactory.newStorageFile( null);

Now, according to the javadoc for StorageFactory.newStorageFile(String path), when the parameter
(path) is null, we should return the database directory.  But in the above code block, the
parameter representing the database directory passed into the initialization of the storage
factory, is null.

According to the documentation for StorageFactory.init(), when the database name parameter
is null, we will only work with the home directory.  So I believe the author of the above
code block intended (rootDir) to represent the home directory in this case (i.e., when the
database parameter is null).  This behavior, however, is not specified in the documentation
for StorageFactory.newStorageFile(String path).

I noticed this discrepancy during manual testing because I was getting (NullPointerException)
at the call to rootDir.mkdirs() with my storage factory implementation.  I worked around the
problem by having my implementation of newStorageFile(String path) return the home directory
when the internal database parameter is null, in the case when the input (path) parameter
is null.

In any event, there appears to be a discrepancy between code and documentation, unless I have
misinterpreted the code and/or the documentation.

> In-memory backend storage support
> ---------------------------------
>                 Key: DERBY-646
>                 URL: https://issues.apache.org/jira/browse/DERBY-646
>             Project: Derby
>          Issue Type: New Feature
>          Components: Store
>         Environment: All
>            Reporter: Stephen Fitch
>         Attachments: derby-646-1a-raw-compiles.diff, derby-646-1a-raw-compiles.stat,
> To allow creation and modification of databases in-memory without requiring disk access
or space to store the database.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message