jsalvata    2002/12/27 07:51:18

  Modified:    src/core/org/apache/jmeter/gui/util JMeterMenuBar.java
                        MenuFactory.java
               src/core/org/apache/jmeter/util JMeterUtils.java
                        SSLManager.java
               src/jorphan/org/apache/jorphan/collections Data.java
               src/jorphan/org/apache/jorphan/test AllTests.java
               src/protocol/http/org/apache/jmeter/protocol/http/config
                        MultipartUrlConfig.java
               src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Added:       src/jorphan/org/apache/jorphan/util JOrphanUtils.java
  Log:
  Now compiles and tests correctly under JDK 1.3, too.
  
  Revision  Changes    Path
  1.7       +4 -2      
jakarta-jmeter/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
  
  Index: JMeterMenuBar.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JMeterMenuBar.java        30 Aug 2002 18:28:16 -0000      1.6
  +++ JMeterMenuBar.java        27 Dec 2002 15:51:17 -0000      1.7
  @@ -72,6 +72,8 @@
   import org.apache.jmeter.util.SSLManager;
   import org.apache.log.Hierarchy;
   import org.apache.log.Logger;
  +import org.apache.jorphan.util.JOrphanUtils;
  +
   /****************************************
    * Title: Apache JMeter Description: Copyright: Copyright (c) 2000 Company:
    * Apache Foundation
  @@ -118,7 +120,7 @@
                remote_engine_start = new LinkedList();
                remote_engine_stop = new LinkedList();
                remoteHosts =
  -                     JMeterUtils.split(JMeterUtils.getPropDefault("remote_hosts", 
""), ",");
  +                     JOrphanUtils.split(JMeterUtils.getPropDefault("remote_hosts", 
""), ",");
                if (remoteHosts.length == 1 && remoteHosts[0].equals(""))
                {
                        remoteHosts = new String[0];
  
  
  
  1.11      +3 -2      
jakarta-jmeter/src/core/org/apache/jmeter/gui/util/MenuFactory.java
  
  Index: MenuFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/util/MenuFactory.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MenuFactory.java  17 Oct 2002 19:47:16 -0000      1.10
  +++ MenuFactory.java  27 Dec 2002 15:51:17 -0000      1.11
  @@ -74,6 +74,7 @@
   import org.apache.log.Hierarchy;
   import org.apache.log.Logger;
   import org.apache.jorphan.reflect.ClassFinder;
  +import org.apache.jorphan.util.JOrphanUtils;
   
   /****************************************
    * Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
  @@ -144,7 +145,7 @@
        {
                try
                {
  -             String[] classesToSkip = JMeterUtils.split(
  +             String[] classesToSkip = JOrphanUtils.split(
                                JMeterUtils.getPropDefault("not_in_menu", ""), ",");
                for(int i = 0; i < classesToSkip.length; i++)
                {
  
  
  
  1.10      +1 -45     jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterUtils.java
  
  Index: JMeterUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterUtils.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JMeterUtils.java  17 Oct 2002 19:47:17 -0000      1.9
  +++ JMeterUtils.java  27 Dec 2002 15:51:17 -0000      1.10
  @@ -702,50 +702,6 @@
         *
         *@param  splittee   String to be split
         *@param  splitChar  Character to split the string on
  -      *@return            Array of all the tokens.
  -      */
  -     public static String[] split(String splittee, String splitChar)
  -     {
  -             if (splittee == null || splitChar == null)
  -             {
  -                     return new String[0];
  -             }
  -             StringTokenizer tokens;
  -             String temp;
  -             int spot;
  -             while ((spot = splittee.indexOf(splitChar + splitChar)) != -1)
  -             {
  -                     splittee =
  -                             splittee.substring(0, spot + splitChar.length())
  -                                     + splittee.substring(spot + 2 * 
splitChar.length(), splittee.length());
  -             }
  -             Vector returns = new Vector();
  -             int start = 0;
  -             int length = splittee.length();
  -             spot = 0;
  -             while (start < length && (spot = splittee.indexOf(splitChar, start)) > 
-1)
  -             {
  -                     if (spot > 0)
  -                     {
  -                             returns.addElement(splittee.substring(start, spot));
  -                     }
  -                     start = spot + splitChar.length();
  -             }
  -             if (start < length)
  -             {
  -                     returns.add(splittee.substring(start));
  -             }
  -             String[] values = new String[returns.size()];
  -             returns.copyInto(values);
  -             return values;
  -     }
  -     // End Method
  -     /**
  -      *  Takes a String and a tokenizer character, and returns a new array of
  -      *  strings of the string split by the tokenizer character.
  -      *
  -      *@param  splittee   String to be split
  -      *@param  splitChar  Character to split the string on
         *@param  def        Default value to place between two split chars that have
         *      nothing between them
         *@return            Array of all the tokens.
  
  
  
  1.5       +3 -3      jakarta-jmeter/src/core/org/apache/jmeter/util/SSLManager.java
  
  Index: SSLManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/util/SSLManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SSLManager.java   27 Dec 2002 13:42:29 -0000      1.4
  +++ SSLManager.java   27 Dec 2002 15:51:17 -0000      1.5
  @@ -174,7 +174,7 @@
                       this.keyStore.load(null, password);
                   }
               } catch (Exception e) {
  -           throw new RuntimeException("Can't load KeyStore", e);
  +           throw new RuntimeException("Can't load KeyStore: "+e.toString());
               }
   
           log.info("JmeterKeyStore Location: " + fileName);
  @@ -217,7 +217,7 @@
                       this.trustStore.load(null, null);
                   }
               } catch (Exception e) {
  -           throw new RuntimeException("Can't load TrustStore", e);
  +           throw new RuntimeException("Can't load TrustStore: "+e.toString());
               }
   
               log.info("TrustStore Location: " + fileName);
  
  
  
  1.2       +3 -2      
jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/Data.java
  
  Index: Data.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/jorphan/org/apache/jorphan/collections/Data.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Data.java 17 Oct 2002 19:47:18 -0000      1.1
  +++ Data.java 27 Dec 2002 15:51:17 -0000      1.2
  @@ -62,6 +62,7 @@
   import java.util.List;
   import java.util.Map;
   
  +import org.apache.jorphan.util.JOrphanUtils;
   
   /****************************************************************
    Use this class to store database-like data.  This class uses rows
  @@ -517,11 +518,11 @@
          *****************************************************************/
     public void setData(String[] contents, String delimiter)
     {
  -             setHeaders(contents[0].split(delimiter));
  +             setHeaders(JOrphanUtils.split(contents[0], delimiter));
                int x=1;
                while(x<contents.length)
                {
  -                     setLine(contents[x++].split(delimiter));
  +                     setLine(JOrphanUtils.split(contents[x++], delimiter));
                }
         } //end of Method
   
  
  
  
  1.2       +3 -1      jakarta-jmeter/src/jorphan/org/apache/jorphan/test/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/jorphan/org/apache/jorphan/test/AllTests.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AllTests.java     17 Oct 2002 19:47:19 -0000      1.1
  +++ AllTests.java     27 Dec 2002 15:51:18 -0000      1.2
  @@ -70,6 +70,7 @@
   import org.apache.log.Logger;
   import org.apache.jorphan.logging.LoggingManager;
   import org.apache.jorphan.reflect.ClassFinder;
  +import org.apache.jorphan.util.JOrphanUtils;
   
   /************************************************************
    *  Provides a quick and easy way to run all <a 
href="http://junit.sourceforge.net";>junit</a> unit tests in your java project.  It 
will 
  @@ -219,7 +220,8 @@
                TestSuite suite = new TestSuite();
                try
                {
  -                     Iterator classes = 
ClassFinder.findClassesThatExtend(searchPaths.split(","),
  +                     Iterator classes = ClassFinder.findClassesThatExtend(
  +                                     JOrphanUtils.split(searchPaths, ","),
                                        new Class[]{TestCase.class},true).iterator();
                        while (classes.hasNext())
                        {
  
  
  
  1.1                  
jakarta-jmeter/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
  
  Index: JOrphanUtils.java
  ===================================================================
  /*
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   * notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   * notice, this list of conditions and the following disclaimer in
   * the documentation and/or other materials provided with the
   * distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   * if any, must include the following acknowledgment:
   * "This product includes software developed by the
   * Apache Software Foundation (http://www.apache.org/)."
   * Alternately, this acknowledgment may appear in the software itself,
   * if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   * "Apache JMeter" must not be used to endorse or promote products
   * derived from this software without prior written permission. For
   * written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   * "Apache JMeter", nor may "Apache" appear in their name, without
   * prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jorphan.util;
  
  import java.util.StringTokenizer;
  import java.util.Vector;
  
  /**
   * This class contains frequently-used static utility methods.
   *
   * @author     <a href="mailto:[EMAIL PROTECTED]";>Jordi Salvat i Alabart</a>
   * @created    27th December 2002
   * @version    $Revision: 1.1 $
   */
  public class JOrphanUtils
  {
      /**
       * This is equivalent to the String.split method in JDK 1.4. It is
       * here to enable us to support earlier JDKs.
       *
       * <P>This piece of code used to be part of JMeterUtils, but was moved
       * here because some JOrphan classes use it too.
       *
       * @param  splittee   String to be split
       * @param  splitChar  Character to split the string on
       * @return            Array of all the tokens.
       */
      public static String[] split(String splittee, String splitChar)
      {
        if (splittee == null || splitChar == null)
        {
            return new String[0];
        }
        StringTokenizer tokens;
        String temp;
        int spot;
        while ((spot = splittee.indexOf(splitChar + splitChar)) != -1)
        {
            splittee = splittee.substring(0, spot + splitChar.length())
                       + splittee.substring(spot + 2 * splitChar.length(),
                               splittee.length());
        }
        Vector returns = new Vector();
        int start = 0;
        int length = splittee.length();
        spot = 0;
        while (start<length && (spot = splittee.indexOf(splitChar, start)) > -1)
        {
            if (spot > 0)
            {
                returns.addElement(splittee.substring(start, spot));
            }
            start = spot + splitChar.length();
        }
        if (start < length)
        {
            returns.add(splittee.substring(start));
        }
        String[] values = new String[returns.size()];
        returns.copyInto(values);
        return values;
      }
      // End Method split(String, String)
  }
  
  
  
  1.4       +2 -1      
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
  
  Index: MultipartUrlConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MultipartUrlConfig.java   14 Aug 2002 02:52:19 -0000      1.3
  +++ MultipartUrlConfig.java   27 Dec 2002 15:51:18 -0000      1.4
  @@ -60,6 +60,7 @@
   import org.apache.jmeter.config.Arguments;
   import org.apache.jmeter.protocol.http.util.HTTPArgument;
   import org.apache.jmeter.util.JMeterUtils;
  +import org.apache.jorphan.util.JOrphanUtils;
   
   /**
    * Title:        JMeter
  @@ -163,7 +164,7 @@
         */
        public void parseArguments(String queryString)
        {
  -             String[] parts = JMeterUtils.split(queryString,"--"+getBoundary());
  +             String[] parts = JOrphanUtils.split(queryString,"--"+getBoundary());
                for (int i = 0; i < parts.length; i++)
                {
                        if(parts[i].indexOf("filename=") > -1)
  
  
  
  1.17      +4 -3      
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
  
  Index: HTTPSampler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HTTPSampler.java  24 Dec 2002 11:48:49 -0000      1.16
  +++ HTTPSampler.java  27 Dec 2002 15:51:18 -0000      1.17
  @@ -79,6 +79,7 @@
   import org.apache.jmeter.testelement.TestElement;
   import org.apache.jmeter.util.JMeterUtils;
   import org.apache.jmeter.util.SSLManager;
  +import org.apache.jorphan.util.JOrphanUtils;
   import org.apache.log.Hierarchy;
   import org.apache.log.Logger;
   /****************************************
  @@ -558,7 +559,7 @@
         */
        public void parseArguments(String queryString)
        {
  -             String[] args = JMeterUtils.split(queryString, "&");
  +             String[] args = JOrphanUtils.split(queryString, "&");
                for (int i = 0; i < args.length; i++)
                {
                        // need to handle four cases:   string contains name=value
  
  
  

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

Reply via email to