jsalvata    2004/02/06 02:59:23

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/sampler
                        HTTPSampler.java
  Log:
  Avoid NPE in disconnect, which would hide the real source
  of any problem occured before connection establishment.
  
  Revision  Changes    Path
  1.83      +9 -6      
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.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- HTTPSampler.java  6 Feb 2004 00:04:42 -0000       1.82
  +++ HTTPSampler.java  6 Feb 2004 10:59:23 -0000       1.83
  @@ -1369,12 +1369,15 @@
   
       protected void disconnect(HttpURLConnection conn)
       {
  -        String connection= conn.getHeaderField("Connection");
  -        String protocol= conn.getHeaderField(0);
  -        if ((connection == null && (protocol == null || 
!protocol.startsWith("HTTP/1.1")))
  -            || (connection != null && connection.equalsIgnoreCase("close")))
  +        if (conn != null)
           {
  -            conn.disconnect();
  +            String connection= conn.getHeaderField("Connection");
  +            String protocol= conn.getHeaderField(0);
  +            if ((connection == null && (protocol == null || 
!protocol.startsWith("HTTP/1.1")))
  +                || (connection != null && connection.equalsIgnoreCase("close")))
  +            {
  +                conn.disconnect();
  +            }
           }
       }
   
  
  
  

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

Reply via email to