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

ClassCastException: when using double quotes labels in the restrict where to run textbox

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • core
    • None
    • Jenkins 2.60.3
      Jenkins 1.607

    Description

      Hi there,

      I've seen the below stacktrace:

      Caused by: java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom

      Which it's caused when using doublequotes restricted labels:

       

      When I debugged I saw the below details:

      Unfortunately I wasn't able to reproduce in my test scenario with something like:

      @Test public void testWithDoubleQuoteAssignedLabel() throws Exception {
          FreeStyleProject project = j.createFreeStyleProject();
          j.createSlave("test",null);
          project.setAssignedLabel(j.jenkins.getLabel("\"linux && !reserved\""));
          assertFalse(checker.executeCheck(project));
      }

       

      It looks like it is caused by: https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractProject.java#L413  and when configuring jobs using the WebUI. 

       

      Workaround: 

      • If i use "getAssignedLabel().getName()" I don't see that error...

       

      Please find attached the maven dependencies tree

      If you need further details please let me know

       

      Thanks

       

      Attachments

        Activity

          v2v Victor Martinez created issue -
          v2v Victor Martinez made changes -
          Field Original Value New Value
          Issue Type New Feature [ 2 ] Bug [ 1 ]

          People

            Unassigned Unassigned
            v2v Victor Martinez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: