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 Dec 17, 2024
1 parent 0980069 commit bfb61d1
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,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 @@ -1437,7 +1438,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 @@ -1446,7 +1451,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 @@ -1931,7 +1936,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 bfb61d1

Please sign in to comment.