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
|
||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||
String message;
|
||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
} else {
|
||||
message = theMessage;
|
||||
String message = theMessage;
|
||||
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -464,13 +464,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
|
||||
@Override
|
||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||
String message;
|
||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
} else {
|
||||
message = theMessage;
|
||||
String message = theMessage;
|
||||
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1197,13 +1197,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
|
||||
@Override
|
||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||
String message;
|
||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
} else {
|
||||
message = theMessage;
|
||||
String message = theMessage;
|
||||
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
|
|
@ -1297,13 +1297,13 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
|||
|
||||
@Override
|
||||
public String formatMessage(String theMessage, Object... theMessageArguments) {
|
||||
String message;
|
||||
if (theMessageArguments != null && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else if (i18Nmessages.containsKey(theMessage)) {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
} else {
|
||||
message = theMessage;
|
||||
String message = theMessage;
|
||||
if (Objects.nonNull(i18Nmessages) && i18Nmessages.containsKey(theMessage)) {
|
||||
if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) {
|
||||
message = MessageFormat.format(i18Nmessages.getString(theMessage), theMessageArguments);
|
||||
} else {
|
||||
message = i18Nmessages.getString(theMessage);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue