TSK-1009: replaced MessageFormat with String.format
This commit is contained in:
parent
85725a052c
commit
78cfd64902
|
@ -2,7 +2,6 @@ package pro.taskana.impl;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
@ -252,8 +251,8 @@ public class ClassificationServiceImpl implements ClassificationService {
|
|||
} catch (PersistenceException e) {
|
||||
if (isReferentialIntegrityConstraintViolation(e)) {
|
||||
throw new ClassificationInUseException(
|
||||
MessageFormat.format(
|
||||
"The classification id = \"{0}\" and key = \"{1}\" in domain = \"{2}\" "
|
||||
String.format(
|
||||
"The classification id = \"%s\" and key = \"%s\" in domain = \"%s\" "
|
||||
+ "is in use and cannot be deleted. There are either tasks or "
|
||||
+ "attachments associated with the classification.",
|
||||
classificationId, classification.getKey(), classification.getDomain()),
|
||||
|
@ -272,8 +271,8 @@ public class ClassificationServiceImpl implements ClassificationService {
|
|||
|
||||
} catch (Exception e) {
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat.format(
|
||||
"Invalid service level {0}. "
|
||||
String.format(
|
||||
"Invalid service level %s. "
|
||||
+ "The formats accepted are based on the ISO-8601 duration format "
|
||||
+ "PnDTnHnMn.nS with days considered to be exactly 24 hours. "
|
||||
+ "For example: \"P2D\" represents a period of \"two days.\" ",
|
||||
|
@ -286,8 +285,8 @@ public class ClassificationServiceImpl implements ClassificationService {
|
|||
|| !('d' == serviceLevelLower.charAt(serviceLevel.length() - 1))) {
|
||||
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat.format(
|
||||
"Invalid service level {0}. Taskana only supports service "
|
||||
String.format(
|
||||
"Invalid service level %s. Taskana only supports service "
|
||||
+ "levels that contain a number of whole days "
|
||||
+ "specified according to the format ''PnD'' where n is the number of days",
|
||||
serviceLevel));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
|
@ -1949,9 +1948,9 @@ public class TaskServiceImpl implements TaskService {
|
|||
att.getClassificationSummary().getId(),
|
||||
new ClassificationNotFoundException(
|
||||
id,
|
||||
MessageFormat.format(
|
||||
String.format(
|
||||
"When processing task updates due to change "
|
||||
+ "of classification, the classification with id {0}{1}",
|
||||
+ "of classification, the classification with id %s%s",
|
||||
id, WAS_NOT_FOUND2)));
|
||||
} else {
|
||||
att.setClassificationSummary(classificationSummary);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.taskana.impl;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -179,18 +178,18 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
|| workbasketAccessItem.getAccessId() == null
|
||||
|| workbasketAccessItem.getWorkbasketId() == null) {
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat.format(
|
||||
String.format(
|
||||
"Checking the preconditions of the current "
|
||||
+ "WorkbasketAccessItem failed. WorkbasketAccessItem={0}",
|
||||
workbasketAccessItem.toString()));
|
||||
+ "WorkbasketAccessItem failed. WorkbasketAccessItem=%s",
|
||||
workbasketAccessItem));
|
||||
}
|
||||
WorkbasketImpl wb = workbasketMapper.findById(workbasketAccessItem.getWorkbasketId());
|
||||
if (wb == null) {
|
||||
throw new WorkbasketNotFoundException(
|
||||
workbasketAccessItem.getWorkbasketId(),
|
||||
MessageFormat
|
||||
.format("WorkbasketAccessItem {0} refers to a not existing workbasket",
|
||||
workbasketAccessItem));
|
||||
String.format(
|
||||
"WorkbasketAccessItem %s refers to a not existing workbasket",
|
||||
workbasketAccessItem));
|
||||
}
|
||||
workbasketAccessMapper.insert(accessItem);
|
||||
LOGGER.debug(
|
||||
|
@ -221,16 +220,16 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
|||
(WorkbasketAccessItemImpl) workbasketAccessItem;
|
||||
if (wbAccessItemImpl.getWorkbasketId() == null) {
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat.format(
|
||||
String.format(
|
||||
"Checking the preconditions of the current WorkbasketAccessItem failed "
|
||||
+ "- WBID is NULL. WorkbasketAccessItem={0}",
|
||||
workbasketAccessItem.toString()));
|
||||
+ "- WBID is NULL. WorkbasketAccessItem=%s",
|
||||
workbasketAccessItem));
|
||||
} else if (!wbAccessItemImpl.getWorkbasketId().equals(workbasketId)) {
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat.format(
|
||||
String.format(
|
||||
"Checking the preconditions of the current WorkbasketAccessItem failed "
|
||||
+ "- the WBID does not match. Target-WBID=''{0}'' WorkbasketAccessItem={1}",
|
||||
workbasketId, workbasketAccessItem.toString()));
|
||||
+ "- the WBID does not match. Target-WBID=''%s'' WorkbasketAccessItem=%s",
|
||||
workbasketId, workbasketAccessItem));
|
||||
}
|
||||
if (wbAccessItemImpl.getId() == null || wbAccessItemImpl.getId().isEmpty()) {
|
||||
wbAccessItemImpl.setId(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -108,9 +107,8 @@ public class WorkbasketAccessItemController extends AbstractPagingController {
|
|||
}
|
||||
} else {
|
||||
throw new InvalidArgumentException(
|
||||
MessageFormat
|
||||
.format(
|
||||
"{0} corresponding to a group, not a user. "
|
||||
String.format(
|
||||
"%s corresponding to a group, not a user. "
|
||||
+ "You just can remove access items for a user",
|
||||
accessId));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue