Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message too vague #5319

Closed
asfimport opened this issue May 19, 2020 · 5 comments
Closed

Error message too vague #5319

asfimport opened this issue May 19, 2020 · 5 comments

Comments

@asfimport
Copy link
Collaborator

David Balažic (Bug 64454):
The error message (shown in the Results Tree) is too vague:
Variable Name must not be null in JDBC Request

It is not clear which variable is set to null.

OS: All

@asfimport
Copy link
Collaborator Author

@FSchumacher (migrated from Bugzilla):
Created attachment 0001-Bug-64454-more-precise-error-message.patch: Be more precise, which element is blank

0001-Bug-64454-more-precise-error-message.patch
From dedaae2b9ca1e2b379c092e56d11ab17ea23c36e Mon Sep 17 00:00:00 2001
From: Felix Schumacher <felix.schumacher@internetallee.de>
Date: Tue, 19 May 2020 17:22:38 +0200
Subject: [PATCH] Bug 64454 more precise error message

---
 .../apache/jmeter/protocol/jdbc/config/DataSourceElement.java | 4 ++--
 .../jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java | 4 ++--
 .../org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
index 0c0f91233f..50f4535faf 100644
--- a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
+++ b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java
@@ -114,8 +114,8 @@ public class DataSourceElement extends AbstractTestElement
         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 {
diff --git a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java
index abb941d74d..ba019a5ee0 100644
--- a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java
+++ b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java
@@ -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);
diff --git a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
index 22cf01c476..7b00779ed9 100644
--- a/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
+++ b/src/protocol/jdbc/src/main/java/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
@@ -72,8 +72,8 @@ public class JDBCSampler extends AbstractJDBCTestElement implements Sampler, Tes
         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 {
-- 
2.25.1

@asfimport
Copy link
Collaborator Author

@FSchumacher (migrated from Bugzilla):
@david, are the new error messages more to your liking? Can you test next nightly?

commit fe4d4d6
AuthorDate: Thu May 28 16:06:26 2020 +0200

More precise error message, when no datasource value can be found in JDBC sampler

https://github.com/apache/jmeter/issues/5319

.../org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java | 4 ++--
.../apache/jmeter/protocol/jdbc/processor/AbstractJDBCProcessor.java | 4 ++--
.../java/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java | 4 ++--
xdocs/changes.xml | 1 +
4 files changed, 7 insertions(+), 6 deletions(-)

@asfimport
Copy link
Collaborator Author

David Balažic (migrated from Bugzilla):
(looking at the commit) they look fine

When will the nightly be available?

@asfimport
Copy link
Collaborator Author

@FSchumacher (migrated from Bugzilla):
Nightlies will be built in the night ;) I am not sure, when they will be built exactly.

You could even try to build the stuff yourself, or look at https://builds.apache.org/job/JMeter-trunk/ where they will be built more often than the nightlies.

commit a3128d2
AuthorDate: Thu May 28 16:36:41 2020 +0200

Fix tests to check for changed error messages

Follow-up to fe4d4d6074f844ff28acaf42f36765104fcf8471
https://github.com/apache/jmeter/issues/5319

bin/testfiles/JDBC_TESTS.csv | 2 +-
bin/testfiles/JDBC_TESTS.jmx | 2 +-
bin/testfiles/JDBC_TESTS.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

@asfimport
Copy link
Collaborator Author

@FSchumacher (migrated from Bugzilla):
Closing, as no feedback probably means, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant