Skip to content

Commit

Permalink
fix condition errors and small cleanup, apache#2952
Browse files Browse the repository at this point in the history
  • Loading branch information
hansva committed May 27, 2023
1 parent 0338bf6 commit 13161aa
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ private void ok() {
return;
}

if (input.getConnection() == null) {
if (wConnection.getText() == 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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ private void ok() {
return;
}

if (Utils.isEmpty(input.getConnection())) {
if (Utils.isEmpty(wConnection.getText())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "InsertUpdateDialog.InvalidConnection.DialogMessage"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ private void ok() {
return;
}

if (input.getConnection() == null) {
if (Utils.isEmpty(wConnection.getText())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(
BaseMessages.getString(PKG, "TableExistsDialog.InvalidConnection.DialogMessage"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ private void ok() {
}

transformName = wTransformName.getText(); // return value
if (Utils.isEmpty(input.getConnection())) {
if (Utils.isEmpty(wConnection.getText())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TableInputDialog.SelectValidConnection"));
mb.setText(BaseMessages.getString(PKG, "TableInputDialog.DialogCaptionError"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ private void ok() {
return;
}

if (Utils.isEmpty(input.getConnection())) {
if (Utils.isEmpty(wConnection.getText())) {
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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ public static final void getFieldsFromPrevious(

int choice = 0;

if (keys.size() > 0) {
if (keys.isEmpty()) {
// Ask what we should do with the existing data in the transform.
//
DialogBoxWithButtons getFieldsChoiceDialog =
Expand All @@ -953,11 +953,9 @@ public static final void getFieldsFromPrevious(

boolean add = true;

if (choice == 0) { // hang on, see if it's not yet in the table view

if (keys.indexOf(v.getName()) >= 0) {
add = false;
}
if (choice == 0
&& keys.indexOf(v.getName()) >= 0) { // hang on, see if it's not yet in the table view
add = false;
}

if (add) {
Expand All @@ -971,21 +969,15 @@ public static final void getFieldsFromPrevious(
tableItem.setText(dataTypeColumn[c], v.getTypeDesc());
}
}
if (lengthColumn > 0) {
if (v.getLength() >= 0) {
tableItem.setText(lengthColumn, Integer.toString(v.getLength()));
}
if (lengthColumn > 0 && v.getLength() >= 0) {
tableItem.setText(lengthColumn, Integer.toString(v.getLength()));
}
if (precisionColumn > 0) {
if (v.getPrecision() >= 0) {
tableItem.setText(precisionColumn, Integer.toString(v.getPrecision()));
}
if (precisionColumn > 0 && v.getPrecision() >= 0) {
tableItem.setText(precisionColumn, Integer.toString(v.getPrecision()));
}

if (listener != null) {
if (!listener.tableItemInserted(tableItem, v)) {
tableItem.dispose(); // remove it again
}
if (listener != null && !listener.tableItemInserted(tableItem, v)) {
tableItem.dispose(); // remove it again
}
}
}
Expand Down Expand Up @@ -1257,7 +1249,7 @@ public void setMetadataProvider(IHopMetadataProvider metadataProvider) {
public MetaSelectionLine<DatabaseMeta> addConnectionLine(
Composite parent, Control previous, String connection, ModifyListener lsMod) {
DatabaseMeta databaseMeta = null;
if (connection != null) {
if (!Utils.isEmpty(connection)) {
databaseMeta = pipelineMeta.findDatabase(connection, variables);
// If we are unable to find the database metadata, display only a warning message so that the
// user
Expand Down

0 comments on commit 13161aa

Please sign in to comment.