[JIRA] (JENKINS-50330) checkJobName api always return an extra blank line in response body: " <div/>"

19 views
Skip to first unread message

xpblack@163.com (JIRA)

unread,
Mar 21, 2018, 11:54:03 PM3/21/18
to jenkinsc...@googlegroups.com
pan xu updated an issue
 
Jenkins / Bug JENKINS-50330
checkJobName api always return an extra blank line in response body: " <div/>"
Change By: pan xu
Summary: checkJobName api always return Incomplete an extra blank line in response body: "  <div/>"
Attachment: jenkinsbug.png
on create job page, when typing in the job name text box, Jenkins call checkJobName api to check the item name, but this api always return an Incomplete extra blank line in response body :   "  <div/>" .

It caused the UI disable the submit button and I could never create a job.
Please see the screenshot attached.

 

An example of the checkJobName api call and response:
Request URL:
[ http://myjenkins.com/view/all/checkJobName?value=dfd ]
Response:

HTTP/1.1 200 OK Date: Thu, 22 Mar 2018 02:33:27 GMT Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Vary: Accept-Encoding X-Content-Type-Options: nosniff Server: Tengine/Aserver Strict-Transport-Security: max-age=0 Timing-Allow-Origin: * EagleEye-TraceId: 0a67792f15216860072187973e2e7b RequestUri: jenkins.qa.umeng.com/view/all/checkJobName RequestApp: jenkins.qa.umeng.com Content-Encoding: gzip

 
<div/>


 
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

xpblack@163.com (JIRA)

unread,
Mar 21, 2018, 11:55:02 PM3/21/18
to jenkinsc...@googlegroups.com

xpblack@163.com (JIRA)

unread,
Mar 21, 2018, 11:56:01 PM3/21/18
to jenkinsc...@googlegroups.com
pan xu commented on Bug JENKINS-50330
 
Re: checkJobName api always return an extra blank line in response body: " <div/>"

compare to another Jenkins server on Mac, the Difference between response body is: the linux server return an extra empty line before the "<div/>", please see the screenshot attached. I update the bug description

cyberjoac@gmail.com (JIRA)

unread,
Jul 18, 2018, 1:50:01 PM7/18/18
to jenkinsc...@googlegroups.com

+1. Did you find any solution for this ? 

This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

dalibor.plavcic@gmail.com (JIRA)

unread,
Jul 21, 2018, 12:19:02 PM7/21/18
to jenkinsc...@googlegroups.com

dalibor.plavcic@gmail.com (JIRA)

unread,
Jul 21, 2018, 12:52:02 PM7/21/18
to jenkinsc...@googlegroups.com
Dalibor Plavcic updated an issue
Change By: Dalibor Plavcic
Attachment: jenkinsbug_select_item_from_the_list.png

dalibor.plavcic@gmail.com (JIRA)

unread,
Jul 21, 2018, 1:00:02 PM7/21/18
to jenkinsc...@googlegroups.com
Dalibor Plavcic commented on Bug JENKINS-50330
 
Re: checkJobName api always return an extra blank line in response body: " <div/>"

Hi,

from this screenshot I can't see if you selected any item (FreeStyle Project, Maven, Pipeline...) from the list.

When we first land on '/view/all/newJob' page no item category is selected (this is the key).

If we choose existing item name we won't be able to create new project which is ok, but if we choose non existing name we also won't be able to create new project because no item category is selected.

Preposition:

1) Add hover selector to OK button to provide user info to select item category.

 

 

dalibor.plavcic@gmail.com (JIRA)

unread,
Jul 21, 2018, 1:01:01 PM7/21/18
to jenkinsc...@googlegroups.com
Dalibor Plavcic started work on Bug JENKINS-50330
 
Change By: Dalibor Plavcic
Status: Open In Progress

dalibor.plavcic@gmail.com (JIRA)

unread,
Jul 21, 2018, 1:01:02 PM7/21/18
to jenkinsc...@googlegroups.com
Dalibor Plavcic edited a comment on Bug JENKINS-50330
Hi,

