• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      If set project password parameter and define default value and click on Save
      button, that this value is not stored in config.xml for project.

      I use actually this workaround:
      store element <defaultValue>password</defaultValue> to
      <hudson.model.PasswordParameterDefinition/> element and reload configuration.
      But this sollusion has secuirty issue that password is in plain format.

      Thanks for fix

      Petr Prochazka

          [JENKINS-4333] Not set default value for password parameter

          Alan Harder added a comment -

          where exactly are you setting a "project password parameter"? it would help if
          you can list the steps to see this problem in more detail, thanks.

          Alan Harder added a comment - where exactly are you setting a "project password parameter"? it would help if you can list the steps to see this problem in more detail, thanks.

          pprochazka added a comment -

          I specified parameter for actually project:

          • name: SCM_PASSWD
          • default value: guest

          And used in Build section in MAVEN_OPTS parameter

          • MAVEN_OPTS: -Xmx256M -Xms128M -Dusername=${SCM_USER} -Dpassword=${SCM_PASSWD}

          Problem is if default value is not set then build failed by NPE:
          ERROR: Processing failed due to a bug in the code. Please report this to
          users@hudson.dev.java.net
          java.lang.NullPointerException
          at java.util.Hashtable.put(Hashtable.java:394)
          at java.util.Hashtable.putAll(Hashtable.java:466)
          at hudson.maven.MavenBuilder.call(MavenBuilder.java:156)
          at hudson.maven.MavenModuleSetBuild$Builder.call
          (MavenModuleSetBuild.java:677)
          at hudson.maven.MavenModuleSetBuild$Builder.call
          (MavenModuleSetBuild.java:623)
          at hudson.remoting.UserRequest.perform(UserRequest.java:103)
          at hudson.remoting.UserRequest.perform(UserRequest.java:47)
          at hudson.remoting.Request$2.run(Request.java:236)
          at java.util.concurrent.Executors$RunnableAdapter.call
          (Executors.java:441)
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
          at java.util.concurrent.FutureTask.run(FutureTask.java:138)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask
          (ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run
          (ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:619)

          pprochazka added a comment - I specified parameter for actually project: name: SCM_PASSWD default value: guest And used in Build section in MAVEN_OPTS parameter MAVEN_OPTS: -Xmx256M -Xms128M -Dusername=${SCM_USER} -Dpassword=${SCM_PASSWD} Problem is if default value is not set then build failed by NPE: ERROR: Processing failed due to a bug in the code. Please report this to users@hudson.dev.java.net java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:394) at java.util.Hashtable.putAll(Hashtable.java:466) at hudson.maven.MavenBuilder.call(MavenBuilder.java:156) at hudson.maven.MavenModuleSetBuild$Builder.call (MavenModuleSetBuild.java:677) at hudson.maven.MavenModuleSetBuild$Builder.call (MavenModuleSetBuild.java:623) at hudson.remoting.UserRequest.perform(UserRequest.java:103) at hudson.remoting.UserRequest.perform(UserRequest.java:47) at hudson.remoting.Request$2.run(Request.java:236) at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)

          rtlusty added a comment -

          Only to describe to complete background of this issue.

          The whole idea was to create job, which will cover the most operations on
          typical Maven project
          – periodically try verify (triggered by SCM changes)
          – allow creating of snaphosts
          – creating of releases

          This we have achieved by declaring of Maven goal as string parameter - works OK.

          However for release, we have to pass user/password for SCM to Maven (since our
          SVN has access control). That's why we have introduced optional job parameters

          • SCM_USER and SCM_PASSWD.

          Problem is, that if the job is now triggered automatically (by SCM polling),
          the password parameter is null and causes above mentioned NPE.

          It seems, that behavior of password parameter differs from plain string
          parameter, because if are used just string parameters it works.

          rtlusty added a comment - Only to describe to complete background of this issue. The whole idea was to create job, which will cover the most operations on typical Maven project – periodically try verify (triggered by SCM changes) – allow creating of snaphosts – creating of releases This we have achieved by declaring of Maven goal as string parameter - works OK. However for release, we have to pass user/password for SCM to Maven (since our SVN has access control). That's why we have introduced optional job parameters SCM_USER and SCM_PASSWD. Problem is, that if the job is now triggered automatically (by SCM polling), the password parameter is null and causes above mentioned NPE. It seems, that behavior of password parameter differs from plain string parameter, because if are used just string parameters it works.

          Alan Harder added a comment -

          started

          Alan Harder added a comment - started

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/PasswordParameterDefinition.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=21553
          Log:
          [FIXED JENKINS-4333] rename constructor param from defaultvalue to defaultValue
          so it works properly with @DataBoundConstructor

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/core/src/main/java/hudson/model/PasswordParameterDefinition.java http://fisheye4.cenqua.com/changelog/hudson/?cs=21553 Log: [FIXED JENKINS-4333] rename constructor param from defaultvalue to defaultValue so it works properly with @DataBoundConstructor

            mindless Alan Harder
            pprochazka pprochazka
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: