Uploaded image for project: 'Avalon Merlin Runtime'
  1. Avalon Merlin Runtime
  2. RUNTIME-48

Bad error report when supplied block is file that does not exist

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.3.0
    • 3.4.0
    • CORE
    • None

    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 ); }

      }
      }
      }
      }

      Attachments

        Activity

          People

            mcconnell Stephen McConnell
            mcconnell Stephen McConnell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: