Skip to content

Commit

Permalink
fix: ipv4 empty subnet gateway checks - improvement [backport release…
Browse files Browse the repository at this point in the history
…-5.6.0] (#5561)

fix: ipv4 empty subnet gateway checks - improvement (#5557)

fix: Updated and cleaned up the subnet and gateway validation logic

Signed-off-by: MMaiero <[email protected]>
(cherry picked from commit d32a0a5)

Co-authored-by: Matteo Maiero <[email protected]>
  • Loading branch information
eclipse-kura-bot and MMaiero authored Nov 13, 2024
1 parent 1007351 commit 830b3fe
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,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 @@ -573,8 +572,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 @@ -594,8 +592,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 830b3fe

Please sign in to comment.