Skip to content

Commit

Permalink
Merge pull request #416 from keeps/alindo-dev2
Browse files Browse the repository at this point in the history
Fixed NPE when metadata not selected
  • Loading branch information
luis100 authored Mar 11, 2024
2 parents ae6cbf5 + 885140b commit 437a77c
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 437a77c

Please sign in to comment.