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: Questions about DataSourceElement
Date Mon, 05 Jun 2017 17:43:41 GMT
On Monday, June 5, 2017, Felix Schumacher <felix.schumacher@internetallee.de>
wrote:

> Hi all,
>
> while looking at the javadocs for DataSourceElement, I found a couple of
> things, that look odd to me.
>
> a) Instead of string concatenation with "+" for static strings, often a
> Stringbuilder is used. So instead of:
>
> String result = "shared: " + shared + " user: " + username + ...
>
> The code looks like
>
> StringBuilder builder = new StringBuilder(40);
> builder.append("shared: ").append(shared)
>     .append("user: ").append(username)
>     ...
> String result = builder.toString();
>
> I think the compiler will generate the same code for the former and the
> latter. To me the string concatenation looks cleaner.
>
> Is there any reason to use the latter code for static strings?


If this part is intensive I am not sure perfs are not better with
StringBuilder

>
> b) In the inner class  DataSourceComponentImpl there is some (really
> minor) code duplication in getConnectionInfo and getConnection. But my real
> concern is, that getConnection checks for a null BasicDataSource, while
> getConnectionInfo doesn't.
>
> What is the logic behind this?

A bug :)

>
> Regards,
>
>  Felix
>
>

-- 
Cordialement.
Philippe Mouawad.

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