You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2012/09/06 00:51:53 UTC

Re: svn commit: r1380851 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java

On 4 September 2012 21:23,  <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Tue Sep  4 20:23:24 2012
> New Revision: 1380851
>
> URL: http://svn.apache.org/viewvc?rev=1380851&view=rev
> Log:
> Use indexOf(char) is faster
>
> Modified:
>     jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
>
> Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java?rev=1380851&r1=1380850&r2=1380851&view=diff
> ==============================================================================
> --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java (original)
> +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java Tue Sep  4 20:23:24 2012
> @@ -128,14 +128,14 @@ public class MultipartUrlConfig implemen
>                  // Get the form field name
>                  final String namePrefix = "name=\""; //$NON-NLS-1$
>                  int index = contentDisposition.indexOf(namePrefix) + namePrefix.length();
> -                String name = contentDisposition.substring(index, contentDisposition.indexOf("\"", index)); //$NON-NLS-1$
> +                String name = contentDisposition.substring(index, contentDisposition.indexOf('\"', index)); //$NON-NLS-1$

$NON-NLS-1$ only applies to Strings.

>
>                  // Check if it is a file being uploaded
>                  final String filenamePrefix = "filename=\""; //$NON-NLS-1$
>                  if (contentDisposition.indexOf(filenamePrefix) > -1) {
>                      // Get the filename
>                      index = contentDisposition.indexOf(filenamePrefix) + filenamePrefix.length();
> -                    String path = contentDisposition.substring(index, contentDisposition.indexOf("\"", index)); //$NON-NLS-1$
> +                    String path = contentDisposition.substring(index, contentDisposition.indexOf('\"', index)); //$NON-NLS-1$
>                      if(path != null && path.length() > 0) {
>                          // Set the values retrieved for the file upload
>                          files.addHTTPFileArg(path, name, contentType);
>
>