You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dag H. Wanvik (JIRA)" <ji...@apache.org> on 2014/01/30 20:24:09 UTC

[jira] [Comment Edited] (DERBY-6462) Documentation should mention that the database name (including its resolved path) cannot contain a colon

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

Dag H. Wanvik edited comment on DERBY-6462 at 1/30/14 7:23 PM:
---------------------------------------------------------------

Here is one place where it breaks down in the code.
{quote}
{color:blue}
{{StorageFactoryService:
    :
    public String getCanonicalServiceName(String name)
        throws StandardException
    {
        int colon = name.indexOf( ':');
        // If no subsubprotocol is specified and the storage factory type isn't
        // the default one, abort. We have to deal with Windows drive
        // specifications here, which contain a colon (i.e. 'C:').
        // The logic in this method may break in some cases if a colon is used
        // in the directory or database name.
        if (colon < 2 && !getType().equals(PersistentService.DIRECTORY)) {
            return null;
        }
        if( colon > 1) // Subsubprotocols must be at least 2 characters long
        {
            if( ! name.startsWith(getType() + ":"))
                return null; // It is not our database   <---- my example test exitted here
      :}}
{color}
{quote}
Notice the comment warning "may break down..." ;-)
Notice that Windows "C:" is handled explicitly (case of colon == 1), although it would allow a colon as a first character in a Unix path: "/:foo/..." as well since the code isn't restricted to a Windows environment.



was (Author: dagw):
Here is one place where it breaks down in the code.
{quote}
{monospaced}
{color:blue}
StorageFactoryService:
    :
    public String getCanonicalServiceName(String name)
        throws StandardException
    {
        int colon = name.indexOf( ':');
        // If no subsubprotocol is specified and the storage factory type isn't
        // the default one, abort. We have to deal with Windows drive
        // specifications here, which contain a colon (i.e. 'C:').
        // The logic in this method may break in some cases if a colon is used
        // in the directory or database name.
        if (colon < 2 && !getType().equals(PersistentService.DIRECTORY)) {
            return null;
        }
        if( colon > 1) // Subsubprotocols must be at least 2 characters long
        {
            if( ! name.startsWith(getType() + ":"))
                return null; // It is not our database   <---- my example test exitted here
      :
{color}
{monospaced}
{quote}
Notice the comment warning "may break down..." ;-)
Notice that Windows "C:" is handled explicitly (case of colon == 1), although it would allow a colon as a first character in a Unix path: "/:foo/..." as well since the code isn't restricted to a Windows environment.


> Documentation should mention that the database name (including its resolved path) cannot contain a colon
> --------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-6462
>                 URL: https://issues.apache.org/jira/browse/DERBY-6462
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>            Reporter: Dag H. Wanvik
>
> Except for initial Windows drive letters (e.g. K:/derby), colons break Derby.
> Windows can't have colons in directory of file names, so this is a Unix issue.
> [http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#file_and_directory_names]



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)