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

Problems occurs on injecting env vars as a build step: Malformed \uxxxx encoding.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • envinject-plugin
    • None
    • Jenkins 2.23, envinject 1.93, Linux, Windows 7 slaves

      After updating to the latest version of the envinject plugin, injecting an environment properties file (which is basically a "set > env.props") does not work any more. The error message reads:

      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties file path 'generated_environment.props'
      [EnvInject] - [ERROR] - Problems occurs on injecting env vars as a build step: Malformed \uxxxx encoding.
      

      Steps to reprocude

      1. Update envinject plugin to v1.93
      2. Have a job with two build steps:
        • Execute Windows batch command (which basically does a set > env.props
        • Inject environment variables, properties file path=env.props
      3. Expected result: environment is updated
      4. Actual result: Error message is shown (Problems occurs on injecting env vars as a build step: Malformed \uxxxx encoding.)

          [JENKINS-38561] Problems occurs on injecting env vars as a build step: Malformed \uxxxx encoding.

          Oleg Nenashev added a comment -

          Please provide the generated_environment.props file. Likely it's an issue with backslashes (see compatibility notes on the Wiki)

          Oleg Nenashev added a comment - Please provide the generated_environment.props file. Likely it's an issue with backslashes (see compatibility notes on the Wiki)

          Philipp Baer added a comment -

          It's the env.props I've attached. Had to anonymise it a bit before attaching it.

          Philipp Baer added a comment - It's the env.props I've attached. Had to anonymise it a bit before attaching it.

          David Wimsey added a comment - - edited

          This new behavior only tends to show up for windows users who use \ instead of / for directory separators.

          I believe this commit:
          https://github.com/jenkinsci/envinject-plugin/commit/e64c47d89c0c9865e5ab6578172cf6d203e3b8a0
          on line 104 of PropertiesLoader.java (being removed) is why this is suddenly showing itself.

          David Wimsey added a comment - - edited This new behavior only tends to show up for windows users who use \ instead of / for directory separators. I believe this commit: https://github.com/jenkinsci/envinject-plugin/commit/e64c47d89c0c9865e5ab6578172cf6d203e3b8a0 on line 104 of PropertiesLoader.java (being removed) is why this is suddenly showing itself.

          David Wimsey added a comment -

          Additionally, here is the stack trace of the error from the system.log

          WARNING: Problems occurs on injecting env vars defined in the build wrapper for build

          {0}

          java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
          at java.util.Properties.loadConvert(Properties.java:574)
          at java.util.Properties.load0(Properties.java:391)
          at java.util.Properties.load(Properties.java:317)
          at org.jenkinsci.plugins.envinject.service.PropertiesLoader.getVars(PropertiesLoader.java:76)
          at org.jenkinsci.plugins.envinject.service.PropertiesLoader.getVarsFromPropertiesContent(PropertiesLoader.java:65)
          at org.jenkinsci.plugins.envinject.EnvInjectInfo.getPropertiesContentMap(EnvInjectInfo.java:68)
          at org.jenkinsci.plugins.envinject.EnvInjectBuildWrapper.setUp(EnvInjectBuildWrapper.java:105)
          at hudson.model.Build$BuildExecution.doRun(Build.java:156)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          at hudson.model.Run.execute(Run.java:1720)
          at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          at hudson.model.ResourceController.execute(ResourceController.java:98)
          at hudson.model.Executor.run(Executor.java:404)

          David Wimsey added a comment - Additionally, here is the stack trace of the error from the system.log WARNING: Problems occurs on injecting env vars defined in the build wrapper for build {0} java.lang.IllegalArgumentException: Malformed \uxxxx encoding. at java.util.Properties.loadConvert(Properties.java:574) at java.util.Properties.load0(Properties.java:391) at java.util.Properties.load(Properties.java:317) at org.jenkinsci.plugins.envinject.service.PropertiesLoader.getVars(PropertiesLoader.java:76) at org.jenkinsci.plugins.envinject.service.PropertiesLoader.getVarsFromPropertiesContent(PropertiesLoader.java:65) at org.jenkinsci.plugins.envinject.EnvInjectInfo.getPropertiesContentMap(EnvInjectInfo.java:68) at org.jenkinsci.plugins.envinject.EnvInjectBuildWrapper.setUp(EnvInjectBuildWrapper.java:105) at hudson.model.Build$BuildExecution.doRun(Build.java:156) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1720) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404)

          Oleg Nenashev added a comment -

          Yes, likely it's caused by JENKINS-31573, which is a documented compatibility change

          Oleg Nenashev added a comment - Yes, likely it's caused by JENKINS-31573 , which is a documented compatibility change

          Walt D added a comment -

          I am also experiencing this, and it's a major issue for me.

          Walt D added a comment - I am also experiencing this, and it's a major issue for me.

          I am also experiencing this issue, but I think the cases that result in the error may be more varied.  Thought I would add my usage that results in the error incase it's helpful:

           

          I have a job that is not using a file content, it's just direct properties content entered in the job window.  There are three steps, EnvInject, run a Windows Batch Script, and then EnvInject again.  The first EnvInject and windows batch script work fine, but we encounter the reported error when the second EnvInject happens after the script.  Both of the EnvInject content includes backslashes and forward slashes in the property values.

          Paul Willworth added a comment - I am also experiencing this issue, but I think the cases that result in the error may be more varied.  Thought I would add my usage that results in the error incase it's helpful:   I have a job that is not using a file content, it's just direct properties content entered in the job window.  There are three steps, EnvInject, run a Windows Batch Script, and then EnvInject again.  The first EnvInject and windows batch script work fine, but we encounter the reported error when the second EnvInject happens after the script.  Both of the EnvInject content includes backslashes and forward slashes in the property values.

          Oleg Nenashev added a comment -

          Unfortunately I will not have time to work on EnvInject issues for a while. I decided to unassign all issues so that somebody can take them and finalize.

          Context: The plugin has been waiting for adoption for ~2 years. During all this time I was trying to keep this plugin afloat by reviewing the incoming pull requests, fixing defects and keeping the codebase up to date to simplify the handover. But I have not been using this plugin on my own so that such maintenance was a bit lame. I invite all active users to contribute to the plugin by taking ownership of this plugin and of EnvInject API. I am happy to provide any required knowledge transfers and do some assistance during the first months of maintenance

          Oleg Nenashev added a comment - Unfortunately I will not have time to work on EnvInject issues for a while. I decided to unassign all issues so that somebody can take them and finalize. Context: The plugin has been waiting for adoption for ~2 years. During all this time I was trying to keep this plugin afloat by reviewing the incoming pull requests, fixing defects and keeping the codebase up to date to simplify the handover. But I have not been using this plugin on my own so that such maintenance was a bit lame. I invite all active users to contribute to the plugin by taking ownership of this plugin and of EnvInject API. I am happy to provide any required knowledge transfers and do some assistance during the first months of maintenance

            Unassigned Unassigned
            phbaer Philipp Baer
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: