mstover1    2004/07/27 07:19:40

  Modified:    src/core/org/apache/jmeter/save/converters
                        StringPropertyConverter.java
               src/core/org/apache/jmeter/util JMeterVersion.java
  Log:
  Adding urlencoding to xstream saving
  
  Revision  Changes    Path
  1.4       +26 -4     
jakarta-jmeter/src/core/org/apache/jmeter/save/converters/StringPropertyConverter.java
  
  Index: StringPropertyConverter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/save/converters/StringPropertyConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StringPropertyConverter.java      21 Jun 2004 23:37:40 -0000      1.3
  +++ StringPropertyConverter.java      27 Jul 2004 14:19:40 -0000      1.4
  @@ -17,7 +17,13 @@
   
   package org.apache.jmeter.save.converters;
   
  +import java.io.UnsupportedEncodingException;
  +import java.net.URLDecoder;
  +import java.net.URLEncoder;
  +
   import org.apache.jmeter.testelement.property.StringProperty;
  +import org.apache.jorphan.logging.LoggingManager;
  +import org.apache.log.Logger;
   
   import com.thoughtworks.xstream.converters.Converter;
   import com.thoughtworks.xstream.converters.MarshallingContext;
  @@ -33,6 +39,7 @@
    */
   public class StringPropertyConverter implements Converter
   {
  +   transient private static final Logger log = LoggingManager.getLoggerForClass();
   
       /** Returns the converter version; used to check for possible incompatibilities 
*/
        public static String getVersion(){      return "$Revision$";}
  @@ -52,7 +59,14 @@
            MarshallingContext arg2)
      {
         StringProperty prop = (StringProperty)obj;
  -      writer.addAttribute("name",prop.getName());
  +      try
  +      {
  +         writer.addAttribute("name",URLEncoder.encode(prop.getName(),"UTF-8"));
  +      }
  +      catch (UnsupportedEncodingException e)
  +      {
  +         log.warn("System doesn't support utf-8",e);
  +      }
         writer.setValue(prop.getStringValue());
      }
   
  @@ -62,7 +76,15 @@
      public Object unmarshal(HierarchicalStreamReader reader,
            UnmarshallingContext arg1)
      {
  -      StringProperty prop = new 
StringProperty(reader.getAttribute("name"),reader.getValue());
  -      return prop;
  +      try
  +      {
  +         StringProperty prop = new 
StringProperty(URLDecoder.decode(reader.getAttribute("name"),"UTF-8"),reader.getValue());
  +         return prop;
  +      }
  +      catch (UnsupportedEncodingException e)
  +      {
  +         log.warn("System doesn't support utf-8",e);
  +         return null;
  +      }
      }
   }
  
  
  
  1.25      +1 -1      
jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterVersion.java
  
  Index: JMeterVersion.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterVersion.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- JMeterVersion.java        14 Jul 2004 14:33:41 -0000      1.24
  +++ JMeterVersion.java        27 Jul 2004 14:19:40 -0000      1.25
  @@ -39,7 +39,7 @@
         * pattern: VERSION = <quote>.*<quote>
         * 
         */
  -     static final String VERSION = "2.0.20040714";
  +     static final String VERSION = "2.0.20040727";
   
        static final String COPYRIGHT = "Copyright (c) 1998-2004 The Apache Software 
Foundation";
        
  
  
  

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

Reply via email to