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