mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
91680: Use log4j2 placeholders where possible
This commit is contained in:

committed by
Ben Bosman

parent
f9b0274ead
commit
63afa07e27
@@ -305,12 +305,12 @@ public class VersioningConsumer implements Consumer {
|
|||||||
// check if both items have an entity type
|
// check if both items have an entity type
|
||||||
if (latestItemEntityType == null || previousItemEntityType == null) {
|
if (latestItemEntityType == null || previousItemEntityType == null) {
|
||||||
if (previousItemEntityType != null) {
|
if (previousItemEntityType != null) {
|
||||||
log.warn(String.format(
|
log.warn(
|
||||||
"Inconsistency: Item with uuid %s, handle %s has NO entity type, " +
|
"Inconsistency: Item with uuid {}, handle {} has NO entity type, " +
|
||||||
"but the previous version of that item with uuid %s, handle %s has entity type %s",
|
"but the previous version of that item with uuid {}, handle {} has entity type {}",
|
||||||
latestItem.getID(), latestItem.getHandle(),
|
latestItem.getID(), latestItem.getHandle(),
|
||||||
previousItem.getID(), previousItem.getHandle(), previousItemEntityType
|
previousItem.getID(), previousItem.getHandle(), previousItemEntityType
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// one or both items do not have an entity type, so comparing is pointless
|
// one or both items do not have an entity type, so comparing is pointless
|
||||||
@@ -319,22 +319,22 @@ public class VersioningConsumer implements Consumer {
|
|||||||
|
|
||||||
// check if the entity types are equal
|
// check if the entity types are equal
|
||||||
if (!StringUtils.equals(latestItemEntityType, previousItemEntityType)) {
|
if (!StringUtils.equals(latestItemEntityType, previousItemEntityType)) {
|
||||||
log.warn(String.format(
|
log.warn(
|
||||||
"Inconsistency: Item with uuid %s, handle %s has entity type %s, " +
|
"Inconsistency: Item with uuid {}, handle {} has entity type {}, " +
|
||||||
"but the previous version of that item with uuid %s, handle %s has entity type %s",
|
"but the previous version of that item with uuid {}, handle {} has entity type {}",
|
||||||
latestItem.getID(), latestItem.getHandle(), latestItemEntityType,
|
latestItem.getID(), latestItem.getHandle(), latestItemEntityType,
|
||||||
previousItem.getID(), previousItem.getHandle(), previousItemEntityType
|
previousItem.getID(), previousItem.getHandle(), previousItemEntityType
|
||||||
));
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// success - the entity types of both items are non-null and equal
|
// success - the entity types of both items are non-null and equal
|
||||||
log.info(String.format(
|
log.info(
|
||||||
"Item with uuid %s, handle %s and the previous version of that item with uuid %s, handle %s " +
|
"Item with uuid {}, handle {} and the previous version of that item with uuid {}, handle {} " +
|
||||||
"have the same entity type: %s",
|
"have the same entity type: {}",
|
||||||
latestItem.getID(), latestItem.getHandle(), previousItem.getID(), previousItem.getHandle(),
|
latestItem.getID(), latestItem.getHandle(), previousItem.getID(), previousItem.getHandle(),
|
||||||
latestItemEntityType
|
latestItemEntityType
|
||||||
));
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,11 +349,11 @@ public class VersioningConsumer implements Consumer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (mdvs.size() > 1) {
|
if (mdvs.size() > 1) {
|
||||||
log.warn(String.format(
|
log.warn(
|
||||||
"Item with uuid %s, handle %s has %s entity types (%s), expected 1 entity type",
|
"Item with uuid {}, handle {} has {} entity types ({}), expected 1 entity type",
|
||||||
item.getID(), item.getHandle(), mdvs.size(),
|
item.getID(), item.getHandle(), mdvs.size(),
|
||||||
mdvs.stream().map(MetadataValue::getValue).collect(Collectors.toUnmodifiableList())
|
mdvs.stream().map(MetadataValue::getValue).collect(Collectors.toUnmodifiableList())
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String entityType = mdvs.get(0).getValue();
|
String entityType = mdvs.get(0).getValue();
|
||||||
@@ -378,10 +378,10 @@ public class VersioningConsumer implements Consumer {
|
|||||||
try {
|
try {
|
||||||
return entityTypeService.findByEntityType(ctx, entityTypeStr);
|
return entityTypeService.findByEntityType(ctx, entityTypeStr);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error(String.format(
|
log.error(
|
||||||
"Exception occurred when trying to obtain entity type with label %s of item with uuid %s, handle %s",
|
"Exception occurred when trying to obtain entity type with label {} of item with uuid {}, handle {}",
|
||||||
entityTypeStr, item.getID(), item.getHandle()
|
entityTypeStr, item.getID(), item.getHandle(), e
|
||||||
), e);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -396,10 +396,10 @@ public class VersioningConsumer implements Consumer {
|
|||||||
try {
|
try {
|
||||||
return relationshipTypeService.findByEntityType(ctx, entityType);
|
return relationshipTypeService.findByEntityType(ctx, entityType);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error(String.format(
|
log.error(
|
||||||
"Exception occurred when trying to obtain relationship types via entity type with id %s, label %s",
|
"Exception occurred when trying to obtain relationship types via entity type with id {}, label {}",
|
||||||
entityType.getID(), entityType.getLabel()
|
entityType.getID(), entityType.getLabel(), e
|
||||||
), e);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -415,11 +415,11 @@ public class VersioningConsumer implements Consumer {
|
|||||||
try {
|
try {
|
||||||
return relationshipService.findByItemAndRelationshipType(ctx, item, relationshipType, -1, -1, false);
|
return relationshipService.findByItemAndRelationshipType(ctx, item, relationshipType, -1, -1, false);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error(String.format(
|
log.error(
|
||||||
"Exception occurred when trying to obtain relationships of type with id %s, rightward name %s " +
|
"Exception occurred when trying to obtain relationships of type with id {}, rightward name {} " +
|
||||||
"for item with uuid %s, handle %s",
|
"for item with uuid {}, handle {}",
|
||||||
relationshipType.getID(), relationshipType.getRightwardType(), item.getID(), item.getHandle()
|
relationshipType.getID(), relationshipType.getRightwardType(), item.getID(), item.getHandle(), e
|
||||||
), e);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -99,13 +99,13 @@ public class RelationshipVersioningUtils {
|
|||||||
throw new IllegalStateException(msg);
|
throw new IllegalStateException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(String.format(
|
log.info(
|
||||||
"set latest version status from %s to %s for relationship with id %s, rightward name %s " +
|
"set latest version status from {} to {} for relationship with id {}, rightward name {} " +
|
||||||
"between left item with uuid %s, handle %s and right item with uuid %s, handle %s",
|
"between left item with uuid {}, handle {} and right item with uuid {}, handle {}",
|
||||||
lvs, newVersionStatus, relationship.getID(), relationship.getRelationshipType().getRightwardType(),
|
lvs, newVersionStatus, relationship.getID(), relationship.getRelationshipType().getRightwardType(),
|
||||||
relationship.getLeftItem().getID(), relationship.getLeftItem().getHandle(),
|
relationship.getLeftItem().getID(), relationship.getLeftItem().getHandle(),
|
||||||
relationship.getRightItem().getID(), relationship.getRightItem().getHandle()
|
relationship.getRightItem().getID(), relationship.getRightItem().getHandle()
|
||||||
));
|
);
|
||||||
relationship.setLatestVersionStatus(newVersionStatus);
|
relationship.setLatestVersionStatus(newVersionStatus);
|
||||||
|
|
||||||
return updateLeftSide ? LEFT_SIDE_CHANGED : RIGHT_SIDE_CHANGED;
|
return updateLeftSide ? LEFT_SIDE_CHANGED : RIGHT_SIDE_CHANGED;
|
||||||
|
Reference in New Issue
Block a user