Skip to content

Commit

Permalink
Fixed NPE when metadata not selected
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 committed Mar 11, 2024
1 parent ae6cbf5 commit 885140b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ private Pair createEarkSip(Sip descriptionObject) {
if (metadataPath == null) {
String content = descriptionObject.getMetadataWithReplaces(descObjMetadata);
metadataPath = descObjMetadata.getPath();
if (metadataPath == null) {
metadataPath = tempDir.resolve(descObjMetadata.getId());
}
FileUtils.writeStringToFile(metadataPath.toFile(), content, Constants.RODAIN_DEFAULT_ENCODING);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ private Pair createHungarianSip(Sip descriptionObject) {
if (metadataPath == null) {
String content = descriptionObject.getMetadataWithReplaces(descObjMetadata);
metadataPath = descObjMetadata.getPath();
if (metadataPath == null) {
metadataPath = tempDir.resolve(descObjMetadata.getId());
}
FileUtils.writeStringToFile(metadataPath.toFile(), content, Constants.RODAIN_DEFAULT_ENCODING);
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/roda/rodain/core/creation/SipCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ protected Pair createEarkSip(final Sip descriptionObject) {
if (metadataPath == null) {
final String content = descriptionObject.getMetadataWithReplaces(descObjMetadata);
metadataPath = descObjMetadata.getPath();
if (metadataPath == null) {
metadataPath = tempDir.resolve(descObjMetadata.getId());
}
FileUtils.writeStringToFile(metadataPath.toFile(), content, Constants.RODAIN_DEFAULT_ENCODING);
}

Expand Down

0 comments on commit 885140b

Please sign in to comment.