jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Questions about DataSourceElement
Date Mon, 05 Jun 2017 17:27:22 GMT
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?

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?

Regards,

  Felix


Mime
View raw message