Skip to content

Commit

Permalink
Merge branch 'master' into plugin-manager-dependants
Browse files Browse the repository at this point in the history
* master:
  Update the changelog by new merges:
  [FIXED JENKINS-30569] HistoryWidget: fix JS syntax error
  [FIXED JENKINS-29014] render API link conditional on getApi() presence
  [JENKINS-21720] JS alert preventig to leave a configuration page even without formulary changes
  add ctags file 'tags' to .gitignore
  [maven-release-plugin] prepare release jenkins-1.632
  [FIXED JENKINS-29888] Handling all exceptions returned by logRotator
  [JENKINS-30742] Fixed possible NPE in AbstractProject.resolveForCLI()
  • Loading branch information
tfennelly committed Oct 6, 2015
2 parents a8e83c3 + a79e2f1 commit 95ca3da
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -17,6 +17,9 @@ build
# vim
*~

# ctags
tags

# OS X
.DS_Store

Expand Down
21 changes: 20 additions & 1 deletion changelog.html
Expand Up @@ -54,6 +54,25 @@

<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<li class="bug">
Properly handle <code>RuntimeException</code>s in run retention policy handler calls.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-29888">issue 29888</a>)
<li class="bug">
Prevent <code>NullPointerException</code> in CLI if Jenkins cannot find the specified job
or a job with the nearest name.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-30742">issue 30742</a>)
<li class="bug">
Do not show <i>REST API</i> link for pages, which have no API handlers.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-29014">issue 29014</a>)
<li class="bug">
JS alert preventing to leave a configuration page without changes.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-21720">issue 21720</a>)
<li class="bug">
JS error triggered by collapsing build history widget.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-30569">issue 30569</a>)
</div><!--=TRUNK-END=-->

<h3><a name=v1.632>What's new in 1.632</a> (2015/10/05)</h3>
<ul class=image>
<li class="bug">
Optimize TagCloud size calculation.
Expand All @@ -74,7 +93,7 @@
Sidepanel controls with confirmation (<code>lib/layout/task</code>) did not assign the proper CSS style.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-30787">issue 30787</a>)
</ul>
</div><!--=TRUNK-END=-->

<h3><a name=v1.631>What's new in 1.631</a> (2015/09/27)</h3>
<ul class=image>
<li class=rfe>
Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
</parent>

<artifactId>cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
</parent>

<artifactId>jenkins-core</artifactId>
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/java/hudson/model/AbstractProject.java
Expand Up @@ -2248,8 +2248,11 @@ public int compare(Integer o1, Integer o2) {
public static AbstractProject resolveForCLI(
@Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
AbstractProject item = Jenkins.getInstance().getItemByFullName(name, AbstractProject.class);
if (item==null)
throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName()));
if (item==null) {
AbstractProject project = AbstractProject.findNearest(name);
throw new CmdLineException(null, project == null ? Messages.AbstractItem_NoSuchJobExistsWithoutSuggestion(name)
: Messages.AbstractItem_NoSuchJobExists(name, project.getFullName()));
}
return item;
}

Expand Down
8 changes: 3 additions & 5 deletions core/src/main/java/hudson/model/Run.java
Expand Up @@ -1803,11 +1803,9 @@ protected final void execute(@Nonnull RunExecution job) {

try {
getParent().logRotate();
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to rotate log",e);
} catch (InterruptedException e) {
LOGGER.log(Level.SEVERE, "Failed to rotate log",e);
}
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to rotate log",e);
}
} finally {
onEndBuilding();
}
Expand Down
Expand Up @@ -101,7 +101,9 @@ THE SOFTWARE.
</tr>
</j:if>
</l:pane>
<script defer="true">
updateBuildHistory("${it.baseUrl}/buildHistory/ajax",${it.nextBuildNumberToFetch});
</script>
<j:if test="!empty(it.nextBuildNumberToFetch)">
<script defer="true">
updateBuildHistory("${it.baseUrl}/buildHistory/ajax", ${it.nextBuildNumberToFetch});
</script>
</j:if>
</j:jelly>
4 changes: 0 additions & 4 deletions core/src/main/resources/lib/form/confirm.js
Expand Up @@ -33,9 +33,6 @@
}

