Skip to content

Commit

Permalink
More precise error message, when no datasource value can be found in …
Browse files Browse the repository at this point in the history
…JDBC sampler

Bugzilla Id: 64454
  • Loading branch information
FSchumacher committed May 28, 2020
1 parent cd94759 commit fe4d4d6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public void testStarted() {
TestBeanHelper.prepare(this);
JMeterVariables variables = getThreadContext().getVariables();
String poolName = getDataSource();
if(JOrphanUtils.isBlank(poolName)) {
throw new IllegalArgumentException("Variable Name must not be empty for element:"+getName());
if (JOrphanUtils.isBlank(poolName)) {
throw new IllegalArgumentException("Name for DataSoure must not be empty in " + getName());
} else if (variables.getObject(poolName) != null) {
log.error("JDBC data source already defined for: {}", poolName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public abstract class AbstractJDBCProcessor extends AbstractJDBCTestElement {
* Calls the JDBC code to be executed.
*/
protected void process() {
if(JOrphanUtils.isBlank(getDataSource())) {
throw new IllegalArgumentException("Variable Name must not be null in "+getName());
if (JOrphanUtils.isBlank(getDataSource())) {
throw new IllegalArgumentException("Name for DataSoure must not be empty in " + getName());
}
try (Connection conn = DataSourceElement.getConnection(getDataSource())){
execute(conn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public SampleResult sample(Entry e) {
Connection conn = null;

try {
if(JOrphanUtils.isBlank(getDataSource())) {
throw new IllegalArgumentException("Variable Name must not be null in "+getName());
if (JOrphanUtils.isBlank(getDataSource())) {
throw new IllegalArgumentException("Name for DataSoure must not be empty in " + getName());
}

try {
Expand Down
1 change: 1 addition & 0 deletions xdocs/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Summary
<ch_section>Non-functional changes</ch_section>
<ul>
<li><pr>594</pr>Updated neo4j-java-driver to 4.0.1 (from 1.7.5)</li>
<li><bug>64454</bug>More precise error message, when no datasource value can be found in JDBC sampler</li>
</ul>

<!-- =================== Bug fixes =================== -->
Expand Down

0 comments on commit fe4d4d6

Please sign in to comment.