Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE for files walk #54

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public void generate( HistoricalContentDTO content )
finally
{
buildConfigLocks.remove( buildConfigId );
logger.info( "lock released, buildConfigId {}", buildConfigId );
logger.info( "<<<Lock released for buildConfigId {}", buildConfigId );
}
} );
try
Expand Down Expand Up @@ -216,7 +216,7 @@ public void generate( HistoricalContentDTO content )
protected Boolean doGenerate( HistoricalContentDTO content )
{
String buildConfigId = content.getBuildConfigId();
logger.info( "Handle generate event: {}, build config id: {}", EVENT_GENERATE_ARCHIVE, buildConfigId );
logger.info( "<<<Handle generate event: {}, build config id: {}", EVENT_GENERATE_ARCHIVE, buildConfigId );

Map<String, HistoricalEntryDTO> entryDTOs = reader.readEntries( content );
Map<String, String> downloadPaths = new HashMap<>();
Expand Down Expand Up @@ -483,10 +483,15 @@ private boolean renderArchive( File part, final String buildConfigId )
public List<File> walkAllFiles( String path )
throws IOException
{
List<File> contents = Files.walk( Paths.get( path ) )
.filter( Files::isRegularFile )
.map( Path::toFile )
.collect( Collectors.toList() );
List<File> contents = new ArrayList<>();
Path directoryPath = Paths.get( path );
if ( Files.exists( directoryPath ) )
{
contents = Files.walk( directoryPath )
.filter( Files::isRegularFile )
.map( Path::toFile )
.collect( Collectors.toList() );
}
return contents;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ArchiveFileCleanup
void cleanup()
throws IOException
{
logger.info( "Start not used archive files cleanup." );
logger.info( "<<<Start not used archive files cleanup." );
String storeDir = preSeedConfig.storageDir().orElse( "data" );
String archiveDir = String.format( "%s%s", storeDir, ARCHIVE_DIR );

Expand All @@ -66,7 +66,7 @@ void cleanup()
{
artifact.delete();
logger.info(
"Not used archive files cleanup is finished for archive file: {}, not used days: {}, config: {}.",
"<<<Not used archive files cleanup is finished for archive file: {}, not used days: {}, config: {}.",
artifact.getPath(), days, notUsedDays );
}
}
Expand Down
Loading