function initConfirm() {
// Timeout is needed since some events get sent on page load for some reason.
// Shouldn't hurt anything for this to only start monitoring events after a few millis;.
setTimeout(function() {
var configForm = document.getElementsByName("config");
if (configForm.length > 0) {
configForm = configForm[0]
Expand Down Expand Up @@ -78,7 +75,6 @@
for ( var i = 0; i < inputs.length; i++) {
$(inputs[i]).on('input', confirm);
}
}, 100);
}

window.onbeforeunload = confirmExit;
Expand Down
17 changes: 16 additions & 1 deletion core/src/main/resources/lib/form/select/select.js
Expand Up @@ -41,6 +41,19 @@ function updateListBox(listBox,url,config) {
}

Behaviour.specify("SELECT.select", 'select', 1000, function(e) {

function hasChanged(selectEl, originalValue) {
var firstValue = selectEl.options[0].value;
var selectedValue = selectEl.value;
if (originalValue == "" && selectedValue == firstValue) {
// There was no value pre-selected but after the call to updateListBox the first value is selected by
// default. This must not be considered a change.
return false;
} else {
return originalValue != selectedValue;
}
};

// controls that this SELECT box depends on
refillOnChange(e,function(params) {
var value = e.value;
Expand All @@ -60,7 +73,9 @@ Behaviour.specify("SELECT.select", 'select', 1000, function(e) {
fireEvent(e,"filled"); // let other interested parties know that the items have changed

// if the update changed the current selection, others listening to this control needs to be notified.
if (e.value!=value) fireEvent(e,"change");
if (hasChanged(e, value)) {
fireEvent(e,"change");
}
}
});
});
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/resources/lib/layout/layout.jelly
Expand Up @@ -254,7 +254,9 @@ ${h.initPageVariables(context)}
<div class="col-md-6" id="footer"></div>
<div class="col-md-18">
<span class="page_generated">${%Page generated}: <i:formatDate value="${h.getCurrentTime()}" type="both" dateStyle="medium" timeStyle="medium"/></span>
<span class="rest_api"><a href="api/">REST API</a></span>
<j:if test="${!empty(it.api)}">
<span class="rest_api"><a href="api/">REST API</a></span>
</j:if>
<span class="jenkins_ver"><a href="${h.getFooterURL()}">Jenkins ver. ${h.version}</a></span>
<j:if test="${extensionsAvailable}">
<j:forEach var="pd" items="${h.pageDecorators}">
Expand Down
10 changes: 5 additions & 5 deletions plugins/pom.xml
Expand Up @@ -12,7 +12,7 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<name>Jenkins plugin POM</name>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
<packaging>pom</packaging>

<!--
Expand All @@ -23,7 +23,7 @@
<connection>scm:svn:https://svn.jenkins-ci.org/trunk/hudson/plugins/</connection>
<developerConnection>scm:svn:https://svn.jenkins-ci.org/trunk/hudson/plugins/</developerConnection>
<url>https://svn.jenkins-ci.org/trunk/hudson/plugins/</url>
<tag>HEAD</tag>
<tag>jenkins-1.632</tag>
</scm>

<issueManagement>
Expand Down Expand Up @@ -59,19 +59,19 @@
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-war</artifactId>
<type>war</type>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
<scope>test</scope>
</dependency>
<!--
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -33,7 +33,7 @@ THE SOFTWARE.

<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
<packaging>pom</packaging>

<name>Jenkins main module</name>
Expand All @@ -59,7 +59,7 @@ THE SOFTWARE.
<connection>scm:git:git://github.com/jenkinsci/jenkins.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/jenkins.git</developerConnection>
<url>https://github.com/jenkinsci/jenkins</url>
<tag>HEAD</tag>
<tag>jenkins-1.632</tag>
</scm>

<distributionManagement>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
</parent>

<artifactId>jenkins-test-harness</artifactId>
Expand Down
23 changes: 22 additions & 1 deletion test/src/test/groovy/hudson/model/AbstractProjectTest.groovy
Expand Up @@ -47,7 +47,8 @@ import hudson.triggers.Trigger
import hudson.triggers.TriggerDescriptor;
import hudson.util.StreamTaskListener;
import hudson.util.OneShotEvent
import jenkins.model.Jenkins;
import jenkins.model.Jenkins
import org.junit.Assert;
import org.jvnet.hudson.test.HudsonTestCase
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.TestExtension;
Expand All @@ -56,6 +57,7 @@ import org.jvnet.hudson.test.recipes.PresetData.DataSet
import org.apache.commons.io.FileUtils;
import org.junit.Assume;
import org.jvnet.hudson.test.MockFolder
import org.kohsuke.args4j.CmdLineException

/**
* @author Kohsuke Kawaguchi
Expand Down Expand Up @@ -588,6 +590,25 @@ public class AbstractProjectTest extends HudsonTestCase {
assert project.triggers().size() == 1
}

@Issue("JENKINS-30742")
public void testResolveForCLI() {
try {
AbstractProject not_found = AbstractProject.resolveForCLI("never_created");
fail("Exception should occur before!");
} catch (CmdLineException e) {
assert e.getMessage().contentEquals("No such job \u2018never_created\u2019 exists.");
}

AbstractProject project = jenkins.createProject(FreeStyleProject.class, "never_created");
try {
AbstractProject not_found = AbstractProject.resolveForCLI("never_created1");
fail("Exception should occur before!");
} catch (CmdLineException e) {
assert e.getMessage().contentEquals("No such job \u2018never_created1\u2019 exists. Perhaps you meant \u2018never_created\u2019?")
}

}

static class MockBuildTriggerThrowsNPEOnStart<Item> extends Trigger {
@Override
public void start(hudson.model.Item project, boolean newInstance) { throw new NullPointerException(); }
Expand Down
2 changes: 1 addition & 1 deletion war/pom.xml
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.632-SNAPSHOT</version>
<version>1.632</version>
</parent>

<artifactId>jenkins-war</artifactId>
Expand Down

0 comments on commit 95ca3da

Please sign in to comment.