geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
430 stars 489 forks source link

Fix harvester execution logs added to previous logs #8387

Closed josegar74 closed 1 month ago

josegar74 commented 1 month ago

Test case:

  1. Create a harvester.
  2. Execute it and check the harvester history tab. The execution has a button to download the log file.
  3. Execute it 2 or more times and check the harvester history tab. Most probably is that the latest executions don't have the button to download the log file. Checking the previous log files, you can find out that are stored there.

The problem seems related to https://github.com/geonetwork/core-geonetwork/blob/1a780ac0d09f1a1df0cdbe23e513e8440c994227/core/src/main/java/org/fao/geonet/util/LogUtil.java#L74, as Quartz probably reuses threads and putIfNull does not update the value if a thread that had a set value has been reused. The other properties added to the ThreadContext are added using put instead. It is not clear why the log file name is added using putIfNull.

Checklist

sonarcloud[bot] commented 1 month ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud