seade       2003/01/11 03:21:07

  Modified:    src/core/org/apache/jmeter JMeter.java
               src/core/org/apache/jmeter/plugin PluginManager.java
  Log:
  Fixes an InvocationTargetException that occurs on Linux when running in non-gui mode.
  
  Revision  Changes    Path
  1.8       +2 -2      jakarta-jmeter/src/core/org/apache/jmeter/JMeter.java
  
  Index: JMeter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/JMeter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JMeter.java       31 Dec 2002 18:05:53 -0000      1.7
  +++ JMeter.java       11 Jan 2003 11:21:07 -0000      1.8
  @@ -192,7 +192,7 @@
         */
        public void startGui(CLOption testFile) throws IllegalUserActionException, 
IllegalAccessException, ClassNotFoundException, InstantiationException {
   
  -        PluginManager.install(this);
  +        PluginManager.install(this, true);
                JMeterTreeModel treeModel = new JMeterTreeModel();
                JMeterTreeListener treeLis = new JMeterTreeListener(treeModel);
                treeLis.setActionHandler(ActionRouter.getInstance());
  @@ -329,7 +329,7 @@
        public void startNonGui(CLOption testFile, CLOption logFile)
                throws IllegalUserActionException, IllegalAccessException, 
ClassNotFoundException, InstantiationException {
                JMeter driver = new JMeter();
  -        PluginManager.install(this);
  +        PluginManager.install(this, false);
   
                if (testFile == null) {
                        throw new IllegalUserActionException();
  
  
  
  1.2       +20 -10    
jakarta-jmeter/src/core/org/apache/jmeter/plugin/PluginManager.java
  
  Index: PluginManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/plugin/PluginManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PluginManager.java        31 Dec 2002 18:05:54 -0000      1.1
  +++ PluginManager.java        11 Jan 2003 11:21:07 -0000      1.2
  @@ -61,7 +61,6 @@
   import javax.swing.*;
   
   import org.apache.jmeter.gui.GUIFactory;
  -import org.apache.jmeter.util.JMeterUtils;
   
   
   /**
  @@ -77,34 +76,45 @@
       {
       }
   
  -
  -    public static void install(JMeterPlugin plugin)
  +     /**
  +      * Installs a plugin.
  +      * @param plugin The plugin to install.
  +      * @param useGui Indication of whether or not the gui will be used.
  +      * @throws ClassNotFoundException
  +      * @throws InstantiationException
  +      * @throws IllegalAccessException
  +      */
  +    public static void install(JMeterPlugin plugin, boolean useGui)
               throws ClassNotFoundException, InstantiationException,
  -                IllegalAccessException
  +                 IllegalAccessException
       {
  -        instance.installPlugin(plugin);
  +     if (useGui)
  +     {
  +            instance.installPlugin(plugin);
  +     }
       }
   
   
       private void installPlugin(JMeterPlugin plugin)
               throws ClassNotFoundException, InstantiationException,
  -                IllegalAccessException
  +                 IllegalAccessException
       {
           String[][] icons = plugin.getIconMappings();
           ClassLoader classloader = plugin.getClass().getClassLoader();
   
           for (int i = 0; i < icons.length; i++)
  -     {
  +             {
               URL resource = classloader.getResource(icons[i][1].trim());
   
               if (resource == null)
  -         {
  +                 {
                   // todo: log or throw exception
               }
  -         else
  -         {
  +             else
  +             {
                   GUIFactory.registerIcon(icons[i][0], new ImageIcon(resource));
               }
           }
       }
  +    
   }
  
  
  

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

Reply via email to