Skip to content

Commit

Permalink
Merge branch 'update-forms' into update-forms-2
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Dec 5, 2021
2 parents 1563e75 + 6d0452f commit 005147d
Show file tree
Hide file tree
Showing 162 changed files with 867 additions and 1,290 deletions.
7 changes: 1 addition & 6 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.1.12</version>
<version>3.1.13</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
Expand Down Expand Up @@ -263,11 +263,6 @@ THE SOFTWARE.
<artifactId>jna</artifactId>
<version>5.10.0</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>libpam4j</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>com.sun.solaris</groupId>
<artifactId>embedded_su4j</artifactId>
Expand Down
3 changes: 3 additions & 0 deletions cli/src/main/java/hudson/util/QuotedStringTokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ else if (c=='\\')
else
_token.append(c);
continue;

default:
break;
}
}

Expand Down
12 changes: 7 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ THE SOFTWARE.
<dependency>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-annotation</artifactId>
<version>1.21</version>
<version>${bridge-method-injector.version}</version>
</dependency>

<dependency><!-- until we get this version through Stapler -->
Expand Down Expand Up @@ -380,6 +380,11 @@ THE SOFTWARE.
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>test-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -407,6 +412,7 @@ THE SOFTWARE.
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency><!-- needed by Jelly -->
Expand Down Expand Up @@ -453,10 +459,6 @@ THE SOFTWARE.
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>libpam4j</artifactId>
</dependency>
<dependency>
<groupId>com.sun.solaris</groupId>
<artifactId>embedded_su4j</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/hudson/FilePath.java
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ public abstract static class AbstractInterceptorCallableWrapper<T> implements De

private final DelegatingCallable<T, IOException> callable;

