Skip to content

Commit

Permalink
fix: ipv4 empty subnet gateway checks - improvement (#5557)
Browse files Browse the repository at this point in the history
fix: Updated and cleaned up the subnet and gateway validation logic

Signed-off-by: MMaiero <[email protected]>
  • Loading branch information
MMaiero authored Nov 13, 2024
1 parent 6d3c66e commit d32a0a5
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,7 @@ private void initGatewayField() {
this.gateway.addMouseOutHandler(event -> resetHelp());
this.gateway.addValueChangeHandler(event -> {
setDirty(true);
if (!TabIp4Ui.this.gateway.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())
|| TabIp4Ui.this.gateway.getText().trim().length() <= 0) {
if (!TabIp4Ui.this.gateway.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())) {
TabIp4Ui.this.groupGateway.setValidationState(ValidationState.ERROR);
TabIp4Ui.this.helpGateway.setText(MSGS.netIPv4InvalidAddress());
} else {
Expand All @@ -551,8 +550,7 @@ private void initSubnetMaskField() {
this.subnet.addMouseOutHandler(event -> resetHelp());
this.subnet.addValueChangeHandler(event -> {
setDirty(true);
if (!TabIp4Ui.this.subnet.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())
|| TabIp4Ui.this.subnet.getText().trim().length() <= 0) {
if (!TabIp4Ui.this.subnet.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())) {
TabIp4Ui.this.groupSubnet.setValidationState(ValidationState.ERROR);
TabIp4Ui.this.helpSubnet.setText(MSGS.netIPv4InvalidAddress());
} else {
Expand All @@ -572,8 +570,7 @@ private void initIpAddressField() {
this.ip.addMouseOutHandler(event -> resetHelp());
this.ip.addValueChangeHandler(event -> {
setDirty(true);
if (!TabIp4Ui.this.ip.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())
|| TabIp4Ui.this.ip.getText().trim().length() <= 0) {
if (!TabIp4Ui.this.ip.getText().trim().matches(FieldType.IPV4_ADDRESS.getRegex())) {
TabIp4Ui.this.groupIp.setValidationState(ValidationState.ERROR);
TabIp4Ui.this.helpIp.setText(MSGS.netIPv4InvalidAddress());
} else {
Expand Down

0 comments on commit d32a0a5

Please sign in to comment.