Skip to content

Commit

Permalink
#287: Changed to use Optional.ofNullable to deal with nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
William Schey committed Jun 23, 2023
1 parent 622ae47 commit 5997ce7
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions core/src/main/java/org/bsc/confluence/model/SiteProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,14 @@ public Optional<Site.Page> getPage() {

@Override
public Optional<String> getPagePrefixToApply() {
if (pagePrefixToApply == null)
return MarkdownParserContext.super.getPagePrefixToApply();

return Optional.of(pagePrefixToApply);
return Optional.ofNullable(pagePrefixToApply);
}

@Override
public boolean isLinkPrefixEnabled() {
if( child.isIgnoreVariables() ) return false;

if (page == null)
return MarkdownParserContext.super.isLinkPrefixEnabled();

return Optional.of(page).map( p -> !p.getTitle().contains("[") ).orElse(true);
return Optional.ofNullable(page).map( p -> !p.getTitle().contains("[") ).orElse(true);

}
}, content);
Expand Down

0 comments on commit 5997ce7

Please sign in to comment.