Skip to content

Commit

Permalink
Merge pull request DSpace#9098 from kshepherd/bugfix/handleprovider_c…
Browse files Browse the repository at this point in the history
…lass_cast_7x

Additional Item class cast fixes in handle providers
  • Loading branch information
alanorth authored Oct 3, 2023
2 parents 8160f7c + 33d2ee9 commit 851123b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ public String register(Context context, DSpaceObject dso) {
try {
String id = mint(context, dso);

// move canonical to point the latest version
// Populate metadata
if (dso instanceof Item || dso instanceof Collection || dso instanceof Community) {
Item item = (Item) dso;
populateHandleMetadata(context, item, id);
populateHandleMetadata(context, dso, id);
}

return id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public String register(Context context, DSpaceObject dso) {
String id = mint(context, dso);

// move canonical to point the latest version
if (dso != null && dso.getType() == Constants.ITEM) {
if (dso.getType() == Constants.ITEM && dso instanceof Item) {
Item item = (Item) dso;
VersionHistory history = null;
VersionHistory history;
try {
history = versionHistoryService.findByItem(context, (Item) dso);
history = versionHistoryService.findByItem(context, item);
} catch (SQLException ex) {
throw new RuntimeException("A problem with the database connection occured.", ex);
}
Expand Down

0 comments on commit 851123b

Please sign in to comment.