parameter filter can only filter by StringParameterValue, BooleanParameterValue and FileParameterValue. So we can't filter by custom parameters.

      I can't understand why can't we change ParameterFilter class getStringValue function to something like this:

      protected String getStringValue(ParameterValue value) {
      		if (value instanceof StringParameterValue) {
      			return ((StringParameterValue) value).value;
      		} else if (value instanceof BooleanParameterValue) {
      			boolean bval = ((BooleanParameterValue) value).value;
      			return String.valueOf(bval);
      		} else if (value instanceof FileParameterValue) {
      			// not the full path - just the name
      			// this is the only public value available to us
      			String file = ((FileParameterValue) value).getOriginalFileName();
      			return file;
      		} else {
      			return value.toString();
      		}
      	}
      

      mine difference is return value.toString(); not return null;

          [JENKINS-18386] more flexible job filter by parameter

          Maris Zulis created issue -
          Maris Zulis made changes -
          Description Original: parameter filter can only filter by StringParameterValue, BooleanParameterValue and FileParameterValue. So we can't filter by custom parameters.

          I can't understand why can't we change ParameterFilter class getStringValue function to something like this:

          protected String getStringValue(ParameterValue value) {
          if (value instanceof StringParameterValue) {
          return ((StringParameterValue) value).value;
          } else if (value instanceof BooleanParameterValue) {
          boolean bval = ((BooleanParameterValue) value).value;
          return String.valueOf(bval);
          } else if (value instanceof FileParameterValue) {
          // not the full path - just the name
          // this is the only public value available to us
          String file = ((FileParameterValue) value).getOriginalFileName();
          return file;
          } else {
          return value.toString();
          }
          }


          mine difference is return value.toString(); not return null;
          New: parameter filter can only filter by StringParameterValue, BooleanParameterValue and FileParameterValue. So we can't filter by custom parameters.

          I can't understand why can't we change ParameterFilter class getStringValue function to something like this:

          {code:none}
          protected String getStringValue(ParameterValue value) {
          if (value instanceof StringParameterValue) {
          return ((StringParameterValue) value).value;
          } else if (value instanceof BooleanParameterValue) {
          boolean bval = ((BooleanParameterValue) value).value;
          return String.valueOf(bval);
          } else if (value instanceof FileParameterValue) {
          // not the full path - just the name
          // this is the only public value available to us
          String file = ((FileParameterValue) value).getOriginalFileName();
          return file;
          } else {
          return value.toString();
          }
          }
          {code}

          mine difference is return value.toString(); not return null;
          Jacob Robertson made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 149693 ] New: JNJira + In-Review [ 193245 ]

            jacob_robertson Jacob Robertson
            mzulis Maris Zulis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: