Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5391

Dubious use of String.toUpperCase()


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None

      StringParameterValue.buildEnvVars says


      Say the user specified 'includedTests' in the job configuration and used an Ant script:

      <property env="env."/>
      <junit ... includes="${env.includedTests}"/>

      First of all, this will not work because only ${env.INCLUDEDTESTS} will be defined. It is nice that name.html says this will happen, but you would have to click the help button to see this unexpected behavior.

      Second, if you happen to run the Hudson server in Turkey, even that won't work because the environment variable will be ${env.─░NCLUDEDTESTS} due to the locale-sensitive upcasing!

      At a minimum, all usages of String.toUpper/LowerCase() in Hudson should be reviewed to see if passing Locale.ENGLISH would be more appropriate.

      In the case of *ParameterValue.buildEnvVars, it should be reconsidered whether automatic upcasing is even desirable; surely it is clearer to use an uppercase variable name in the job config if that is what you want to see during the build. (For compatibility, you could set both the upcased string and the original string, and remove the note about upcasing from the help text.)

            Unassigned Unassigned
            jglick Jesse Glick
            2 Vote for this issue
            3 Start watching this issue