public AbstractInterceptorCallableWrapper(DelegatingCallable<T, IOException> callable) {
protected AbstractInterceptorCallableWrapper(DelegatingCallable<T, IOException> callable) {
this.callable = callable;
}

Expand Down Expand Up @@ -1639,7 +1639,7 @@ public FilePath createTempDir(final String prefix, final String suffix) throws I
} else {
s = new String[]{prefix, suffix};
}
String name = StringUtils.join(s, ".");
String name = String.join(".", s);
return new FilePath(this, act(new CreateTempDir(name)));
} catch (IOException e) {
throw new IOException("Failed to create a temp directory on "+remote,e);
Expand Down Expand Up @@ -1674,8 +1674,8 @@ public String invoke(File dir, VirtualChannel channel) throws IOException {

/**
* Deletes this file.
* @throws IOException if it exists but could not be successfully deleted
* @return true, for a modicum of compatibility
* @throws IOException if it exists but could not be successfully deleted
*/
public boolean delete() throws IOException, InterruptedException {
act(new Delete());
Expand Down Expand Up @@ -3076,7 +3076,7 @@ class Cancel extends RuntimeException {}
if (ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0) {
return true;
} else {
throw new InterruptedException("no matches found within " + bound);
throw (InterruptedException)new InterruptedException("no matches found within " + bound).initCause(c);
}
}
return ds.getIncludedFilesCount()!=0 || ds.getIncludedDirsCount()!=0;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ private static String[] logRecordPreformat(LogRecord r) {
String.format("%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp", new Date(r.getMillis())),
source,
r.getLevel().getLocalizedName(),
x == null ? message : message + printThrowable(x) + "\n"
x == null ? message : message + printThrowable(x) + "\n",
};
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public abstract class Launcher {
@Restricted(Beta.class)
protected EnvVarsFilterRuleWrapper envVarsFilterRuleWrapper;

public Launcher(@NonNull TaskListener listener, @CheckForNull VirtualChannel channel) {
protected Launcher(@NonNull TaskListener listener, @CheckForNull VirtualChannel channel) {
this.listener = listener;
this.channel = channel;
}
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ PluginManager doCreate(@NonNull Class<? extends PluginManager> klass,
*/
private final PluginStrategy strategy;

public PluginManager(ServletContext context, File rootDir) {
protected PluginManager(ServletContext context, File rootDir) {
this.context = context;

this.rootDir = rootDir;
Expand Down Expand Up @@ -854,6 +854,7 @@ private boolean containsHpiJpi(Collection<String> bundledPlugins, String name) {

/**
* Returns the manifest of a bundled but not-extracted plugin.
* @deprecated removed without replacement
*/
@Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
public @CheckForNull Manifest getBundledPluginManifest(String shortName) {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/PluginWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ public void enable() throws IOException {
/**
* Disables this plugin next time Jenkins runs. As it doesn't check anything, it's recommended to use the method
* {@link #disable(PluginDisableStrategy)}
* @deprecated use {@link #disable(PluginDisableStrategy)}
*/
@Deprecated //see https://issues.jenkins.io/browse/JENKINS-27177
public void disable() throws IOException {
Expand Down Expand Up @@ -1190,6 +1191,7 @@ public String getBackupVersion() {

/**
* Checks if this plugin is pinned and that's forcing us to use an older version than the bundled one.
* @deprecated removed without replacement
*/
@Deprecated // See https://groups.google.com/d/msg/jenkinsci-dev/kRobm-cxFw8/6V66uhibAwAJ
public boolean isPinningForcingOldVersion() {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/ProxyConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ public String getPassword() {
}

/**
* @return the encrypted proxy password
*
* @deprecated
* Use {@link #getSecretPassword()}
*
* @return the encrypted proxy password
*/
@Deprecated
public String getEncryptedPassword() {
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/hudson/TcpSlaveAgentListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import jenkins.util.SystemProperties;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand Down Expand Up @@ -159,7 +158,7 @@ public String getIdentityPublicKey() {
* @since 2.16
*/
public String getAgentProtocolNames() {
return StringUtils.join(Jenkins.get().getAgentProtocols(), ", ");
return String.join(", ", Jenkins.get().getAgentProtocols());
}

/**
Expand Down Expand Up @@ -429,7 +428,7 @@ public boolean connect(Socket socket) throws IOException {
new String(ping, StandardCharsets.UTF_8),
responseLength > 0 && responseLength <= response.length ?
new String(response, 0, responseLength, StandardCharsets.UTF_8) :
"bad response length " + responseLength
"bad response length " + responseLength,
});
return false;
}
Expand Down
38 changes: 4 additions & 34 deletions core/src/main/java/hudson/WebAppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ public class WebAppMain implements ServletContextListener {
}
};

/**This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context.
/**
* This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context.
* Exposes access from RingBufferLogHandler.DEFAULT_RING_BUFFER_SIZE to WebAppMain.
* Written for the requirements of JENKINS-50669
* @return int This returns DEFAULT_RING_BUFFER_SIZE
Expand Down Expand Up @@ -202,49 +203,18 @@ public Locale get() {
throw new IncompatibleVMDetected(); // nope
}

// JNA is no longer a hard requirement. It's just nice to have. See JENKINS-4820 for more context.
// // make sure JNA works. this can fail if
// // - platform is unsupported
// // - JNA is already loaded in another classloader
// // see http://wiki.jenkins-ci.org/display/JENKINS/JNA+is+already+loaded
// // TODO: or shall we instead modify Hudson to work gracefully without JNA?
// try {
// /*
// java.lang.UnsatisfiedLinkError: Native Library /builds/apps/glassfish/domains/hudson-domain/generated/jsp/j2ee-modules/hudson-1.309/loader/com/sun/jna/sunos-sparc/libjnidispatch.so already loaded in another classloader
// at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1743)
// at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1674)
// at java.lang.Runtime.load0(Runtime.java:770)
// at java.lang.System.load(System.java:1005)
// at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:746)
// at com.sun.jna.Native.loadNativeLibrary(Native.java:680)
// at com.sun.jna.Native.<clinit>(Native.java:108)
// at hudson.util.jna.GNUCLibrary.<clinit>(GNUCLibrary.java:86)
// at hudson.Util.createSymlink(Util.java:970)
// at hudson.model.Run.run(Run.java:1174)
// at hudson.matrix.MatrixBuild.run(MatrixBuild.java:149)
// at hudson.model.ResourceController.execute(ResourceController.java:88)
// at hudson.model.Executor.run(Executor.java:123)
// */
// String.valueOf(Native.POINTER_SIZE); // this meaningless operation forces the classloading and initialization
// } catch (LinkageError e) {
// if (e.getMessage().contains("another classloader"))
// context.setAttribute(APP,new JNADoublyLoaded(e));
// else
// context.setAttribute(APP,new HudsonFailedToLoad(e));
// }

// make sure this is servlet 2.4 container or above
try {
ServletResponse.class.getMethod("setCharacterEncoding",String.class);
} catch (NoSuchMethodException e) {
throw new IncompatibleServletVersionDetected(ServletResponse.class);
throw (IncompatibleServletVersionDetected)new IncompatibleServletVersionDetected(ServletResponse.class).initCause(e);
}

// make sure that we see Ant 1.7
try {
FileSet.class.getMethod("getDirectoryScanner");
} catch (NoSuchMethodException e) {
throw new IncompatibleAntVersionDetected(FileSet.class);
throw (IncompatibleAntVersionDetected)new IncompatibleAntVersionDetected(FileSet.class).initCause(e);
}

// make sure AWT is functioning, or else JFreeChart won't even load.
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/hudson/XmlFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ public String toString() {
* Opens a {@link Reader} that loads XML.
* This method uses {@link #sniffEncoding() the right encoding},
* not just the system default encoding.
* @throws IOException Encoding issues
* @return Reader for the file. should be close externally once read.
* @throws IOException Encoding issues
*/
public Reader readRaw() throws IOException {
try {
Expand Down Expand Up @@ -304,10 +304,10 @@ public void writeRawTo(Writer w) throws IOException {
/**
* Parses the beginning of the file and determines the encoding.
*
* @throws IOException
* if failed to detect encoding.
* @return
* always non-null.
* @throws IOException
* if failed to detect encoding.
*/
public String sniffEncoding() throws IOException {
class Eureka extends SAXException {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/hudson/cli/ConsoleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ protected int run() throws Exception {
if (p!=null) {
run = p.resolve(job);
if (run==null)
throw new IllegalStateException("Permalink "+build+" produced no build");
throw new IllegalStateException("Permalink "+build+" produced no build", e);
} else {
Permalink nearest = job.getPermalinks().findNearest(build);
throw new IllegalArgumentException(nearest == null ?
String.format("Not sure what you meant by \"%s\".", build) :
String.format("Not sure what you meant by \"%s\". Did you mean \"%s\"?",
build, nearest.getId()));
build, nearest.getId()), e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/cli/DisablePluginCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected int run() throws Exception {
try {
strategyToUse = PluginWrapper.PluginDisableStrategy.valueOf(strategy.toUpperCase());
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException(hudson.cli.Messages.DisablePluginCommand_NoSuchStrategy(strategy, String.format("%s, %s, %s", PluginWrapper.PluginDisableStrategy.NONE, PluginWrapper.PluginDisableStrategy.MANDATORY, PluginWrapper.PluginDisableStrategy.ALL)));
throw new IllegalArgumentException(hudson.cli.Messages.DisablePluginCommand_NoSuchStrategy(strategy, String.format("%s, %s, %s", PluginWrapper.PluginDisableStrategy.NONE, PluginWrapper.PluginDisableStrategy.MANDATORY, PluginWrapper.PluginDisableStrategy.ALL)), iae);
}

// disable...
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/hudson/cli/ListChangesCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ protected int act(List<Run<?, ?>> builds) throws IOException {
}
}
break;
default:
throw new AssertionError("Unknown format: " + format);
}

return 0;
Expand Down
18 changes: 18 additions & 0 deletions core/src/main/java/hudson/cli/declarative/MethodBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Objects;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
Expand Down Expand Up @@ -171,5 +172,22 @@ public Class<? extends Annotation> annotationType() {
public boolean hidden() {
return base.hidden();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ArgumentImpl)) {
return false;
}
ArgumentImpl argument = (ArgumentImpl) o;
return Objects.equals(base, argument.base) && bias == argument.bias;
}

@Override
public int hashCode() {
return Objects.hash(base, bias);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
* @since 1.349
*/
public abstract class ConsoleAnnotationDescriptor extends Descriptor<ConsoleNote<?>> implements ExtensionPoint {
public ConsoleAnnotationDescriptor(Class<? extends ConsoleNote<?>> clazz) {
protected ConsoleAnnotationDescriptor(Class<? extends ConsoleNote<?>> clazz) {
super(clazz);
}

public ConsoleAnnotationDescriptor() {
protected ConsoleAnnotationDescriptor() {
}

/**
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/console/ConsoleAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ public static <T> ConsoleAnnotator<T> combine(Collection<? extends ConsoleAnnota
switch (all.size()) {
case 0: return null; // none
case 1: return cast(all.iterator().next()); // just one
default: return new ConsoleAnnotatorAggregator<>(all);
}

return new ConsoleAnnotatorAggregator<>(all);
}

/**
Expand Down
Loading

0 comments on commit 005147d

Please sign in to comment.