Skip to content

Commit

Permalink
Merge branch 'master' into LineTransformationOutputStream.Delegating
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Apr 3, 2019
2 parents f25a7d7 + 6a3886e commit c9342fd
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 90 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/TcpSlaveAgentListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public String getAgentProtocolNames() {

/**
* Gets Remoting minimum supported version to prevent unsupported agents from connecting
* @since 2.169
* @since 2.171
*/
public VersionNumber getRemotingMinimumVersion() {
return RemotingVersionInfo.getMinimumSupportedVersion();
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/hudson/console/AnnotatedLargeText.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.jcraft.jzlib.GZIPOutputStream;

import static java.lang.Math.abs;
import javax.annotation.CheckReturnValue;
import org.jenkinsci.remoting.util.AnonymousClassWarnings;

/**
Expand Down Expand Up @@ -139,6 +140,7 @@ private ConsoleAnnotator<T> createAnnotator(StaplerRequest req) throws IOExcepti
return ConsoleAnnotator.initial(context);
}

@CheckReturnValue
@Override
public long writeLogTo(long start, Writer w) throws IOException {
if (isHtml())
Expand All @@ -151,6 +153,7 @@ public long writeLogTo(long start, Writer w) throws IOException {
* Strips annotations using a {@link PlainTextConsoleOutputStream}.
* {@inheritDoc}
*/
@CheckReturnValue
@Override
public long writeLogTo(long start, OutputStream out) throws IOException {
return super.writeLogTo(start, new PlainTextConsoleOutputStream(out));
Expand All @@ -160,10 +163,12 @@ public long writeLogTo(long start, OutputStream out) throws IOException {
* Calls {@link LargeText#writeLogTo(long, OutputStream)} without stripping annotations as {@link #writeLogTo(long, OutputStream)} would.
* @since 1.577
*/
@CheckReturnValue
public long writeRawLogTo(long start, OutputStream out) throws IOException {
return super.writeLogTo(start, out);
}

@CheckReturnValue
public long writeHtmlTo(long start, Writer w) throws IOException {
ConsoleAnnotationOutputStream<T> caw = new ConsoleAnnotationOutputStream<>(
w, createAnnotator(Stapler.getCurrentRequest()), context, charset);
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/hudson/model/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,9 @@ public Collection<Fingerprint> getBuildFingerprints() {
/**
* Returns the log file.
* @return The file may reference both uncompressed or compressed logs
*/
* @deprecated Assumes file-based storage of the log, which is not necessarily the case for Pipelines after JEP-210. Use other methods giving various kinds of streams such as {@link Run#getLogReader()}, {@link Run#getLogInputStream()}, or {@link Run#getLogText()}.
*/
@Deprecated
public @Nonnull File getLogFile() {
File rawF = new File(getRootDir(), "log");
if (rawF.isFile()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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 field="allowsSignup">
<f:checkbox default="true" title="${%Allow users to sign up}"/>
<f:checkbox default="false" title="${%Allow users to sign up}"/>
</f:entry>
<j:if test="${size(h.captchaSupportDescriptors) gt 0}">
<f:entry>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div>
By default, Jenkins allows users to create accounts by themselves, via the "sign up" link on the top right shoulder of the page.
But if you'd like to prevent random users from creating accounts, and instead tightly control how user accounts are created,
uncheck this box.
This option allows users to create accounts by themselves, via the "sign up" link on the top right shoulder of the page.
<strong>Make sure to not grant significant permissions to authenticated users, as anyone on the network will be able to get them.</strong>
<p>
When this checkbox is unchecked, someone with the administrator role would have to create accounts.
<p>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 8 additions & 3 deletions test/src/test/java/hudson/model/UpdateCenter2Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import hudson.model.UpdateCenter.DownloadJob.Success;
import hudson.model.UpdateCenter.DownloadJob.Failure;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeNotNull;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
Expand All @@ -48,7 +49,9 @@ public class UpdateCenter2Test {
@Test public void install() throws Exception {
UpdateSite.neverUpdate = false;
j.jenkins.pluginManager.doCheckUpdatesServer(); // load the metadata
DownloadJob job = (DownloadJob) j.jenkins.getUpdateCenter().getPlugin("changelog-history").deploy().get(); // this seems like one of the smallest plugin
UpdateSite.Plugin plugin = j.jenkins.getUpdateCenter().getPlugin("changelog-history");
assumeNotNull(plugin);
DownloadJob job = (DownloadJob) plugin.deploy().get(); // this seems like one of the smallest plugin
System.out.println(job.status);
assertTrue(job.status instanceof Success);
}
Expand All @@ -66,8 +69,10 @@ public class UpdateCenter2Test {
String wrongChecksum = "ABCDEFG1234567890";

// usually the problem is the file having a wrong checksum, but changing the expected one works just the same
j.jenkins.getUpdateCenter().getSite("default").getPlugin("changelog-history").sha512 = wrongChecksum;
DownloadJob job = (DownloadJob) j.jenkins.getUpdateCenter().getPlugin("changelog-history").deploy().get();
UpdateSite.Plugin plugin = j.jenkins.getUpdateCenter().getSite("default").getPlugin("changelog-history");
assumeNotNull(plugin);
plugin.sha512 = wrongChecksum;
DownloadJob job = (DownloadJob) plugin.deploy().get();
assertTrue(job.status instanceof Failure);
assertTrue("error message references checksum", ((Failure) job.status).problem.getMessage().contains(wrongChecksum));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.junit.Assert;
import org.junit.Assume;
import static org.junit.Assume.*;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand All @@ -44,10 +44,14 @@ public class UpdateCenterPluginInstallTest {
@Rule
public JenkinsRule jenkinsRule = new JenkinsRule();

public void setup() throws IOException {
jenkinsRule.jenkins.getUpdateCenter().getSite(UpdateCenter.ID_DEFAULT).updateDirectlyNow(false);
private void setup() {
try {
jenkinsRule.jenkins.getUpdateCenter().getSite(UpdateCenter.ID_DEFAULT).updateDirectlyNow(false);
} catch (Exception x) {
assumeNoException(x);
}
InetSocketAddress address = new InetSocketAddress("updates.jenkins-ci.org", 80);
Assume.assumeFalse("Unable to resolve updates.jenkins-ci.org. Skip test.", address.isUnresolved());
assumeFalse("Unable to resolve updates.jenkins-ci.org. Skip test.", address.isUnresolved());
}

@Test
Expand Down

0 comments on commit c9342fd

Please sign in to comment.