ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic WLRmic.java
Date Fri, 11 Jan 2002 13:48:08 GMT
bodewig     02/01/11 05:48:08

  Modified:    src/main/org/apache/tools/ant/taskdefs/rmic WLRmic.java
  Log:
  Search user specified classpath for Weblogic's rmic implementation.
  
  PR: 5763
  
  Revision  Changes    Path
  1.8       +16 -5     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java
  
  Index: WLRmic.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WLRmic.java	22 Nov 2001 08:46:55 -0000	1.7
  +++ WLRmic.java	11 Jan 2002 13:48:08 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -54,14 +54,12 @@
   
   package org.apache.tools.ant.taskdefs.rmic;
   
  +import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
   
   import org.apache.tools.ant.types.Commandline;
   
  -
  -
  -
   import java.lang.reflect.Method;
   
   /**
  @@ -75,9 +73,18 @@
           getRmic().log("Using WebLogic rmic", Project.MSG_VERBOSE);
           Commandline cmd = setupRmicCommand(new String[] {"-noexit"});
   
  +        AntClassLoader loader = null;
           try {
               // Create an instance of the rmic
  -            Class c = Class.forName("weblogic.rmic");
  +            Class c = null;
  +            if (getRmic().getClasspath() == null) {
  +                c = Class.forName("weblogic.rmic");
  +            } else {
  +                loader = new AntClassLoader(getRmic().getProject(), 
  +                                            getRmic().getClasspath());
  +                c = loader.loadClass("weblogic.rmic");
  +                AntClassLoader.initializeClass(c);
  +            }
               Method doRmic = c.getMethod("main",
                                           new Class [] { String[].class });
               doRmic.invoke(null, new Object[] {cmd.getArguments()  });
  @@ -92,6 +99,10 @@
                   throw (BuildException) ex;
               } else {
                   throw new BuildException("Error starting WebLogic rmic: ", ex, getRmic().getLocation());
  +            }
  +        } finally {
  +            if (loader != null) {
  +                loader.cleanup();
               }
           }
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message