Skip to content

Commit

Permalink
fix #2952 Unwanted "Invalid connection" message on not existing conne…
Browse files Browse the repository at this point in the history
…ctions
  • Loading branch information
sramazzina committed May 22, 2023
1 parent ed28e43 commit 0338bf6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,17 +484,15 @@ private void ok() {
return;
}

// Get the information for the dialog into the input structure.
getInfo(input);

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
if (input.getConnection() == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "DeleteDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "DeleteDialog.InvalidConnection.DialogTitle"));
mb.open();
return;
}
// Get the information for the dialog into the input structure.
getInfo(input);

dispose();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,16 @@ private void ok() {
if (Utils.isEmpty(wTransformName.getText())) {
return;
}

if (input.getConnection() == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogTitle"));
mb.open();
return;
}

input.setCommitSize(Const.toInt(wCommit.getText(), 0));
transformName = wTransformName.getText(); // return value
input.setSqlFieldName(wSqlFieldName.getText());
Expand All @@ -404,16 +414,6 @@ private void ok() {
input.setSqlFromfile(wSqlFromFile.getSelection());
input.setSendOneStatement(wSendOneStatement.getSelection());

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "ExecSqlRowDialog.InvalidConnection.DialogTitle"));
mb.open();
return;
}

dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,18 +768,16 @@ private void ok() {
return;
}

// Get the information for the dialog into the input structure.
getInfo(input);

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
if (Utils.isEmpty(input.getConnection())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "InsertUpdateDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "InsertUpdateDialog.InvalidConnection.DialogTitle"));
mb.open();
}

// Get the information for the dialog into the input structure.
getInfo(input);
dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,22 +259,21 @@ private void ok() {
return;
}

if (input.getConnection() == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogTitle"));
mb.open();
}

input.setConnection(wConnection.getText());
input.setSchemaName(wSchemaname.getText());
input.setTableNameField(wTableName.getText());
input.setResultFieldName(wResult.getText());

transformName = wTransformName.getText(); // return value

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogTitle"));
mb.open();
}

dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,15 @@ private void ok() {
}

transformName = wTransformName.getText(); // return value
// copy info to TextFileInputMeta class (input)

getInfo(input, false);

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
if (Utils.isEmpty(input.getConnection())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TableInputDialog.SelectValidConnection"));
mb.setText(BaseMessages.getString(PKG, "TableInputDialog.DialogCaptionError"));
mb.open();
return;
}

getInfo(input, false);
dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,18 +736,16 @@ private void ok() {
return;
}

// Get the information for the dialog into the input structure.
getInfo(input);

DatabaseMeta databaseMeta = pipelineMeta.findDatabase(input.getConnection(), variables);
if (databaseMeta == null) {
if (Utils.isEmpty(input.getConnection())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "UpdateDialog.InvalidConnection.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "UpdateDialog.InvalidConnection.DialogTitle"));
mb.open();
return;
}

// Get the information for the dialog into the input structure.
getInfo(input);
dispose();
}

Expand Down

0 comments on commit 0338bf6

Please sign in to comment.