Skip to content

Fixed bug in SampleSaveConfiguration.java where the static initiali… - #6771

Closed
ruthst00 wants to merge 2 commits into
apache:masterfrom
ruthst00:fix/jmeter-6395-saveservice-url
Closed

ruthst00 wants to merge 2 commits into
apache:masterfrom
ruthst00:fix/jmeter-6395-saveservice-url

Conversation

@ruthst00

@ruthst00 ruthst00 commented Sep 24, 2026 •

Copy link
Copy Markdown

…zer used TRUE as the fallback default for jmeter.save.saveservice.url instead of FALSE

Description

The property was changed to default true at some point around JMeter 5.0 (as evidenced by the comment in jmeter-batch.properties), but this was apparently unintentional or was later reverted in documentation without being reverted in code.

Changes Made (3 files)

  1. src/core/src/main/java/org/apache/jmeter/samplers/SampleSaveConfiguration.java — Changed the fallback default from TRUE → FALSE so that when jmeter.save.saveservice.url is not set, URLs are not saved (matching documented behavior).

  2. bin/jmeter.properties — Updated the commented-out example from #jmeter.save.saveservice.url=true → #jmeter.save.saveservice.url=false to correctly document the actual default.

  3. bin/testfiles/jmeter-batch.properties — Removed the now-redundant explicit jmeter.save.saveservice.url=false override and its stale "Since JMeter 5.0, defaults for this property is true" comment, since the code default is now correctly false.

Motivation and Context

Root Cause

A one-word bug in SampleSaveConfiguration.java — the static initializer used TRUE as the fallback default for jmeter.save.saveservice.url instead of FALSE:

// Before (broken):
URL = TRUE.equalsIgnoreCase(props.getProperty(SAVE_URL_PROP, TRUE));

// After (fixed):
URL = TRUE.equalsIgnoreCase(props.getProperty(SAVE_URL_PROP, FALSE));

This meant that when no jmeter.save.saveservice.url property was set, the URL was always saved regardless of user intent — contradicting the documented default of false in both xdocs/usermanual/properties_reference.xml and xdocs/usermanual/listeners.xml.

Fixes #6395

How Has This Been Tested?

A new test testUrlNotSavedByDefault() was added to TestSampleSaveConfiguration.java as a regression guard for the bug. It verifies two things:

  1. new SampleSaveConfiguration().saveUrl() returns false — a fresh instance with no property override must not save the URL, matching the documented default.
  2. SampleSaveConfiguration.staticConfig().saveUrl() returns false — the shared static configuration (used by listeners at runtime) must also reflect the correct default.

The test works because JMeterTestCase loads jmeter.properties (which now has #jmeter.save.saveservice.url=false commented out), so the code's fallback default of FALSE applies — exactly the condition that was broken before the fix. Had the old TRUE fallback still been in place, this test would have failed, making it a precise regression detector.

Also fixed broken tests in TestCSVSaveService, which had two tests hardcoded to the old (incorrect) default where URL was always included in CSV output:

  • testHeader() expected the header string to contain URL between allThreads and Latency
  • testSample() expected the result row to contain https://jmeter.apache.org at that same position

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the [code style][style-guide] of this project.
  • I have updated the documentation accordingly.

Generated with Claude Sonnet via Cline API Provider

…zer used `TRUE` as the fallback default for `jmeter.save.saveservice.url` instead of `FALSE`
…is not allowed in apache/jmeter because all actions must be from a repository owned by your enterprise, created by GitHub, or match one of the patterns.
@vlsi

vlsi commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks for looking into this. I'm closing the PR because the change goes in the wrong direction. Here is why.

The true default is intentional. jmeter.save.saveservice.url became true in JMeter 5.0, in b65d536 (Bug 62550). The same commit changed bin/jmeter.properties to #jmeter.save.saveservice.url=true and added # Since JMeter 5.0, defaults for this property is true to bin/testfiles/jmeter-batch.properties. Only the documentation was not updated: properties_reference.xml and listeners.xml still say false. So the mismatch should be fixed in the docs, not in the code.

Changing the default breaks existing setups. Anyone who writes CSV results with -l and no override would lose the URL column. Tools that read the CSV by column position would break without any error. jmeter -g would also misread a CSV without a header (print_field_names=false) written by 5.x, because CsvSampleReader builds the column list from the current defaults. testHeader and testSample in TestCSVSaveService exist to catch this kind of change, and their comment asks to check whether the default was changed on purpose.

The PR does not fix #6395. The issue reports that the URL is written even with jmeter.save.saveservice.url=false in user.properties. When the property is set, the code default is not used at all. The URL comes from the listener: Summary Report stores its SampleSaveConfiguration in the .jmx file, and a listener created while the default was true has <url>true</url> there. The setting in the test plan wins over the jmeter.save.saveservice.* properties, so that listener writes the URL until "Save URL" is unticked in its Configure dialog (Sample Result Save Configuration). I'm leaving #6395 open for that.

The workflow change belongs in a separate PR. gradle/actions/wrapper-validation@v5.0.2 is indeed no longer on the ASF allowlist. However, v6.2.0 is listed there with expires_at: 2026-10-30, and v6.3.0 (9c971963bec38e04b3d30dcc455b5382be2fdbfb) has no expiry date. I'll update the workflow separately.

If you want to follow up, a PR that updates properties_reference.xml and listeners.xml to say the default has been true since 5.0 would be welcome.

@vlsi vlsi closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jmeter.save.saveservice.url doesn't work in 5.6.3

2 participants