Skip to content

Commit

Permalink
fix: NPE when tree is null [BISERVER-15190]
Browse files Browse the repository at this point in the history
  • Loading branch information
afrjorge committed Feb 27, 2025
1 parent 74290a6 commit 332b61a
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.channels.IllegalSelectorException;
import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.InvalidParameterException;
import java.text.Collator;
Expand Down Expand Up @@ -1500,7 +1501,11 @@ public RepositoryFileTreeDto doGetTree( String pathId, Integer depth, String fil
logger.error( e.getCause() );
}

//translating /home and /public folders titles
if ( tree == null ) {
return null;
}

// translating /home and /public folders titles
for ( RepositoryFileTreeDto dto : tree.getChildren() ) {
if ( dto.getFile().getName().equals( ClientRepositoryPaths.getHomeFolderName() ) && dto.getFile().getPath().equals( ClientRepositoryPaths.getHomeFolderPath() ) ) {
dto.getFile().setTitle( Messages.getInstance().getString( "FileResource.HOME_FOLDER_DISPLAY_TITLE" ) );
Expand All @@ -1509,7 +1514,7 @@ public RepositoryFileTreeDto doGetTree( String pathId, Integer depth, String fil
}
}
// BISERVER-9599 - Use special sort order
if ( tree != null && isShowingTitle( repositoryRequest ) ) {
if ( isShowingTitle( repositoryRequest ) ) {
Collator collator = getCollatorInstance();
collator.setStrength( Collator.PRIMARY ); // ignore case
sortByLocaleTitle( collator, tree );
Expand Down Expand Up @@ -1994,7 +1999,7 @@ private PentahoPlatformExporter getBackupExporter() {
protected String decode( String folder ) {
String decodeName = folder;
try {
decodeName = URLDecoder.decode( folder, "UTF-8" );
decodeName = URLDecoder.decode( folder, StandardCharsets.UTF_8 );
} catch ( Exception ex ) {
logger.error( ex );
}
Expand Down

0 comments on commit 332b61a

Please sign in to comment.