jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: svn commit: r1397875 - in /jmeter/trunk: src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java xdocs/changes.xml
Date Sat, 13 Oct 2012 17:08:31 GMT
Hello Milamber,
Maybe using StringEscapeUtils.escapeXml(text) would be better.

Regards
Philippe

On Sat, Oct 13, 2012 at 6:06 PM, <milamber@apache.org> wrote:

> Author: milamber
> Date: Sat Oct 13 16:06:41 2012
> New Revision: 1397875
>
> URL: http://svn.apache.org/viewvc?rev=1397875&view=rev
> Log:
> LDAP Extended Request: Escape ampersand (&), left angle bracket (<) and
> right angle bracket (>) in search filter tag in XML response data
> Bugzilla Id: 53997
>
> Modified:
>
> jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
>     jmeter/trunk/xdocs/changes.xml
>
> Modified:
> jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java?rev=1397875&r1=1397874&r2=1397875&view=diff
>
> ==============================================================================
> ---
> jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
> (original)
> +++
> jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/sampler/LDAPExtSampler.java
> Sat Oct 13 16:06:41 2012
> @@ -800,7 +800,7 @@ public class LDAPExtSampler extends Abst
>                  final String countLimit = getCountlim();
>
>                  res.setSamplerData("Search with filter " + searchFilter);
> -                xmlBuffer.tag("searchfilter",searchFilter); // $NON-NLS-1$
> +                xmlBuffer.tag("searchfilter",
> escapeXMLSpecialChar(searchFilter)); // $NON-NLS-1$
>                  xmlBuffer.tag("baseobj",getRootdn()); // $NON-NLS-1$
>                  xmlBuffer.tag("searchbase",searchBase);// $NON-NLS-1$
>                  xmlBuffer.tag("scope" , scopeStr); // $NON-NLS-1$
> @@ -1090,4 +1090,13 @@ public class LDAPExtSampler extends Abst
>          String guiClass =
> configElement.getProperty(TestElement.GUI_CLASS).getStringValue();
>          return APPLIABLE_CONFIG_CLASSES.contains(guiClass);
>      }
> +
> +    /**
> +     * Escape special XML character
> +     * @param text
> +     * @return a escape XML string
> +     */
> +    private String escapeXMLSpecialChar(String text) {
> +        return text.replaceAll("&", "&amp;").replaceAll("<",
> "&lt;").replaceAll(">", "&gt;"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
> $NON-NLS-4$ $NON-NLS-5$ $NON-NLS-6$
> +    }
>  }
>
> Modified: jmeter/trunk/xdocs/changes.xml
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1397875&r1=1397874&r2=1397875&view=diff
>
> ==============================================================================
> --- jmeter/trunk/xdocs/changes.xml (original)
> +++ jmeter/trunk/xdocs/changes.xml Sat Oct 13 16:06:41 2012
> @@ -82,6 +82,8 @@ This does not affect JMeter operation.
>
>  <h3>Other Samplers</h3>
>  <ul>
> +<li><bugzilla>53997</bugzilla> - LDAP Extended Request: Escape ampersand
> (&amp;), left angle bracket (&lt;)
> +and right angle bracket (&gt;) in search filter tag in XML response
> data</li>
>  </ul>
>
>  <h3>Controllers</h3>
>
>
>


-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message