You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by jr...@apache.org on 2003/02/04 17:53:59 UTC

cvs commit: jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/containers/ant GenericAntProvider.java

jruaux      2003/02/04 08:53:58

  Modified:    integration/eclipse/src/java/org/apache/cactus/eclipse/containers/ant
                        GenericAntProvider.java
  Log:
  Better error handling (null pointer exception for non-existing resources)
  
  Revision  Changes    Path
  1.2       +19 -12    jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/containers/ant/GenericAntProvider.java
  
  Index: GenericAntProvider.java
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/containers/ant/GenericAntProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GenericAntProvider.java	3 Feb 2003 10:52:44 -0000	1.1
  +++ GenericAntProvider.java	4 Feb 2003 16:53:58 -0000	1.2
  @@ -109,6 +109,10 @@
       private ContainerHome[] containerHomes;
   
       /**
  +     * Plug-in relative path to the Ant build file.
  +     */
  +    private String buildFilePath = "./ant/build.xml";
  +    /**
        * Constructor.
        * @param thePort the port that will be used when setting up the container
        * @param theTargetDir the directory to be used for container configuration
  @@ -123,17 +127,17 @@
       {
           if (thePort <= 0)
           {
  -            CactusPlugin.throwCoreException(
  +            throw CactusPlugin.createCoreException(
                   "CactusLaunch.message.invalidproperty.port", null);
           }
           if (theTargetDir.equalsIgnoreCase(""))
           {
  -            CactusPlugin.throwCoreException(
  +            throw CactusPlugin.createCoreException(
                   "CactusLaunch.message.invalidproperty.tempdir", null);
           }
           if (theHomes.length == 0)
           {
  -            CactusPlugin.throwCoreException(
  +            throw CactusPlugin.createCoreException(
                   "CactusLaunch.message.invalidproperty.containers", null);
           }
           port = thePort;
  @@ -150,12 +154,15 @@
                       + currentContainerHome.getDirectory());
           }
           CactusPlugin thePlugin = CactusPlugin.getDefault();
  -        //File antFilesLocation =
  -        //    new File(thePlugin.find(new Path("./ant")).getPath());
  -        buildFileLocation =
  -            new File(
  -                thePlugin.find(new Path("./ant/build.xml")).getPath());
  -        //antArguments.add("-Dbase.dir=" + antFilesLocation.getAbsolutePath());
  +        URL buildFileURL = thePlugin.find(new Path(buildFilePath));
  +        if (buildFileURL == null)
  +        {
  +            throw CactusPlugin.createCoreException(
  +                "CactusLaunch.message.prepare.error.plugin.file",
  +                " : " + buildFilePath,
  +                null);
  +        }
  +        buildFileLocation = new File(buildFileURL.getPath());
           antArguments.add("-Dcactus.target.dir=" + theTargetDir);
           // Avoid Ant console popups on win32 platforms
           if (BootLoader.getOS().equals(BootLoader.OS_WIN32))
  @@ -188,7 +195,7 @@
           }
           catch (MalformedURLException e)
           {
  -            CactusPlugin.throwCoreException(
  +            throw CactusPlugin.createCoreException(
                   "CactusLaunch.message.start.error",
                   e);
           }
  @@ -200,7 +207,7 @@
           }
           catch (BuildException e)
           {
  -            CactusPlugin.throwCoreException(
  +            throw CactusPlugin.createCoreException(
                   "CactusLaunch.message.start.error",
                   e);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org