diff --git a/changelog.html b/changelog.html index e768ac7cbf..fb940c63df 100644 --- a/changelog.html +++ b/changelog.html @@ -55,7 +55,14 @@ Upcoming changes @@ -79,7 +86,7 @@ Upcoming changes Absolute URLs in console output (issue 16368)
  • - Revert ampersand encoding which can cause backwad incompatibility issue + Revert ampersand encoding which can cause backward incompatibility issue (pull 683)
  • Fix dependency graph computation when upstream build trigger is involved diff --git a/core/pom.xml b/core/pom.xml index e19432da08..3fcb04b90b 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -42,7 +42,7 @@ THE SOFTWARE. true - 1.199 + 1.205 2.5.6.SEC03 @@ -199,7 +199,7 @@ THE SOFTWARE. org.kohsuke.stapler json-lib - 2.1-rev7 + 2.4-jenkins-1 commons-httpclient diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index e23502e1ae..a330a042bf 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -782,6 +782,7 @@ public class Functions { * * @param predicate * Filter the descriptors based on {@link GlobalConfigurationCategory} + * @since 1.494 */ public static Collection getSortedDescriptorsForGlobalConfig(Predicate predicate) { ExtensionList exts = Jenkins.getInstance().getExtensionList(Descriptor.class); @@ -807,13 +808,32 @@ public class Functions { return DescriptorVisibilityFilter.apply(Jenkins.getInstance(),answer); } + /** + * Like {@link #getSortedDescriptorsForGlobalConfig(Predicate)} but with a constant truth predicate, to include all descriptors. + */ public static Collection getSortedDescriptorsForGlobalConfig() { return getSortedDescriptorsForGlobalConfig(Predicates.alwaysTrue()); } + /** + * @deprecated This is rather meaningless. + */ + @Deprecated public static Collection getSortedDescriptorsForGlobalConfigNoSecurity() { return getSortedDescriptorsForGlobalConfig(Predicates.not(GlobalSecurityConfiguration.FILTER)); } + + /** + * Like {@link #getSortedDescriptorsForGlobalConfig(Predicate)} but for unclassified descriptors only. + * @since 1.506 + */ + public static Collection getSortedDescriptorsForGlobalConfigUnclassified() { + return getSortedDescriptorsForGlobalConfig(new Predicate() { + public boolean apply(GlobalConfigurationCategory cat) { + return cat instanceof GlobalConfigurationCategory.Unclassified; + } + }); + } private static class Tag implements Comparable { double ordinal; diff --git a/core/src/main/java/hudson/model/FileParameterValue.java b/core/src/main/java/hudson/model/FileParameterValue.java index 8505a705b4..2251ea551b 100644 --- a/core/src/main/java/hudson/model/FileParameterValue.java +++ b/core/src/main/java/hudson/model/FileParameterValue.java @@ -171,7 +171,7 @@ public class FileParameterValue extends ParameterValue { } @Override - public String getShortDescription() { + public String toString() { return "(FileParameterValue) " + getName() + "='" + originalFileName + "'"; } diff --git a/core/src/main/java/hudson/model/RunParameterValue.java b/core/src/main/java/hudson/model/RunParameterValue.java index 1b71c189bd..352c262bbd 100644 --- a/core/src/main/java/hudson/model/RunParameterValue.java +++ b/core/src/main/java/hudson/model/RunParameterValue.java @@ -87,7 +87,7 @@ public class RunParameterValue extends ParameterValue { } @Override - public String getShortDescription() { + public String toString() { return "(RunParameterValue) " + getName() + "='" + getRunId() + "'"; } diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 4f9e7827a4..ff5ba010b9 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -58,6 +58,8 @@ import java.util.Set; import javax.servlet.ServletException; import jenkins.model.Jenkins; +import jenkins.slaves.WorkspaceLocator; + import org.apache.commons.io.IOUtils; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.HttpResponse; @@ -267,6 +269,13 @@ public abstract class Slave extends Node implements Serializable { } public FilePath getWorkspaceFor(TopLevelItem item) { + for (WorkspaceLocator l : WorkspaceLocator.all()) { + FilePath workspace = l.locate(item, this); + if (workspace != null) { + return workspace; + } + } + FilePath r = getWorkspaceRoot(); if(r==null) return null; // offline return r.child(item.getFullName()); diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index 27b46cd827..7e874ea6de 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -278,13 +278,15 @@ public class UpdateCenter extends AbstractModelObject implements Saveable, OnMas * Will be the newest of all {@link UpdateSite}s. */ public String getLastUpdatedString() { - long newestTs = -1; + long newestTs = 0; for (UpdateSite s : sites) { if (s.getDataTimestamp()>newestTs) { newestTs = s.getDataTimestamp(); } } - if(newestTs<0) return "N/A"; + if (newestTs == 0) { + return Messages.UpdateCenter_n_a(); + } return Util.getPastTimeString(System.currentTimeMillis()-newestTs); } diff --git a/core/src/main/java/hudson/model/UpdateSite.java b/core/src/main/java/hudson/model/UpdateSite.java index 147bf3f3b7..b05d493074 100644 --- a/core/src/main/java/hudson/model/UpdateSite.java +++ b/core/src/main/java/hudson/model/UpdateSite.java @@ -85,18 +85,20 @@ import static hudson.util.TimeUnit2.*; public class UpdateSite { /** * What's the time stamp of data file? + * 0 means never. */ - private transient long dataTimestamp = -1; + private transient volatile long dataTimestamp; /** * When was the last time we asked a browser to check the data for us? + * 0 means never. * *

    * There's normally some delay between when we send HTML that includes the check code, * until we get the data back, so this variable is used to avoid asking too many browseres * all at once. */ - private transient volatile long lastAttempt = -1; + private transient volatile long lastAttempt; /** * If the attempt to fetch data fails, we progressively use longer time out before retrying, @@ -129,14 +131,6 @@ public class UpdateSite { this.url = url; } - /** - * When read back from XML, initialize them back to -1. - */ - private Object readResolve() { - dataTimestamp = lastAttempt = -1; - return this; - } - /** * Get ID string. */ @@ -147,6 +141,7 @@ public class UpdateSite { @Exported public long getDataTimestamp() { + assert dataTimestamp >= 0; return dataTimestamp; } @@ -171,7 +166,11 @@ public class UpdateSite { String uncleanJson = IOUtils.toString(is,"UTF-8"); int jsonStart = uncleanJson.indexOf("{\""); if (jsonStart >= 0) { - return updateData(uncleanJson.substring(jsonStart), signatureCheck); + uncleanJson = uncleanJson.substring(jsonStart); + int end = uncleanJson.lastIndexOf('}'); + if (end>0) + uncleanJson = uncleanJson.substring(0,end+1); + return updateData(uncleanJson, signatureCheck); } else { throw new IOException("Could not find json in content of " + "update center from url: "+src.toExternalForm()); @@ -239,7 +238,7 @@ public class UpdateSite { */ public boolean isDue() { if(neverUpdate) return false; - if(dataTimestamp==-1) + if(dataTimestamp == 0) dataTimestamp = getDataFile().file.lastModified(); long now = System.currentTimeMillis(); diff --git a/core/src/main/java/hudson/security/csrf/CrumbFilter.java b/core/src/main/java/hudson/security/csrf/CrumbFilter.java index 167f9786f5..788eaa50ca 100644 --- a/core/src/main/java/hudson/security/csrf/CrumbFilter.java +++ b/core/src/main/java/hudson/security/csrf/CrumbFilter.java @@ -9,6 +9,7 @@ import jenkins.model.Jenkins; import java.io.IOException; import java.util.Enumeration; +import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.Filter; @@ -76,15 +77,14 @@ public class CrumbFilter implements Filter { if (crumbIssuer.validateCrumb(httpRequest, crumbSalt, crumb)) { valid = true; } else { - LOGGER.warning("Found invalid crumb " + crumb + - ". Will check remaining parameters for a valid one..."); + LOGGER.log(Level.WARNING, "Found invalid crumb {0}. Will check remaining parameters for a valid one...", crumb); } } // Multipart requests need to be handled by each handler. if (valid || isMultipart(httpRequest)) { chain.doFilter(request, response); } else { - LOGGER.warning("No valid crumb was included in request for " + httpRequest.getRequestURI() + ". Returning " + HttpServletResponse.SC_FORBIDDEN + "."); + LOGGER.log(Level.WARNING, "No valid crumb was included in request for {0}. Returning {1}.", new Object[] {httpRequest.getRequestURI(), HttpServletResponse.SC_FORBIDDEN}); httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN,"No valid crumb was included in the request"); } } else { diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java index a11dd34845..8ba08f4cae 100755 --- a/core/src/main/java/jenkins/model/Jenkins.java +++ b/core/src/main/java/jenkins/model/Jenkins.java @@ -94,6 +94,7 @@ import hudson.DNSMultiCast; import hudson.DescriptorExtensionList; import hudson.Extension; import hudson.ExtensionList; +import hudson.ExtensionPoint; import hudson.FilePath; import hudson.Functions; import hudson.Launcher; @@ -110,6 +111,7 @@ import hudson.UDPBroadcastThread; import hudson.Util; import static hudson.Util.fixEmpty; import static hudson.Util.fixNull; +import hudson.WebAppMain; import hudson.XmlFile; import hudson.cli.CLICommand; import hudson.cli.CliEntryPoint; @@ -195,6 +197,7 @@ import jenkins.InitReactorRunner; import jenkins.model.ProjectNamingStrategy.DefaultProjectNamingStrategy; import jenkins.security.ConfidentialKey; import jenkins.security.ConfidentialStore; +import jenkins.slaves.WorkspaceLocator; import jenkins.util.io.FileBoolean; import net.sf.json.JSONObject; import org.acegisecurity.AccessDeniedException; @@ -247,6 +250,7 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import static hudson.init.InitMilestone.*; +import hudson.security.BasicAuthenticationFilter; import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; import java.io.File; @@ -790,7 +794,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro // JSON binding needs to be able to see all the classes from all the plugins WebApp.get(servletContext).setClassLoader(pluginManager.uberClassLoader); - adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader,"adjuncts/"+SESSION_HASH); + adjuncts = new AdjunctManager(servletContext, pluginManager.uberClassLoader,"adjuncts/"+SESSION_HASH, TimeUnit2.DAYS.toMillis(365)); // initialization consists of ... executeReactor( is, @@ -1922,6 +1926,13 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro } public FilePath getWorkspaceFor(TopLevelItem item) { + for (WorkspaceLocator l : WorkspaceLocator.all()) { + FilePath workspace = l.locate(item, this); + if (workspace != null) { + return workspace; + } + } + return new FilePath(expandVariablesForDirectory(workspaceDir, item)); } @@ -2702,7 +2713,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro jdks.addAll(req.bindJSONToList(JDK.class,json.get("jdks"))); boolean result = true; - for( Descriptor d : Functions.getSortedDescriptorsForGlobalConfig() ) + for (Descriptor d : Functions.getSortedDescriptorsForGlobalConfigUnclassified()) result &= configureDescriptor(req,json,d); version = VERSION; @@ -2886,7 +2897,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro * Check if the given name is suitable as a name * for job, view, etc. * - * @throws ParseException + * @throws Failure * if the given name is not good */ public static void checkGoodName(String name) throws Failure { @@ -2907,7 +2918,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro /** * Makes sure that the given name is good as a job name. - * @return trimmed name if valid; throws ParseException if not + * @return trimmed name if valid; throws Failure if not */ private String checkJobName(String name) throws Failure { checkGoodName(name); diff --git a/core/src/main/java/jenkins/slaves/WorkspaceLocator.java b/core/src/main/java/jenkins/slaves/WorkspaceLocator.java new file mode 100644 index 0000000000..6fe3c06d76 --- /dev/null +++ b/core/src/main/java/jenkins/slaves/WorkspaceLocator.java @@ -0,0 +1,38 @@ +package jenkins.slaves; + +import hudson.ExtensionList; +import hudson.ExtensionPoint; +import hudson.FilePath; +import hudson.model.Node; +import hudson.model.TopLevelItem; +import jenkins.model.Jenkins; + +/** + * Allow extensions to override workspace locations + * on given slaves or projects. + * + * @author ryan.campbell@gmail.com + * @since 1.501 + */ +public abstract class WorkspaceLocator implements ExtensionPoint { + + /** + * Allows extensions to customize the workspace path. The first non-null response + * will determine the path to the workspace on that slave. + * + * @param item The toplevel item + * @param slave The slave + * @return The absolute FilePath to the workspace on the slave. + * Will be created if it doesn't exist. + * + */ + public abstract FilePath locate(TopLevelItem item, Node node); + + + /** + * All registered {@link WorkspaceLocator}s. + */ + public static ExtensionList all() { + return Jenkins.getInstance().getExtensionList(WorkspaceLocator.class); + } +} diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index 1ca5bfb85f..6976e006ea 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -245,6 +245,7 @@ Slave.UnixSlave=This is a Unix slave Slave.WindowsSlave=This is a Windows slave UpdateCenter.DownloadButNotActivated=Downloaded Successfully. Will be activated during the next boot +UpdateCenter.n_a=N/A View.Permissions.Title=View View.CreatePermission.Description=\ This permission allows users to create new views. diff --git a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly index f695d73d9b..ac7438b4d7 100644 --- a/core/src/main/resources/jenkins/model/Jenkins/configure.jelly +++ b/core/src/main/resources/jenkins/model/Jenkins/configure.jelly @@ -53,7 +53,7 @@ THE SOFTWARE. - + diff --git a/core/src/main/resources/jenkins/security/RekeySecretAdminMonitor/message_zh_TW.properties b/core/src/main/resources/jenkins/security/RekeySecretAdminMonitor/message_zh_TW.properties index 23f1456297..6887c4f899 100644 --- a/core/src/main/resources/jenkins/security/RekeySecretAdminMonitor/message_zh_TW.properties +++ b/core/src/main/resources/jenkins/security/RekeySecretAdminMonitor/message_zh_TW.properties @@ -35,3 +35,8 @@ rekeySuccessful=\ rekeyHadProblems=\ \u91d1\u9470\u91cd\u5957\u5b8c\u6210\uff0c\u4f46\u662f\u9047\u5230\u4e00\u4e9b\u554f\u984c\u3002\u8acb\u67e5\u770b\u8a18\u9304\u3002 + +Re-key\ in\ background\ now=\u99ac\u4e0a\u5728\u80cc\u666f\u91cd\u5957\u91d1\u9470 +Re-keying\ currently\ scheduled\ during\ the\ next\ startup=\u5df2\u7d93\u6392\u5b9a\u5728\u4e0b\u6b21\u555f\u52d5\u5f8c\u91cd\u5957\u91d1\u9470 +Schedule\ a\ re-key\ during\ the\ next\ startup=\u6392\u7a0b\u5728\u4e0b\u6b21\u555f\u52d5\u5f8c\u91cd\u5957\u91d1\u9470 +Dismiss\ this\ message=\u5ffd\u7565\u9019\u500b\u8a0a\u606f diff --git a/core/src/main/resources/lib/form/textarea/textarea.js b/core/src/main/resources/lib/form/textarea/textarea.js index de78308fe6..296b45fd54 100644 --- a/core/src/main/resources/lib/form/textarea/textarea.js +++ b/core/src/main/resources/lib/form/textarea/textarea.js @@ -34,8 +34,6 @@ Behaviour.specify("DIV.textarea-preview-container", 'textarea', 100, function (e }; new Ajax.Request(rootURL + showPreview.getAttribute("previewEndpoint"), { - method: "POST", - requestHeaders: "Content-Type: application/x-www-form-urlencoded", parameters: { text: text }, diff --git a/core/src/test/java/hudson/model/UpdateCenterTest.java b/core/src/test/java/hudson/model/UpdateCenterTest.java index 5d00978abd..380d90b38a 100644 --- a/core/src/test/java/hudson/model/UpdateCenterTest.java +++ b/core/src/test/java/hudson/model/UpdateCenterTest.java @@ -24,35 +24,31 @@ package hudson.model; import com.trilead.ssh2.crypto.Base64; -import hudson.util.FormValidation; -import hudson.util.FormValidation.Kind; import hudson.util.TimeUnit2; -import junit.framework.TestCase; import net.sf.json.JSONObject; import org.apache.commons.io.IOUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.URL; -import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateFactory; -import java.security.cert.CertificateNotYetValidException; import java.security.cert.X509Certificate; import java.util.Date; +import static org.junit.Assert.*; +import static org.junit.Assume.*; +import org.junit.Test; /** * Quick test for {@link UpdateCenter}. * * @author Kohsuke Kawaguchi */ -public class UpdateCenterTest extends TestCase { - public void testData() throws Exception { - // check if we have the internet connectivity. See HUDSON-2095 +public class UpdateCenterTest { + @Test public void data() throws Exception { try { new URL("http://updates.jenkins-ci.org/").openStream(); } catch (IOException e) { - System.out.println("Skipping this test. No internet connectivity"); - return; + assumeNoException("No internet connectivity", e); // JENKINS-2095 } URL url = new URL("http://updates.jenkins-ci.org/update-center.json?version=build"); diff --git a/test/src/test/groovy/hudson/model/UpdateCenter2Test.groovy b/test/src/test/groovy/hudson/model/UpdateCenter2Test.groovy index 7ef53871f8..0e4fd4475f 100644 --- a/test/src/test/groovy/hudson/model/UpdateCenter2Test.groovy +++ b/test/src/test/groovy/hudson/model/UpdateCenter2Test.groovy @@ -25,6 +25,7 @@ package hudson.model import org.jvnet.hudson.test.HudsonTestCase import hudson.model.UpdateCenter.DownloadJob.Success +import hudson.model.UpdateSite /** * @@ -42,4 +43,11 @@ public class UpdateCenter2Test extends HudsonTestCase { println job.status; assertTrue(job.status instanceof Success) } + + void testGetLastUpdatedString() { + UpdateSite.neverUpdate = false + assertTrue(jenkins.updateCenter.getById("default").due) + assertEquals(hudson.model.Messages.UpdateCenter_n_a(), jenkins.updateCenter.lastUpdatedString) + } + } diff --git a/test/src/test/java/lib/form/RepeatableTest.java b/test/src/test/java/lib/form/RepeatableTest.java index c2afddf7bd..48ee7bf5e3 100644 --- a/test/src/test/java/lib/form/RepeatableTest.java +++ b/test/src/test/java/lib/form/RepeatableTest.java @@ -40,6 +40,7 @@ import hudson.ExtensionPoint; import hudson.model.Describable; import hudson.model.Descriptor; import jenkins.model.Jenkins; +import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.jvnet.hudson.test.HudsonTestCase; import org.kohsuke.stapler.DataBoundConstructor; @@ -79,9 +80,9 @@ public class RepeatableTest extends HudsonTestCase { public void testSimple() throws Exception { doTestSimple(); - assertEquals("[{\"bool\":false,\"txt\":\"value one\"}," + assertEqualsJsonArray("[{\"bool\":false,\"txt\":\"value one\"}," + "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":true,\"txt\":\"value three\"}]", - formData.get("foos").toString()); + formData.get("foos")); } // ======================================================================== @@ -102,10 +103,10 @@ public class RepeatableTest extends HudsonTestCase { public void testSimple_ExistingData() throws Exception { addData(); doTestSimple(); - assertEquals("[{\"bool\":true,\"txt\":\"existing one\"}," + assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"}," + "{\"bool\":false,\"txt\":\"existing two\"},{\"bool\":true,\"txt\":\"value one\"}," + "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":false,\"txt\":\"value three\"}]", - formData.get("foos").toString()); + formData.get("foos")); } public void testMinimum() throws Exception { @@ -118,9 +119,9 @@ public class RepeatableTest extends HudsonTestCase { try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { } f.getInputsByName("bool").get(2).click(); submit(f); - assertEquals("[{\"bool\":false,\"txt\":\"value one\"}," + assertEqualsJsonArray("[{\"bool\":false,\"txt\":\"value one\"}," + "{\"bool\":false,\"txt\":\"value two\"},{\"bool\":true,\"txt\":\"value three\"}]", - formData.get("foos").toString()); + formData.get("foos")); } public void testMinimum_ExistingData() throws Exception { @@ -132,9 +133,9 @@ public class RepeatableTest extends HudsonTestCase { try { f.getInputByValue(""); fail("?"); } catch (ElementNotFoundException expected) { } f.getInputsByName("bool").get(1).click(); submit(f); - assertEquals("[{\"bool\":true,\"txt\":\"existing one\"}," + assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"}," + "{\"bool\":true,\"txt\":\"existing two\"},{\"bool\":false,\"txt\":\"new one\"}]", - formData.get("foos").toString()); + formData.get("foos")); } public void testNoData() throws Exception { @@ -174,8 +175,8 @@ public class RepeatableTest extends HudsonTestCase { addDefaults(); gotoAndSubmitConfig(viewName); assertNotNull(formData.get("list")); - assertEquals("[{\"bool\":true,\"txt\":\"default one\"},{\"bool\":false,\"txt\":\"default two\"}]", - formData.get("list").toString()); + assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"default one\"},{\"bool\":false,\"txt\":\"default two\"}]", + formData.get("list")); } private void assertDefaultsIgnoredIfHaveData(final String viewName) throws Exception { @@ -183,8 +184,8 @@ public class RepeatableTest extends HudsonTestCase { addDefaults(); gotoAndSubmitConfig(viewName); assertNotNull(formData.get("list")); - assertEquals("[{\"bool\":true,\"txt\":\"existing one\"},{\"bool\":false,\"txt\":\"existing two\"}]", - formData.get("list").toString()); + assertEqualsJsonArray("[{\"bool\":true,\"txt\":\"existing one\"},{\"bool\":false,\"txt\":\"existing two\"}]", + formData.get("list")); } private void gotoAndSubmitConfig(final String viewName) throws Exception { @@ -207,9 +208,9 @@ public class RepeatableTest extends HudsonTestCase { f.getInputByValue("").setValueAttribute("txt two"); f.getElementsByAttribute("INPUT", "type", "radio").get(3).click(); submit(f); - assertEquals("[{\"radio\":\"two\",\"txt\":\"txt one\"}," - + "{\"radio\":\"two\",\"txt\":\"txt two\"}]", - formData.get("foos").toString()); + assertEqualsJsonArray("[{\"radio\":\"two\",\"txt\":\"txt one\"}," + + "{\"radio\":\"two\",\"txt\":\"txt two\"}]", + formData.get("foos")); } public static class FooRadio { @@ -227,9 +228,9 @@ public class RepeatableTest extends HudsonTestCase { f.getInputByValue("").setValueAttribute("txt 4"); f.getElementsByAttribute("INPUT", "type", "radio").get(7).click(); submit(f); - assertEquals("[{\"radio\":\"one\",\"txt\":\"1\"},{\"radio\":\"two\",\"txt\":\"2\"}," + assertEqualsJsonArray("[{\"radio\":\"one\",\"txt\":\"1\"},{\"radio\":\"two\",\"txt\":\"2\"}," + "{\"radio\":\"one\",\"txt\":\"three\"},{\"radio\":\"two\",\"txt\":\"txt 4\"}]", - formData.get("foos").toString()); + formData.get("foos")); } // hudson-behavior uniquifies radiobutton names so the browser properly handles each group, @@ -247,9 +248,9 @@ public class RepeatableTest extends HudsonTestCase { f.getElementsByAttribute("INPUT", "type", "radio").get(2).click(); f.getInputByValue("").setValueAttribute("avalue two"); submit(f); - assertEquals("[{\"radio\":{\"b\":\"bvalue\",\"value\":\"two\"},\"txt\":\"txt one\"}," + assertEqualsJsonArray("[{\"radio\":{\"b\":\"bvalue\",\"value\":\"two\"},\"txt\":\"txt one\"}," + "{\"radio\":{\"a\":\"avalue two\",\"value\":\"one\"},\"txt\":\"txt two\"}]", - formData.get("foos").toString()); + formData.get("foos")); } // ======================================================================== @@ -394,9 +395,13 @@ public class RepeatableTest extends HudsonTestCase { throw e; } submit(f); - assertEquals("[{\"moo\":{\"inner\":\"inone\"},\"outer\":\"two\"}," - + "{\"moo\":[{\"inner\":\"intwo\"},{\"inner\":\"inone\"}],\"outer\":\"one\"}]", - formData.get("items").toString()); + assertEqualsJsonArray("[{\"moo\":{\"inner\":\"inone\"},\"outer\":\"two\"}," + + "{\"moo\":[{\"inner\":\"intwo\"},{\"inner\":\"inone\"}],\"outer\":\"one\"}]", + formData.get("items")); + } + + private void assertEqualsJsonArray(String golden, Object jsonArray) { + assertEquals(JSONArray.fromObject(golden),jsonArray); } /** diff --git a/war/src/main/webapp/help/project-config/log-rotation_zh_TW.html b/war/src/main/webapp/help/project-config/log-rotation_zh_TW.html index bfdd3e9172..e985c65aa1 100644 --- a/war/src/main/webapp/help/project-config/log-rotation_zh_TW.html +++ b/war/src/main/webapp/help/project-config/log-rotation_zh_TW.html @@ -1,14 +1,14 @@

    - 管理要保留的建置記錄 (包含畫面輸出、建置成品等) 數,控制 Jenkins 的磁碟使用量者。 + 管理要保留的建置記錄 (包含畫面輸出、建置成品等) 數,控制 Jenkins 的磁碟使用量。 Jenkins 提供兩種準則:
    1. - 依新舊狀況處理。您可以要 Jenkins 刪除超過指定時間 (例如 7 天) 前的記錄。 + 依新舊狀況處理。您可以要 Jenkins 刪除指定時間 (例如 7 天) 前的記錄。
    2. 依次數處理。您可以讓 Jenkins 只保留最近的 N 筆建置記錄。如果開始新的建置後,最早的記錄就會被刪掉。
    - Jenkins 也允許您將單獨的建置標為「永久保存這次建置」,將特定幾次重要建置排除在自動刪除清單外。 + Jenkins 也允許您將某些建置標為「永久保存」,讓特定幾次重要建置不會被自動刪除。 最後一次穩定建置及最後一次成功建置也會一直保留住。 -
    \ No newline at end of file + diff --git a/war/src/main/webapp/help/system-config/homeDirectory_zh_TW.html b/war/src/main/webapp/help/system-config/homeDirectory_zh_TW.html index 63591da286..ac995e7abb 100644 --- a/war/src/main/webapp/help/system-config/homeDirectory_zh_TW.html +++ b/war/src/main/webapp/help/system-config/homeDirectory_zh_TW.html @@ -9,5 +9,5 @@ (不建議) 修改 jenkins.war (或解開到您 Web Container 裡的複本) 裡的 web.xml。 Jenkins 執行時無法修改這個值。 - 這個項目主要是譹您確認您的設定真的有生效。 + 這個項目主要是讓您確認設定正確與否。 diff --git a/war/src/main/webapp/help/system-config/master-slave/usage_zh_TW.html b/war/src/main/webapp/help/system-config/master-slave/usage_zh_TW.html index 71b80b96c5..ca25101e61 100644 --- a/war/src/main/webapp/help/system-config/master-slave/usage_zh_TW.html +++ b/war/src/main/webapp/help/system-config/master-slave/usage_zh_TW.html @@ -3,21 +3,22 @@
    - 盡可能使用這個 Slave + 盡可能使用這個節點
    預設值,也是最常用的設定。 - 這個模式下,Jenkins 會不受限制的使用 Slave。一旦有建置作業可以在這個 Slave 上完成,Jenkins 就會用它。 + 這個模式下,Jenkins 會不受拘束的使用 Slave。一旦有建置作業可以在這個 Slave 上完成,Jenkins 就會用它。
    - 將機器保留給限定的作業 + 只保留給限定節點的作業
    - 這個模式下,Jenkins 只會在這部機器上建置那些指定要在這裡跑的那些專案。 + 這個模式下,Jenkins 只會在這部機器上建置那些明確指定只能在這裡跑的專案。 - 讓 Slave 保留給特定種類的作業。例如讓 Jenkins 持續執行效能測試。 - 您還可以同時將執行程式數設成 1,這樣一次就只執行一項效能測試,這個執行程式也不會被能在別的 Slave 建置的作業擋到。 + 將節點保留給特定種類的作業。 + 例如讓 Jenkins 持續執行效能測試,您還可以同時將執行程式數設成 1,一次只執行一項效能測試。 + 這個執行程式也不會因為要執行能在別的節點建置的作業而塞住。
    - \ No newline at end of file + diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 277ed3bba7..5618b51b7f 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -100,10 +100,12 @@ var crumb = { wrap: function(headers) { if (this.fieldName!=null) { if (headers instanceof Array) + // XXX prototype.js only seems to interpret object headers.push(this.fieldName, this.value); else headers[this.fieldName]=this.value; } + // XXX return value unused return headers; },