improved npe safety formatMessage method
This commit is contained in:
parent
14a0f7d687
commit
7ada30807d
|
@ -425,13 +425,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||||
String message;
|
String message = theMessage;
|
||||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||||
message = i18Nmessages.getString(theMessage);
|
} else {
|
||||||
} else {
|
message = i18Nmessages.getString(theMessage);
|
||||||
message = theMessage;
|
}
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,13 +464,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||||
String message;
|
String message = theMessage;
|
||||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||||
message = i18Nmessages.getString(theMessage);
|
} else {
|
||||||
} else {
|
message = i18Nmessages.getString(theMessage);
|
||||||
message = theMessage;
|
}
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1197,13 +1197,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||||
String message;
|
String message = theMessage;
|
||||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||||
message = i18Nmessages.getString(theMessage);
|
} else {
|
||||||
} else {
|
message = i18Nmessages.getString(theMessage);
|
||||||
message = theMessage;
|
}
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1297,13 +1297,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||||
String message;
|
String message = theMessage;
|
||||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||||
message = i18Nmessages.getString(theMessage);
|
} else {
|
||||||
} else {
|
message = i18Nmessages.getString(theMessage);
|
||||||
message = theMessage;
|
}
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue