The following issue has been updated:

    Updater: Stephen McConnell (mailto:[EMAIL PROTECTED])
       Date: Sun, 25 Jul 2004 12:14 PM
    Changes:
             description changed from Curently if a file for deployment is included on 
the command line and the filename is incorrect, the error report throws a 
MalformedURLException when instead it should throw a FileNotFoundException.

The following replacement code for resolveURL in merlin/impl DefaultContext correct 
the problem.

    private URL resolveURL( File base, String value )
    {
        if( value.startsWith( "block:" ) )
        {
            return blockSpecToURL( value );
        }
        else if( value.startsWith( "artifact:" ) )
        {
            return artifactSpecToURL( value );
        }

        try
        {
            return new URL( value );
        }
        catch( Exception e )
        {
            File target = new File( value );
            if( target.exists() )
            {
                return toURL( target );
            }
            else
            {
                target = new File( base, value );
                if( target.exists() )
                {
                    return toURL( target );
                }
                else
                {
                    if( e instanceof MalformedURLException )
                    {
                        FileNotFoundException fnfe = new FileNotFoundException( value 
);
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, fnfe );
                    }
                    else
                    {
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, e );
                    }
                }
            }
        }
    }
 to Curently if a file for deployment is included on the command line and the filename 
is incorrect, the error report throws a MalformedURLException when instead it should 
throw a FileNotFoundException.

The following replacement code for resolveURL in merlin/impl DefaultCriteria correct 
the problem.

    private URL resolveURL( File base, String value )
    {
        if( value.startsWith( "block:" ) )
        {
            return blockSpecToURL( value );
        }
        else if( value.startsWith( "artifact:" ) )
        {
            return artifactSpecToURL( value );
        }

        try
        {
            return new URL( value );
        }
        catch( Exception e )
        {
            File target = new File( value );
            if( target.exists() )
            {
                return toURL( target );
            }
            else
            {
                target = new File( base, value );
                if( target.exists() )
                {
                    return toURL( target );
                }
                else
                {
                    if( e instanceof MalformedURLException )
                    {
                        FileNotFoundException fnfe = new FileNotFoundException( value 
);
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, fnfe );
                    }
                    else
                    {
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, e );
                    }
                }
            }
        }
    }

    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/RUNTIME-48?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/RUNTIME-48

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: RUNTIME-48
    Summary: Bad error report when supplied block is file that does not exist
       Type: Improvement

     Status: Open
   Priority: Minor

    Project: Merlin Runtime
 Components: 
             CORE
   Fix Fors:
             3.4.0
   Versions:
             3.3.0

   Assignee: Stephen McConnell
   Reporter: Stephen McConnell

    Created: Sun, 25 Jul 2004 12:12 PM
    Updated: Sun, 25 Jul 2004 12:14 PM

Description:
Curently if a file for deployment is included on the command line and the filename is 
incorrect, the error report throws a MalformedURLException when instead it should 
throw a FileNotFoundException.

The following replacement code for resolveURL in merlin/impl DefaultCriteria correct 
the problem.

    private URL resolveURL( File base, String value )
    {
        if( value.startsWith( "block:" ) )
        {
            return blockSpecToURL( value );
        }
        else if( value.startsWith( "artifact:" ) )
        {
            return artifactSpecToURL( value );
        }

        try
        {
            return new URL( value );
        }
        catch( Exception e )
        {
            File target = new File( value );
            if( target.exists() )
            {
                return toURL( target );
            }
            else
            {
                target = new File( base, value );
                if( target.exists() )
                {
                    return toURL( target );
                }
                else
                {
                    if( e instanceof MalformedURLException )
                    {
                        FileNotFoundException fnfe = new FileNotFoundException( value 
);
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, fnfe );
                    }
                    else
                    {
                        final String error = 
                          "Unable to resolve the block path [" + value + "].";
                        throw new KernelRuntimeException( error, e );
                    }
                }
            }
        }
    }



---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to