提交 46aa7552 编写于 作者: K kohsuke

Merged revisions 16638,16644,16652,16719-16720,16722 via svnmerge from

https://www.dev.java.net/svn/hudson/branches/rc

........
  r16638 | kohsuke | 2009-03-27 19:13:03 -0700 (Fri, 27 Mar 2009) | 1 line
  
  [maven-release-plugin] prepare release hudson-1_294
........
  r16644 | kohsuke | 2009-03-28 07:32:33 -0700 (Sat, 28 Mar 2009) | 1 line
  
  [maven-release-plugin] prepare for next development iteration
........
  r16652 | kohsuke | 2009-03-28 14:42:44 -0700 (Sat, 28 Mar 2009) | 1 line
  
  updated changelog as a part of the release
........
  r16719 | kohsuke | 2009-03-30 10:46:40 -0700 (Mon, 30 Mar 2009) | 3 lines
  
  [HUDSON-3382] The race condition in the boolean flag prevents form validations from kicking in during unit tests, causing regressions to ship unnoticed.
  
  Switched from a boolean to an integer so that the order of x=true / x=false won't matter.
........
  r16720 | kohsuke | 2009-03-30 10:55:00 -0700 (Mon, 30 Mar 2009) | 1 line
  
  [FIXED HUDSON-3382] NPE in .cvspass form validation. Will be in 1.295.
........
  r16722 | kohsuke | 2009-03-30 13:31:17 -0700 (Mon, 30 Mar 2009) | 1 line
  
  [HUDSON-3382] regression test. Make sure that the form validation failure gets detected.
........


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16725 71c3de6d-444a-0410-be80-ed276b4c234a
上级 40c89bd2
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -1118,10 +1118,10 @@ public class CVSSCM extends SCM implements Serializable {
// web methods
//
public FormValidation doCvsPassCheck(@AncestorInPath AbstractProject project, @QueryParameter String value) {
public FormValidation doCvsPassCheck(@QueryParameter String value) {
// this method can be used to check if a file exists anywhere in the file system,
// so it should be protected.
if(!project.hasPermission(Item.CONFIGURE))
if(!Hudson.getInstance().hasPermission(Hudson.ADMINISTER))
return FormValidation.ok();
value = fixEmpty(value);
......
hudson (1.294) unstable; urgency=low
* See http://hudson.dev.java.net/changelog.html for more details.
-- Kohsuke Kawaguchi <kk@kohsuke.org> Sat, 28 Mar 2009 14:43:37 -0700
hudson (1.293) unstable; urgency=low
* See http://hudson.dev.java.net/changelog.html for more details.
......
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -33,7 +33,7 @@ THE SOFTWARE.
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Hudson main module</name>
......
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<artifactId>pom</artifactId>
<groupId>org.jvnet.hudson.main</groupId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jvnet.hudson.main</groupId>
......
......@@ -24,6 +24,10 @@
package hudson.util;
import hudson.model.FreeStyleProject;
import hudson.tasks.Builder;
import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Publisher;
import hudson.util.FormFieldValidatorTest.BrokenFormValidatorBuilder.DescriptorImpl;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.recipes.WithPlugin;
......@@ -38,4 +42,42 @@ public class FormFieldValidatorTest extends HudsonTestCase {
FreeStyleProject p = createFreeStyleProject();
new WebClient().getPage(p,"configure");
}
public static class BrokenFormValidatorBuilder extends Builder {
public static final class DescriptorImpl extends BuildStepDescriptor {
public boolean isApplicable(Class jobType) {
return true;
}
public void doCheckXyz() {
throw new Error("doCheckXyz is broken");
}
public String getDisplayName() {
return "I have broken form field validation";
}
}
}
/**
* Make sure that the validation methods are really called by testing a negative case.
*/
@Bug(3382)
public void testNegative() throws Exception {
DescriptorImpl d = new DescriptorImpl();
Publisher.all().add(d);
try {
FreeStyleProject p = createFreeStyleProject();
new WebClient().getPage(p,"configure");
fail("should have failed");
} catch(AssertionError e) {
if(e.getMessage().contains("doCheckXyz is broken"))
; // expected
else
throw e;
} finally {
Publisher.all().remove(d);
}
}
}
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="xyz" field="xyz">
<f:textbox />
</f:entry>
</j:jelly>
\ No newline at end of file
......@@ -27,7 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jvnet.hudson.main</groupId>
<artifactId>pom</artifactId>
<version>1.294-SNAPSHOT</version>
<version>1.295-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
......
......@@ -44,7 +44,12 @@ var FormChecker = {
// pending requests
queue : [],
inProgress : false,
// conceptually boolean, but doing so create concurrency problem.
// that is, during unit tests, the AJAX.send works synchronously, so
// the onComplete happens before the send method returns. On a real environment,
// more likely it's the other way around. So setting a boolean flag to true or false
// won't work.
inProgress : 0,
/**
* Schedules a form field check. Executions are serialized to reduce the bandwidth impact.
......@@ -73,7 +78,7 @@ var FormChecker = {
},
schedule : function() {
if (this.inProgress) return;
if (this.inProgress>0) return;
if (this.queue.length == 0) return;
var next = this.queue.shift();
......@@ -81,11 +86,11 @@ var FormChecker = {
method : next.method,
onComplete : function(x) {
next.target.innerHTML = x.responseText;
FormChecker.inProgress = false;
FormChecker.inProgress--;
FormChecker.schedule();
}
});
this.inProgress = true;
this.inProgress++;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册