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: r1380342 - /jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
Date Mon, 03 Sep 2012 21:45:37 GMT
I think you are right, only awt thread accesses it so it should be ok on
this side
In my understanding it caches in a static var the document used for testIng
xpath.

I am not sure it's worth it and code seems to me not very clear.
You can rollback id you disagree

On Monday, September 3, 2012, sebb wrote:

> On 3 September 2012 21:14,  <pmouawad@apache.org <javascript:;>> wrote:
> > Author: pmouawad
> > Date: Mon Sep  3 20:14:30 2012
> > New Revision: 1380342
> >
> > URL: http://svn.apache.org/viewvc?rev=1380342&view=rev
> > Log:
> > Remove caching as it is subject to thread corruption
>
> Are you sure?
>
> > Modified:
> >
> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
> >
> > Modified:
> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java?rev=1380342&r1=1380341&r2=1380342&view=diff
> >
> ==============================================================================
> > ---
> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
> (original)
> > +++
> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/XPathPanel.java
> Mon Sep  3 20:14:30 2012
> > @@ -42,9 +42,6 @@ public class XPathPanel extends JPanel {
> >
> >      private static final Logger log =
> LoggingManager.getLoggerForClass();
> >
> > -    // Lazily constructed. Does not matter if it is constructed more
> than once.
> > -    private static Document testDoc;
> > -
> >      private JCheckBox negated;
> >
> >      private JTextField xpath;
> > @@ -182,14 +179,11 @@ public class XPathPanel extends JPanel {
> >      public static boolean validXPath(String xpathString, boolean
> showDialog) {
> >          String ret = null;
> >          boolean success = true;
> > +        Document testDoc = null;
> >          try {
> > -            if (testDoc == null) {
> > -                Document doc = XPathUtil.makeDocumentBuilder(false,
> false, false, false).newDocument();
> > -                testDoc = doc;
> > -                Element el = testDoc.createElement("root");
> //$NON-NLS-1$
> > -                doc.appendChild(el);
> > -
> > -            }
> > +            testDoc = XPathUtil.makeDocumentBuilder(false, false,
> false, false).newDocument();
> > +            Element el = testDoc.createElement("root"); //$NON-NLS-1$
> > +            testDoc.appendChild(el);
> >              XPathUtil.validateXPath(testDoc, xpathString);
> >          } catch (IllegalArgumentException e) {
> >                 log.warn(e.getLocalizedMessage());
> >
> >
>


-- 
Cordialement.
Philippe Mouawad.

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