from this screenshot I can't see if you selected any item (FreeStyle Project, Maven, Pipeline...) from the list
. ?

When we first land on '/view/all/newJob' page no item category is selected (this is the key).

If we choose existing item name we won't be able to create new project which is ok, but if we choose non existing name we also won't be able to create new project because no item category is selected.

Preposition:

1) Add hover selector to OK button to provide user info to select item category.

 

 

dalibor.plavcic@gmail.com (JIRA)

unread,
Aug 9, 2018, 12:28:03 PM8/9/18
to jenkinsc...@googlegroups.com

dalibor.plavcic@gmail.com (JIRA)

unread,
Aug 9, 2018, 12:28:03 PM8/9/18
to jenkinsc...@googlegroups.com

xpblack@163.com (JIRA)

unread,
Nov 14, 2018, 3:38:03 AM11/14/18
to jenkinsc...@googlegroups.com
pan xu updated an issue
 
Jenkins / Improvement JENKINS-50330
Change By: pan xu
Attachment: selectItemfirst.png
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

xpblack@163.com (JIRA)

unread,
Nov 14, 2018, 3:38:03 AM11/14/18
to jenkinsc...@googlegroups.com
pan xu commented on Improvement JENKINS-50330
 
Re: checkJobName api always return an extra blank line in response body: " <div/>"

Sorry for the late reply. " select an item" is not the key root cause for this issue.

See the latest attached screenshot please. I select an item category first, then type in the name text box. the submit button is still disabled.

The root cause is (in screenshot) the checkJobName api return an extra blank line in response.

xpblack@163.com (JIRA)

unread,
Nov 14, 2018, 3:39:03 AM11/14/18
to jenkinsc...@googlegroups.com
pan xu edited a comment on Improvement JENKINS-50330
Sorry for the late reply. " select an item" is not the key root cause for this issue.

See the latest attached screenshot please. I select an item category first, then type in the name text box. the submit button is still disabled.

