@@ -306,7 +306,6 @@ private File getFileParameterFolderUnderBuild(AbstractBuild<?, ?> build) {
306306 @ Extension
307307 public static class CancelledQueueListener extends QueueListener {
308308
309- @ SuppressFBWarnings (value = "PATH_TRAVERSAL_IN" , justification = "False positive, the path is a temporary file" )
310309 @ Override
311310 public void onLeft (Queue .LeftItem li ) {
312311 if (li .isCancelled ()) {
@@ -315,20 +314,23 @@ public void onLeft(Queue.LeftItem li) {
315314 a .getAllParameters ().stream ()
316315 .filter (p -> p instanceof FileParameterValue )
317316 .map (p -> (FileParameterValue ) p )
318- .forEach (p -> {
319- if (p .tmpFileName != null ) {
320- File tmp = new File (p .tmpFileName );
321- try {
322- Files .deleteIfExists (tmp .toPath ());
323- } catch (IOException e ) {
324- LOGGER .log (Level .WARNING , "Unable to delete temporary file {0} for parameter {1} of task {2}" ,
325- new Object []{tmp .getAbsolutePath (), p .getName (), li .task .getName ()});
326- }
327- }
328- });
317+ .forEach (this ::deleteTmpFile );
329318 });
330319 }
331320 }
321+
322+ @ SuppressFBWarnings (value = "PATH_TRAVERSAL_IN" , justification = "False positive, the path is a temporary file" )
323+ private void deleteTmpFile (FileParameterValue p ) {
324+ if (p .tmpFileName != null ) {
325+ File tmp = new File (p .tmpFileName );
326+ try {
327+ Files .deleteIfExists (tmp .toPath ());
328+ } catch (IOException e ) {
329+ LOGGER .log (Level .WARNING , "Unable to delete temporary file {0} for parameter {1}" ,
330+ new Object []{tmp .getAbsolutePath (), p .getName ()});
331+ }
332+ }
333+ }
332334 }
333335
334336 /**
0 commit comments