Skip to content

Commit

Permalink
Fix bug in getInternalId that failed if an id was passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwallen committed Sep 29, 2023
1 parent a1f4d6c commit 9fe56a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion services/src/main/java/org/fao/geonet/api/ApiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ public static String getInternalId(String uuidOrInternalId, Boolean approved)
throws Exception {

IMetadataUtils metadataUtils = ApplicationContextHolder.get().getBean(IMetadataUtils.class);
String id = String.valueOf(metadataUtils.findOneByUuid(uuidOrInternalId).getId());
AbstractMetadata metadata = metadataUtils.findOneByUuid(uuidOrInternalId);
String id = null;
if (metadata != null) {
id = String.valueOf(metadata.getId());
}

if (StringUtils.isEmpty(id)) {
//It wasn't a UUID
Expand Down

0 comments on commit 9fe56a6

Please sign in to comment.