The root cause is (in screenshot) the [checkJobName|http://myjenkins.com/view/all/checkJobName?value=dfd] api return an extra blank line in response. !selectItemfirst.png |width=744,height=434 !

wayne@zanran.me (JIRA)

unread,
Mar 5, 2019, 1:04:02 AM3/5/19
to jenkinsc...@googlegroups.com
wayne he commented on Improvement JENKINS-50330

Same issue found for Jenkins. Everybody who fixed this issue ?

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 3:30:02 AM9/25/19
to jenkinsc...@googlegroups.com
A Z updated an issue
 
Jenkins / Bug JENKINS-50330
Change By: A Z
Issue Type: Improvement Bug
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:07:03 AM9/25/19
to jenkinsc...@googlegroups.com
A Z commented on Bug JENKINS-50330
 
Re: checkJobName api always return an extra blank line in response body: " <div/>"

This is a bug in the add-item.js on index.html.

The server sometimes will response with "\n</div>", and the page can't solve the situation and go to the error.

 

[JenkinURL]/static/944f39f7/jsbundles/add-item.js
    // Init NameField
    $('input[name="name"]', '#createItem').on("blur input", function() {
      if (!isItemNameEmpty()) {
        var itemName = $('input[name="name"]', '#createItem').val();
        $.get("checkJobName", { value: itemName }).done(function(data) {
          var message = parseResponseFromCheckJobName(data);
          //BUG: When the checkJobName API response with "\n</div>", the message will be not '' ,message.charCodeAt(0)=10, message.lenth=1, then it will go to activateValidationMessage and will come out the above discussion situation.
          if (message !== '') {
            activateValidationMessage('#itemname-invalid', '.add-item-name', message);
          } else {
            cleanValidationMessages('.add-item-name');
            showInputHelp('.add-item-name');
            setFieldValidationStatus('name', true);
            if (getFormValidationStatus()) {
              enableSubmit(true);
            }
          }
        });

The solve method:

''.charCodeAt(0)=NaN

modyfy /static/944f39f7/jsbundles/add-item.js

 

 

if (message !== '') {

Change to --->

if (message !== '' && Number.isNaN(message.charCodeAt(0))) {

After that, it will work OK.

Hope Jenkins could fix the problem quickly.

 

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:09:03 AM9/25/19
to jenkinsc...@googlegroups.com
A Z edited a comment on Bug JENKINS-50330
This is a bug in the  , and I just find a way to modyfy add-item.js on index.html to fix it temporarily .


The server sometimes will response with "\n</div>", and the page can't solve the situation and go to the error.

 
{code:java}

[JenkinURL]/static/944f39f7/jsbundles/add-item.js
    // Init NameField
    $('input[name="name"]', '#createItem').on("blur input", function() {
      if (!isItemNameEmpty()) {
        var itemName = $('input[name="name"]', '#createItem').val();
        $.get("checkJobName", { value: itemName }).done(function(data) {
          var message = parseResponseFromCheckJobName(data);
          //BUG: When the checkJobName API response with "\n</div>", the message will be not '' ,message.charCodeAt(0)=10, message.lenth=1, then it will go to activateValidationMessage and will come out the above discussion situation.
          if (message !== '') {
            activateValidationMessage('#itemname-invalid', '.add-item-name', message);
          } else {
            cleanValidationMessages('.add-item-name');
            showInputHelp('.add-item-name');
            setFieldValidationStatus('name', true);
            if (getFormValidationStatus()) {
              enableSubmit(true);
            }
          }
        });
{code}

The solve method:

''.charCodeAt(0)=NaN

modyfy /static/944f39f7/jsbundles/add-item.js

 

 
{code:java}

if (message !== '') {

Change to --->

if (message !== '' && Number.isNaN(message.charCodeAt(0))) {{code}

After that, it will work OK.

Hope Jenkins could fix the problem quickly.

 

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:09:03 AM9/25/19
to jenkinsc...@googlegroups.com

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:10:02 AM9/25/19
to jenkinsc...@googlegroups.com
A Z edited a comment on Bug JENKINS-50330
 
Re: checkJobName api always return an extra blank line in response body: " <div/>"
This is a bug, and I just find a way to modyfy add-item.js on index.html to fix it temporarily.


The server sometimes will response with "\n</div>", and the page can't solve the situation and go to the error.

 
{code:java}
[JenkinURL]/static/944f39f7/jsbundles/add-item.js
    // Init NameField
    $('input[name="name"]', '#createItem').on("blur input", function() {
      if (!isItemNameEmpty()) {
        var itemName = $('input[name="name"]', '#createItem').val();
        $.get("checkJobName", { value: itemName }).done(function(data) {
          var message = parseResponseFromCheckJobName(data);
          //           BUG: When the checkJobName API response with "\n</div>", the message will be not '' ,message.charCodeAt(0)=10, message.lenth=1, then it will go to activateValidationMessage and will come out the above discussion situation.

          if (message !== '') {
            activateValidationMessage('#itemname-invalid', '.add-item-name', message);
          } else {
            cleanValidationMessages('.add-item-name');
            showInputHelp('.add-item-name');
            setFieldValidationStatus('name', true);
            if (getFormValidationStatus()) {
              enableSubmit(true);
            }
          }
        });
{code}
The solve method:

''.charCodeAt(0)=NaN

modyfy /static/944f39f7/jsbundles/add-item.js

 

 
{code:java}
if (message !== '') {

Change to --->

if (message !== '' && Number.isNaN(message.charCodeAt(0))) {{code}
After that, it will work OK.

Hope Jenkins could fix the problem quickly.

 

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:10:03 AM9/25/19
to jenkinsc...@googlegroups.com

tonnyazusa@gmail.com (JIRA)

unread,
Sep 25, 2019, 4:11:02 AM9/25/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages