You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2015/08/31 17:10:07 UTC

[Bug 58310] New: The last globalproperty (-G) command line file parameter overwrites all previously set global properties

https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

            Bug ID: 58310
           Summary: The last globalproperty (-G) command line file
                    parameter overwrites all previously set global
                    properties
           Product: JMeter
           Version: 2.13
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: lars.holmberg@redshirt.se

Example:

./jmeter -Gfirst.properties -Gname=value -Gsecond.properties (...)

Expected result:

Both properties from first.properties, the "name" property and
second.properties should be loaded & sent to load gen servers.

Actual result:

Only properties from second.properties is loaded.

Looking at the code (JMeter.java), this is no surprise:

case JMETER_GLOBAL_PROP:
    if (value.length() > 0) { // Set it
        log.info("Setting Global property: " + name + "=" + value);
        remoteProps.setProperty(name, value);
    } else {
        File propFile = new File(name);
        if (propFile.canRead()) {
            log.info("Setting Global properties from the file "+name);
            try {
                fis = new FileInputStream(propFile);
                remoteProps.load(fis); // THIS WILL OVERWRITE ANY PREVIOUSLY
LOADED PROPERTIES
            } catch
...

I can create a patch if you want me to. A long time ago there was a similar
issue for "normal" (non-distributed) property loading but it was fixed (33920).

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
             Status|NEW                         |NEEDINFO

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Hello,
Could you provide more details on your use case ?
For now current behaviour does not hurt me.

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

--- Comment #3 from Sebb <se...@apache.org> ---
Note: there is a simple work-round - just concatenate the files into a new file
before starting the test.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

Lars H <la...@redshirt.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

Lars H <la...@redshirt.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Lars H <la...@redshirt.se> ---
Verified that the problem is still there in latest nightly.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

Sebb <se...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WORKSFORME
             Status|NEW                         |RESOLVED

--- Comment #5 from Sebb <se...@apache.org> ---
(In reply to Lars H from comment #0)
>                 remoteProps.load(fis); // THIS WILL OVERWRITE ANY PREVIOUSLY
> LOADED PROPERTIES

That is _not_ true; the load method *adds* properties to the list, at least
when using Mac Java 6 and Oracle Java 7,8,9.

The following demo code shows this:

        Properties p = new Properties();
        p.load(new StringReader("a=1"));
        p.load(new StringReader("b=2"));
        p.list(System.out);

The output should be (order may vary):

-- listing properties --
b=2
a=1

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 58310] The last globalproperty (-G) command line file parameter overwrites all previously set global properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58310

--- Comment #4 from Lars H <la...@redshirt.se> ---
Phillipe, primarily I want to be able to specify more than one properties file
and have it work the same way as the -q parameter.

Sebb, yes that works. Giving all properties as name-value pairs also works. But
the feature is still broken, and in a very unpredictable way. 

For example, "... -Gsome.properties -Gaproperty=value" will work just fine
(creating aproperty property, and overriding it if it already exists), but
reversing the order of the parameters will discard the "aproperty" property
(even if it does not exist in some.properties)

-- 
You are receiving this mail because:
You are the assignee for the bug.