Skip to content

Commit

Permalink
fix(web2): Added better error message for password never set (#5163)
Browse files Browse the repository at this point in the history
* Added better error message for password never set

* Added japanese message.

* Updated Japanese message
  • Loading branch information
salvatore-coppola authored Mar 8, 2024
1 parent 48f793f commit dcbcceb
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2021 Eurotech and/or its affiliates and others
* Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -79,25 +79,28 @@ private static void printMessage(Throwable caught, String name) {

GwtKuraException gee = (GwtKuraException) caught;
GwtKuraErrorCode code = gee.getCode();

switch(code) {
case DUPLICATE_NAME:
errorMessageBuilder.append(MSGS.duplicateNameError());
break;
case CONNECTION_FAILURE:
errorMessageBuilder.append(MSGS.connectionFailure());
break;
case ILLEGAL_ARGUMENT:
errorMessageBuilder.append(MSGS.illegalArgumentError());
break;
case ILLEGAL_NULL_ARGUMENT:
errorMessageBuilder.append(MSGS.illegalNullArgumentError());
break;
case CERTIFICATE_PARSE_FAILURE:
errorMessageBuilder.append(MSGS.certificateParseFailure());
break;
default:
errorMessageBuilder.append(MSGS.genericError());

switch (code) {
case DUPLICATE_NAME:
errorMessageBuilder.append(MSGS.duplicateNameError());
break;
case CONNECTION_FAILURE:
errorMessageBuilder.append(MSGS.connectionFailure());
break;
case ILLEGAL_ARGUMENT:
errorMessageBuilder.append(MSGS.illegalArgumentError());
break;
case ILLEGAL_NULL_ARGUMENT:
errorMessageBuilder.append(MSGS.illegalNullArgumentError());
break;
case CERTIFICATE_PARSE_FAILURE:
errorMessageBuilder.append(MSGS.certificateParseFailure());
break;
case PASSWORD_NEVER_SET:
errorMessageBuilder.append(MSGS.passwordNeverSetError());
break;
default:
errorMessageBuilder.append(MSGS.genericError());
}

} else if (caught instanceof StatusCodeException && ((StatusCodeException) caught).getStatusCode() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,22 +351,22 @@ private static List<GwtNetInterfaceConfig> privateFindNetInterfaceConfigurations

// security
switch (wifiConfig.getSecurity()) {
case SECURITY_WPA:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA.name());
break;
case SECURITY_WPA2:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA2.name());
break;
case SECURITY_WPA_WPA2:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA_WPA2.name());
break;
case SECURITY_WEP:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWEP.name());
break;
case SECURITY_NONE:
default:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityNONE.name());
break;
case SECURITY_WPA:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA.name());
break;
case SECURITY_WPA2:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA2.name());
break;
case SECURITY_WPA_WPA2:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWPA_WPA2.name());
break;
case SECURITY_WEP:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityWEP.name());
break;
case SECURITY_NONE:
default:
gwtWifiConfig.setSecurity(GwtWifiSecurity.netWifiSecurityNONE.name());
break;
}

if (wifiConfig.getPairwiseCiphers() == WifiCiphers.CCMP_TKIP) {
Expand Down Expand Up @@ -430,25 +430,25 @@ private static List<GwtNetInterfaceConfig> privateFindNetInterfaceConfigurations
GwtWifiRadioMode gwtWifiRadioMode = null;
if (wifiConfig.getRadioMode() != null) {
switch (wifiConfig.getRadioMode()) {
case RADIO_MODE_80211a:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeA;
break;
case RADIO_MODE_80211b:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeB;
break;
case RADIO_MODE_80211g:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeBG;
break;
case RADIO_MODE_80211nHT20:
case RADIO_MODE_80211nHT40above:
case RADIO_MODE_80211nHT40below:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeBGN;
break;
case RADIO_MODE_80211_AC:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeANAC;
break;
default:
break;
case RADIO_MODE_80211a:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeA;
break;
case RADIO_MODE_80211b:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeB;
break;
case RADIO_MODE_80211g:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeBG;
break;
case RADIO_MODE_80211nHT20:
case RADIO_MODE_80211nHT40above:
case RADIO_MODE_80211nHT40below:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeBGN;
break;
case RADIO_MODE_80211_AC:
gwtWifiRadioMode = GwtWifiRadioMode.netWifiRadioModeANAC;
break;
default:
break;
}
}
if (gwtWifiRadioMode != null) {
Expand Down Expand Up @@ -1690,7 +1690,7 @@ private static void fillWifiPassphrase(GwtWifiConfig gwtWifiConfig, Map<String,
properties.put(wifiPassphrasePropName,
new Password(GwtSafeHtmlUtils.htmlUnescape(oldGwtWifiConfig.get().getPassword())));
} else {
throw new GwtKuraException(GwtKuraErrorCode.ILLEGAL_ARGUMENT);
throw new GwtKuraException(GwtKuraErrorCode.PASSWORD_NEVER_SET);
}

} else if (passKey != null && mode.equals(GwtWifiWirelessMode.netWifiWirelessModeAccessPoint.name())) {
Expand Down Expand Up @@ -1815,24 +1815,24 @@ private static WifiRadioMode getWifiConfigRadioMode(GwtWifiRadioMode radioMode)
WifiRadioMode wifiRadioMode;

switch (radioMode) {
case netWifiRadioModeA:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211a;
break;
case netWifiRadioModeB:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211b;
break;
case netWifiRadioModeBG:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211g;
break;
case netWifiRadioModeBGN:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211nHT20;
break;
case netWifiRadioModeANAC:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211_AC;
break;

default:
throw new GwtKuraException(GwtKuraErrorCode.ILLEGAL_ARGUMENT);
case netWifiRadioModeA:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211a;
break;
case netWifiRadioModeB:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211b;
break;
case netWifiRadioModeBG:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211g;
break;
case netWifiRadioModeBGN:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211nHT20;
break;
case netWifiRadioModeANAC:
wifiRadioMode = WifiRadioMode.RADIO_MODE_80211_AC;
break;

default:
throw new GwtKuraException(GwtKuraErrorCode.ILLEGAL_ARGUMENT);
}

return wifiRadioMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2022 Eurotech and/or its affiliates and others
* Copyright (c) 2011, 2024 Eurotech and/or its affiliates and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -33,5 +33,6 @@ public enum GwtKuraErrorCode {
RESOURCE_FETCHING_FAILURE,
CERTIFICATE_PARSE_FAILURE,
FAILURE_CLOSING_RESOURCES,
PASSWORD_CHANGE_SAME_PASSWORD;
PASSWORD_CHANGE_SAME_PASSWORD,
PASSWORD_NEVER_SET;
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ illegalNullArgumentError=Null argument provided. Please review.
certificateParseFailure=Error while parsing certificate. Please review.
unauthorizedError=The current identity is not allowed to perform the requested operation.
sessionExpiredError=The session has expired.
passwordNeverSetError=The password for this configuration has never been set. Please set it and apply the configuration again.

enable=Enable
disable=Disable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ illegalNullArgumentError=Nullの引数が出力されました。再度確認し
certificateParseFailure=証明書の解析中にエラーが発生しました。再度確認してください。
unauthorizedError=現在のユーザレベルでは要求された操作を行う権限がありません。
sessionExpiredError=セッションは終了しています。
passwordNeverSetError=このコンフィギュレーションのパスワードが設定されていません。パスワードを設定して、再度コンフィギュレーションを適用してください。

enable=有効化
disable=無効化
Expand Down

0 comments on commit dcbcceb

Please sign in to comment.