You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2023/04/12 21:15:51 UTC

[hop] branch master updated: add extra check and message when table not foun, fixes #2808

This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 95daa03718 add extra check and message when table not foun, fixes #2808
     new ccc58b4cc2 Merge pull request #2819 from hansva/master
95daa03718 is described below

commit 95daa0371848e80d2b2f3058151936ebe54badce
Author: Hans Van Akelyen <ha...@gmail.com>
AuthorDate: Wed Apr 12 15:36:24 2023 +0200

    add extra check and message when table not foun, fixes #2808
    
    
    code cleanup
---
 .../apache/hop/beam/transforms/bq/BeamBQInputDialog.java | 16 ++++++++++++++++
 .../transforms/bq/messages/messages_en_US.properties     |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputDialog.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputDialog.java
index 0dc71c11ac..4297f1007a 100644
--- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputDialog.java
+++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/transforms/bq/BeamBQInputDialog.java
@@ -41,6 +41,7 @@ import org.apache.hop.pipeline.transform.ITransformDialog;
 import org.apache.hop.ui.core.PropsUi;
 import org.apache.hop.ui.core.dialog.BaseDialog;
 import org.apache.hop.ui.core.dialog.ErrorDialog;
+import org.apache.hop.ui.core.dialog.MessageBox;
 import org.apache.hop.ui.core.widget.ColumnInfo;
 import org.apache.hop.ui.core.widget.TableView;
 import org.apache.hop.ui.core.widget.TextVar;
@@ -258,6 +259,21 @@ public class BeamBQInputDialog extends BaseTransformDialog implements ITransform
             bigQuery.getTable(
                 variables.resolve(meta.getDatasetId()), variables.resolve(meta.getTableId()));
 
+        if (table == null) {
+          MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
+          mb.setText(BaseMessages.getString(PKG, "BeamBQInputDialog.TableNotFound.Title"));
+          mb.setMessage(
+              variables.resolve(meta.getTableId())
+                  + " "
+                  + BaseMessages.getString(PKG, "BeamBQInputDialog.TableNotFound.Message"));
+          switch (mb.open()) {
+            case SWT.OK:
+              break;
+            default:
+              break;
+          }
+          return;
+        }
         TableDefinition definition = table.getDefinition();
         Schema schema = definition.getSchema();
         FieldList fieldList = schema.getFields();
diff --git a/plugins/engines/beam/src/main/resources/org/apache/hop/beam/transforms/bq/messages/messages_en_US.properties b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/transforms/bq/messages/messages_en_US.properties
index a7d4d46269..300d6f2eb4 100644
--- a/plugins/engines/beam/src/main/resources/org/apache/hop/beam/transforms/bq/messages/messages_en_US.properties
+++ b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/transforms/bq/messages/messages_en_US.properties
@@ -35,4 +35,5 @@ BeamBQOutputDialog.CreateIfNeeded=Create table if needed
 BeamBQOutputDialog.TruncateTable=Truncate table
 BeamBQOutputDialog.FailIfNotEmpty=Fail if the table is not empty
 BeamBQOutputDialog.keyword=beam,big query,output
-
+BeamBQInputDialog.TableNotFound.Title=Table Not found
+BeamBQInputDialog.TableNotFound.Message=could not be found