diff --git a/bom/pom.xml b/bom/pom.xml
index 2fe8f8bfd9b3a..44220df8b8afa 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -40,7 +40,7 @@ THE SOFTWARE.
9.2
1.7.32
- 1627.v5c244c19f85f
+ 1638.v229a_24fa_b_17c
2.4.21
@@ -221,7 +221,7 @@ THE SOFTWARE.
com.github.jnr
jnr-posix
- 3.1.14
+ 3.1.15
org.kohsuke
diff --git a/cli/pom.xml b/cli/pom.xml
index 34a47850a8b22..8772f2658fc25 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -149,6 +149,14 @@
net
io.jenkins.cli.shaded.net
+
+ com
+ io.jenkins.cli.shaded.com
+
+
+ jakarta
+ io.jenkins.cli.shaded.jakarta
+
diff --git a/cli/src/main/java/hudson/cli/CLI.java b/cli/src/main/java/hudson/cli/CLI.java
index 862847df96731..a6a33c6f800e9 100644
--- a/cli/src/main/java/hudson/cli/CLI.java
+++ b/cli/src/main/java/hudson/cli/CLI.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson.cli;
import static java.util.logging.Level.FINE;
@@ -80,9 +81,10 @@ private CLI() {}
* @throws NotTalkingToJenkinsException when connection is not made to Jenkins service.
*/
/*package*/ static void verifyJenkinsConnection(URLConnection c) throws IOException {
- if (c.getHeaderField("X-Hudson")==null && c.getHeaderField("X-Jenkins")==null)
+ if (c.getHeaderField("X-Hudson") == null && c.getHeaderField("X-Jenkins") == null)
throw new NotTalkingToJenkinsException(c);
}
+
/*package*/ static final class NotTalkingToJenkinsException extends IOException {
NotTalkingToJenkinsException(String s) {
super(s);
@@ -106,14 +108,15 @@ public static void main(final String[] _args) throws Exception {
}
}
- private enum Mode {HTTP, SSH, WEB_SOCKET}
+ private enum Mode { HTTP, SSH, WEB_SOCKET }
+
public static int _main(String[] _args) throws Exception {
List args = Arrays.asList(_args);
PrivateKeyProvider provider = new PrivateKeyProvider();
String url = System.getenv("JENKINS_URL");
- if (url==null)
+ if (url == null)
url = System.getenv("HUDSON_URL");
boolean noKeyAuth = false;
@@ -130,10 +133,10 @@ public static int _main(String[] _args) throws Exception {
boolean strictHostKey = false;
- while(!args.isEmpty()) {
+ while (!args.isEmpty()) {
String head = args.get(0);
if (head.equals("-version")) {
- System.out.println("Version: "+computeVersion());
+ System.out.println("Version: " + computeVersion());
return 0;
}
if (head.equals("-http")) {
@@ -167,9 +170,9 @@ public static int _main(String[] _args) throws Exception {
printUsage("-remoting mode is no longer supported");
return -1;
}
- if(head.equals("-s") && args.size()>=2) {
+ if (head.equals("-s") && args.size() >= 2) {
url = args.get(1);
- args = args.subList(2,args.size());
+ args = args.subList(2, args.size());
continue;
}
if (head.equals("-noCertificateCheck")) {
@@ -185,15 +188,15 @@ public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
- args = args.subList(1,args.size());
+ args = args.subList(1, args.size());
continue;
}
if (head.equals("-noKeyAuth")) {
noKeyAuth = true;
- args = args.subList(1,args.size());
+ args = args.subList(1, args.size());
continue;
}
- if(head.equals("-i") && args.size()>=2) {
+ if (head.equals("-i") && args.size() >= 2) {
File f = getFileFromArguments(args);
if (!f.exists()) {
printUsage(Messages.CLI_NoSuchFileExists(f));
@@ -202,7 +205,7 @@ public boolean verify(String s, SSLSession sslSession) {
provider.readFrom(f);
- args = args.subList(2,args.size());
+ args = args.subList(2, args.size());
continue;
}
if (head.equals("-strictHostKey")) {
@@ -239,7 +242,7 @@ public boolean verify(String s, SSLSession sslSession) {
break;
}
- if(url==null) {
+ if (url == null) {
printUsage(Messages.CLI_NoURL());
return -1;
}
@@ -263,7 +266,7 @@ public boolean verify(String s, SSLSession sslSession) {
url += '/';
}
- if(args.isEmpty())
+ if (args.isEmpty())
args = Collections.singletonList("help"); // default to help
if (mode == null) {
@@ -338,6 +341,7 @@ class CLIEndpoint extends Endpoint {
@Override
public void onOpen(Session session, EndpointConfig config) {}
}
+
class Authenticator extends ClientEndpointConfig.Configurator {
@Override
public void beforeRequest(Map> headers) {
@@ -346,6 +350,7 @@ public void beforeRequest(Map> headers) {
}
}
}
+
ClientManager client = ClientManager.createClient(JdkClientContainer.class.getName()); // ~ ContainerProvider.getWebSocketContainer()
client.getProperties().put(ClientProperties.REDIRECT_ENABLED, true); // https://tyrus-project.github.io/documentation/1.13.1/index/tyrus-proprietary-config.html#d0e1775
Session session = client.connectToServer(new CLIEndpoint(), ClientEndpointConfig.Builder.create().configurator(new Authenticator()).build(), URI.create(url.replaceFirst("^http", "ws") + "cli/ws"));
@@ -354,6 +359,7 @@ public void beforeRequest(Map> headers) {
public void send(byte[] data) throws IOException {
session.getBasicRemote().sendBinary(ByteBuffer.wrap(data));
}
+
@Override
public void close() throws IOException {
session.close();
@@ -479,7 +485,7 @@ private static String computeVersion() {
Properties props = new Properties();
try {
InputStream is = CLI.class.getResourceAsStream("/jenkins/cli/jenkins-cli-version.properties");
- if(is!=null) {
+ if (is != null) {
try {
props.load(is);
} finally {
@@ -489,7 +495,7 @@ private static String computeVersion() {
} catch (IOException e) {
e.printStackTrace(); // if the version properties is missing, that's OK.
}
- return props.getProperty("version","?");
+ return props.getProperty("version", "?");
}
/**
@@ -520,7 +526,7 @@ static String usage() {
}
private static void printUsage(String msg) {
- if(msg!=null) System.out.println(msg);
+ if (msg != null) System.out.println(msg);
System.err.println(usage());
}
diff --git a/cli/src/main/java/hudson/cli/CLIConnectionFactory.java b/cli/src/main/java/hudson/cli/CLIConnectionFactory.java
index 0553dd215de57..9b4295b07cb34 100644
--- a/cli/src/main/java/hudson/cli/CLIConnectionFactory.java
+++ b/cli/src/main/java/hudson/cli/CLIConnectionFactory.java
@@ -5,7 +5,7 @@
/**
* Fluent-API to instantiate {@link CLI}.
- *
+ *
* @author Kohsuke Kawaguchi
*/
public class CLIConnectionFactory {
@@ -26,7 +26,7 @@ public CLIConnectionFactory authorization(String value) {
* Currently unused.
*/
public CLIConnectionFactory basicAuth(String username, String password) {
- return basicAuth(username+':'+password);
+ return basicAuth(username + ':' + password);
}
/**
diff --git a/cli/src/main/java/hudson/cli/DiagnosedStreamCorruptionException.java b/cli/src/main/java/hudson/cli/DiagnosedStreamCorruptionException.java
index 4708b425dbb77..a701cb3033474 100644
--- a/cli/src/main/java/hudson/cli/DiagnosedStreamCorruptionException.java
+++ b/cli/src/main/java/hudson/cli/DiagnosedStreamCorruptionException.java
@@ -41,14 +41,14 @@ public String toString() {
buf.append(super.toString()).append("\n");
buf.append("Read back: ").append(HexDump.toHex(readBack)).append('\n');
buf.append("Read ahead: ").append(HexDump.toHex(readAhead));
- if (diagnoseFailure!=null) {
+ if (diagnoseFailure != null) {
StringWriter w = new StringWriter();
PrintWriter p = new PrintWriter(w);
diagnoseFailure.printStackTrace(p);
p.flush();
buf.append("\nDiagnosis problem:\n ");
- buf.append(w.toString().trim().replace("\n","\n "));
+ buf.append(w.toString().trim().replace("\n", "\n "));
}
return buf.toString();
}
diff --git a/cli/src/main/java/hudson/cli/FlightRecorderInputStream.java b/cli/src/main/java/hudson/cli/FlightRecorderInputStream.java
index 4dc9700e9371e..5a1167c4fdc5d 100644
--- a/cli/src/main/java/hudson/cli/FlightRecorderInputStream.java
+++ b/cli/src/main/java/hudson/cli/FlightRecorderInputStream.java
@@ -52,13 +52,13 @@ public DiagnosedStreamCorruptionException analyzeCrash(Exception problem, String
final ByteArrayOutputStream readAhead = new ByteArrayOutputStream();
final IOException[] error = new IOException[1];
- Thread diagnosisThread = new Thread(diagnosisName+" stream corruption diagnosis thread") {
+ Thread diagnosisThread = new Thread(diagnosisName + " stream corruption diagnosis thread") {
@Override
public void run() {
int b;
try {
// not all InputStream will look for the thread interrupt flag, so check that explicitly to be defensive
- while (!Thread.interrupted() && (b=source.read())!=-1) {
+ while (!Thread.interrupted() && (b = source.read()) != -1) {
readAhead.write(b);
}
} catch (IOException e) {
@@ -81,14 +81,14 @@ public void run() {
if (diagnosisThread.isAlive())
diagnosisThread.interrupt(); // if it's not dead, kill
- return new DiagnosedStreamCorruptionException(problem,diagnosisProblem,getRecord(),readAhead.toByteArray());
+ return new DiagnosedStreamCorruptionException(problem, diagnosisProblem, getRecord(), readAhead.toByteArray());
}
@Override
public int read() throws IOException {
int i = source.read();
- if (i>=0)
+ if (i >= 0)
recorder.write(i);
return i;
}
@@ -96,8 +96,8 @@ public int read() throws IOException {
@Override
public int read(@NonNull byte[] b, int off, int len) throws IOException {
len = source.read(b, off, len);
- if (len>0)
- recorder.write(b,off,len);
+ if (len > 0)
+ recorder.write(b, off, len);
return len;
}
@@ -106,8 +106,8 @@ public int read(@NonNull byte[] b, int off, int len) throws IOException {
*/
@Override
public long skip(long n) throws IOException {
- byte[] buf = new byte[(int)Math.min(n,64*1024)];
- return read(buf,0,buf.length);
+ byte[] buf = new byte[(int) Math.min(n, 64 * 1024)];
+ return read(buf, 0, buf.length);
}
@Override
@@ -157,7 +157,7 @@ public synchronized byte[] toByteArray() {
System.arraycopy(data, 0, ret, capacity - pos, pos);
return ret;
}
-
+
/** @author @roadrunner2 */
@Override public synchronized void write(@NonNull byte[] buf, int off, int len) {
// no point in trying to copy more than capacity; this also simplifies logic below
diff --git a/cli/src/main/java/hudson/cli/FullDuplexHttpStream.java b/cli/src/main/java/hudson/cli/FullDuplexHttpStream.java
index fec9d7d3b9d3c..ae8917ab3aa6d 100644
--- a/cli/src/main/java/hudson/cli/FullDuplexHttpStream.java
+++ b/cli/src/main/java/hudson/cli/FullDuplexHttpStream.java
@@ -18,7 +18,7 @@
*/
public class FullDuplexHttpStream {
private final URL base;
-
+
private final OutputStream output;
private final InputStream input;
@@ -65,7 +65,7 @@ public FullDuplexHttpStream(URL base, String relativeTarget, String authorizatio
con.setDoOutput(true); // request POST to avoid caching
con.setRequestMethod("POST");
con.addRequestProperty("Session", uuid.toString());
- con.addRequestProperty("Side","download");
+ con.addRequestProperty("Side", "download");
if (authorization != null) {
con.addRequestProperty("Authorization", authorization);
}
@@ -83,11 +83,11 @@ public FullDuplexHttpStream(URL base, String relativeTarget, String authorizatio
con.setDoOutput(true); // request POST
con.setRequestMethod("POST");
con.setChunkedStreamingMode(0);
- con.setRequestProperty("Content-type","application/octet-stream");
+ con.setRequestProperty("Content-type", "application/octet-stream");
con.addRequestProperty("Session", uuid.toString());
- con.addRequestProperty("Side","upload");
+ con.addRequestProperty("Side", "upload");
if (authorization != null) {
- con.addRequestProperty ("Authorization", authorization);
+ con.addRequestProperty("Authorization", authorization);
}
output = con.getOutputStream();
LOGGER.fine("established upload side");
@@ -118,5 +118,5 @@ private URL tryToResolveRedirects(URL base, String authorization) {
static final int BLOCK_SIZE = 1024;
static final Logger LOGGER = Logger.getLogger(FullDuplexHttpStream.class.getName());
-
+
}
diff --git a/cli/src/main/java/hudson/cli/HexDump.java b/cli/src/main/java/hudson/cli/HexDump.java
index ad37158bc16d0..0132f47f130da 100644
--- a/cli/src/main/java/hudson/cli/HexDump.java
+++ b/cli/src/main/java/hudson/cli/HexDump.java
@@ -9,13 +9,14 @@ class HexDump {
private static final String CODE = "0123456789abcdef";
public static String toHex(byte[] buf) {
- return toHex(buf,0,buf.length);
+ return toHex(buf, 0, buf.length);
}
+
public static String toHex(byte[] buf, int start, int len) {
- StringBuilder r = new StringBuilder(len*2);
+ StringBuilder r = new StringBuilder(len * 2);
boolean inText = false;
- for (int i=0; i= 0x20 && b <= 0x7e) {
if (!inText) {
inText = true;
@@ -28,8 +29,8 @@ public static String toHex(byte[] buf, int start, int len) {
inText = false;
}
r.append("0x");
- r.append(CODE.charAt((b>>4)&15));
- r.append(CODE.charAt(b&15));
+ r.append(CODE.charAt((b >> 4) & 15));
+ r.append(CODE.charAt(b & 15));
if (i < len - 1) {
if (b == 10) {
r.append('\n');
diff --git a/cli/src/main/java/hudson/cli/PlainCLIProtocol.java b/cli/src/main/java/hudson/cli/PlainCLIProtocol.java
index 0c14433d10196..ac1f9dbfe10bb 100644
--- a/cli/src/main/java/hudson/cli/PlainCLIProtocol.java
+++ b/cli/src/main/java/hudson/cli/PlainCLIProtocol.java
@@ -233,10 +233,12 @@ protected final OutputStream stream(final Op op) {
public void write(int b) throws IOException {
send(op, new byte[] {(byte) b});
}
+
@Override
public void write(@NonNull byte[] b, int off, int len) throws IOException {
send(op, b, off, len);
}
+
@Override
public void write(@NonNull byte[] b) throws IOException {
send(op, b);
diff --git a/cli/src/main/java/hudson/cli/PrivateKeyProvider.java b/cli/src/main/java/hudson/cli/PrivateKeyProvider.java
index f283053f9cb59..64c84fc2074de 100644
--- a/cli/src/main/java/hudson/cli/PrivateKeyProvider.java
+++ b/cli/src/main/java/hudson/cli/PrivateKeyProvider.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson.cli;
import static java.util.logging.Level.FINE;
@@ -110,15 +111,15 @@ public void readFrom(File keyFile) throws IOException, GeneralSecurityException
privateKeys.add(loadKey(keyFile, password));
}
- private static boolean isPemEncrypted(File f) throws IOException{
+ private static boolean isPemEncrypted(File f) throws IOException {
//simple check if the file is encrypted
return readPemFile(f).contains("4,ENCRYPTED");
}
- private static String askForPasswd(String filePath){
+ private static String askForPasswd(String filePath) {
Console cons = System.console();
String passwd = null;
- if (cons != null){
+ if (cons != null) {
char[] p = cons.readPassword("%s", "Enter passphrase for " + filePath + ":");
passwd = String.valueOf(p);
}
@@ -129,7 +130,7 @@ public static KeyPair loadKey(File f, String passwd) throws IOException, General
return loadKey(readPemFile(f), passwd);
}
- private static String readPemFile(File f) throws IOException{
+ private static String readPemFile(File f) throws IOException {
try (InputStream is = Files.newInputStream(f.toPath());
DataInputStream dis = new DataInputStream(is)) {
byte[] bytes = new byte[(int) f.length()];
diff --git a/cli/src/main/java/hudson/cli/SSHCLI.java b/cli/src/main/java/hudson/cli/SSHCLI.java
index d9fa4911df84c..5badd296fbf0e 100644
--- a/cli/src/main/java/hudson/cli/SSHCLI.java
+++ b/cli/src/main/java/hudson/cli/SSHCLI.java
@@ -85,7 +85,7 @@ static int sshConnection(String jenkinsUrl, String user, List args, Priv
command.append(' ');
}
- try(SshClient client = SshClient.setUpDefaultClient()) {
+ try (SshClient client = SshClient.setUpDefaultClient()) {
KnownHostsServerKeyVerifier verifier = new DefaultKnownHostsServerKeyVerifier(new ServerKeyVerifier() {
@Override
@@ -116,7 +116,7 @@ public boolean verifyServerKey(ClientSession clientSession, SocketAddress remote
Set waitMask = channel.waitFor(Collections.singletonList(ClientChannelEvent.CLOSED), 0L);
- if(waitMask.contains(ClientChannelEvent.TIMEOUT)) {
+ if (waitMask.contains(ClientChannelEvent.TIMEOUT)) {
throw new SocketTimeoutException("Failed to retrieve command result in time: " + command);
}
diff --git a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java
index 6b8a6f43f7811..6f77b758bc1f3 100644
--- a/cli/src/main/java/hudson/util/QuotedStringTokenizer.java
+++ b/cli/src/main/java/hudson/util/QuotedStringTokenizer.java
@@ -33,6 +33,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
+
package hudson.util;
import java.util.ArrayList;
@@ -55,24 +56,24 @@
public class QuotedStringTokenizer
extends StringTokenizer
{
- private static final String __delim=" \t\n\r";
+ private static final String __delim = " \t\n\r";
private String _string;
private String _delim = __delim;
- private boolean _returnQuotes=false;
- private boolean _returnDelimiters=false;
+ private boolean _returnQuotes = false;
+ private boolean _returnDelimiters = false;
private StringBuilder _token;
- private boolean _hasToken=false;
- private int _i=0;
- private int _lastStart=0;
- private boolean _double=true;
- private boolean _single=true;
+ private boolean _hasToken = false;
+ private int _i = 0;
+ private int _lastStart = 0;
+ private boolean _double = true;
+ private boolean _single = true;
public static String[] tokenize(String str) {
return new QuotedStringTokenizer(str).toArray();
}
public static String[] tokenize(String str, String delimiters) {
- return new QuotedStringTokenizer(str,delimiters).toArray();
+ return new QuotedStringTokenizer(str, delimiters).toArray();
}
/* ------------------------------------------------------------ */
@@ -94,17 +95,17 @@ public QuotedStringTokenizer(String str,
boolean returnQuotes)
{
super("");
- _string=str;
- if (delim!=null)
- _delim=delim;
- _returnDelimiters=returnDelimiters;
- _returnQuotes=returnQuotes;
+ _string = str;
+ if (delim != null)
+ _delim = delim;
+ _returnDelimiters = returnDelimiters;
+ _returnQuotes = returnQuotes;
- if (_delim.indexOf('\'')>=0 ||
- _delim.indexOf('"')>=0)
- throw new Error("Can't use quotes as delimiters: "+_delim);
+ if (_delim.indexOf('\'') >= 0 ||
+ _delim.indexOf('"') >= 0)
+ throw new Error("Can't use quotes as delimiters: " + _delim);
- _token=new StringBuilder(_string.length()>1024?512:_string.length()/2);
+ _token = new StringBuilder(_string.length() > 1024 ? 512 : _string.length() / 2);
}
/* ------------------------------------------------------------ */
@@ -112,25 +113,25 @@ public QuotedStringTokenizer(String str,
String delim,
boolean returnDelimiters)
{
- this(str,delim,returnDelimiters,false);
+ this(str, delim, returnDelimiters, false);
}
/* ------------------------------------------------------------ */
public QuotedStringTokenizer(String str,
String delim)
{
- this(str,delim,false,false);
+ this(str, delim, false, false);
}
/* ------------------------------------------------------------ */
public QuotedStringTokenizer(String str)
{
- this(str,null,false,false);
+ this(str, null, false, false);
}
public String[] toArray() {
List r = new ArrayList<>();
- while(hasMoreTokens())
+ while (hasMoreTokens())
r.add(nextToken());
return r.toArray(new String[r.size()]);
}
@@ -144,75 +145,75 @@ public boolean hasMoreTokens()
if (_hasToken)
return true;
- _lastStart=_i;
+ _lastStart = _i;
- int state=0;
- boolean escape=false;
- while (_i<_string.length())
+ int state = 0;
+ boolean escape = false;
+ while (_i < _string.length())
{
- char c=_string.charAt(_i++);
+ char c = _string.charAt(_i++);
switch (state)
{
case 0: // Start
- if(_delim.indexOf(c)>=0)
+ if (_delim.indexOf(c) >= 0)
{
if (_returnDelimiters)
{
_token.append(c);
- return _hasToken=true;
+ return _hasToken = true;
}
}
- else if (c=='\'' && _single)
+ else if (c == '\'' && _single)
{
if (_returnQuotes)
_token.append(c);
- state=2;
+ state = 2;
}
- else if (c=='\"' && _double)
+ else if (c == '\"' && _double)
{
if (_returnQuotes)
_token.append(c);
- state=3;
+ state = 3;
}
else
{
_token.append(c);
- _hasToken=true;
- state=1;
+ _hasToken = true;
+ state = 1;
}
continue;
case 1: // Token
- _hasToken=true;
+ _hasToken = true;
if (escape)
{
- escape=false;
- if(ESCAPABLE_CHARS.indexOf(c)<0)
+ escape = false;
+ if (ESCAPABLE_CHARS.indexOf(c) < 0)
_token.append('\\');
_token.append(c);
}
- else if(_delim.indexOf(c)>=0)
+ else if (_delim.indexOf(c) >= 0)
{
if (_returnDelimiters)
_i--;
return _hasToken;
}
- else if (c=='\'' && _single)
+ else if (c == '\'' && _single)
{
if (_returnQuotes)
_token.append(c);
- state=2;
+ state = 2;
}
- else if (c=='\"' && _double)
+ else if (c == '\"' && _double)
{
if (_returnQuotes)
_token.append(c);
- state=3;
+ state = 3;
}
- else if (c=='\\')
+ else if (c == '\\')
{
- escape=true;
+ escape = true;
}
else
_token.append(c);
@@ -220,25 +221,25 @@ else if (c=='\\')
case 2: // Single Quote
- _hasToken=true;
+ _hasToken = true;
if (escape)
{
- escape=false;
- if(ESCAPABLE_CHARS.indexOf(c)<0)
+ escape = false;
+ if (ESCAPABLE_CHARS.indexOf(c) < 0)
_token.append('\\');
_token.append(c);
}
- else if (c=='\'')
+ else if (c == '\'')
{
if (_returnQuotes)
_token.append(c);
- state=1;
+ state = 1;
}
- else if (c=='\\')
+ else if (c == '\\')
{
if (_returnQuotes)
_token.append(c);
- escape=true;
+ escape = true;
}
else
_token.append(c);
@@ -246,25 +247,25 @@ else if (c=='\\')
case 3: // Double Quote
- _hasToken=true;
+ _hasToken = true;
if (escape)
{
- escape=false;
- if(ESCAPABLE_CHARS.indexOf(c)<0)
+ escape = false;
+ if (ESCAPABLE_CHARS.indexOf(c) < 0)
_token.append('\\');
_token.append(c);
}
- else if (c=='\"')
+ else if (c == '\"')
{
if (_returnQuotes)
_token.append(c);
- state=1;
+ state = 1;
}
- else if (c=='\\')
+ else if (c == '\\')
{
if (_returnQuotes)
_token.append(c);
- escape=true;
+ escape = true;
}
else
_token.append(c);
@@ -283,11 +284,11 @@ else if (c=='\\')
public String nextToken()
throws NoSuchElementException
{
- if (!hasMoreTokens() || _token==null)
+ if (!hasMoreTokens() || _token == null)
throw new NoSuchElementException();
- String t=_token.toString();
+ String t = _token.toString();
_token.setLength(0);
- _hasToken=false;
+ _hasToken = false;
return t;
}
@@ -296,10 +297,10 @@ public String nextToken()
public String nextToken(String delim)
throws NoSuchElementException
{
- _delim=delim;
- _i=_lastStart;
+ _delim = delim;
+ _i = _lastStart;
_token.setLength(0);
- _hasToken=false;
+ _hasToken = false;
return nextToken();
}
@@ -338,19 +339,19 @@ public int countTokens()
*/
public static String quote(String s, String delim)
{
- if (s==null)
+ if (s == null)
return null;
- if (s.length()==0)
+ if (s.length() == 0)
return "\"\"";
- for (int i=0;i=0)
+ if (c == '\\' || c == '"' || c == '\'' || Character.isWhitespace(c) || delim.indexOf(c) >= 0)
{
- StringBuffer b=new StringBuffer(s.length()+8);
- quote(b,s);
+ StringBuffer b = new StringBuffer(s.length() + 8);
+ quote(b, s);
return b.toString();
}
}
@@ -368,13 +369,13 @@ public static String quote(String s, String delim)
*/
public static String quote(String s)
{
- if (s==null)
+ if (s == null)
return null;
- if (s.length()==0)
+ if (s.length() == 0)
return "\"\"";
- StringBuffer b=new StringBuffer(s.length()+8);
- quote(b,s);
+ StringBuffer b = new StringBuffer(s.length() + 8);
+ quote(b, s);
return b.toString();
}
@@ -388,13 +389,13 @@ public static String quote(String s)
*/
public static void quote(StringBuffer buf, String s)
{
- synchronized(buf)
+ synchronized (buf)
{
buf.append('"');
- for (int i=0;i= '0' && b <= '9') return (byte) (b - '0');
if (b >= 'a' && b <= 'f') return (byte) (b - 'a' + 10);
@@ -546,7 +547,7 @@ public static byte convertHexDigit( byte b )
*
* Others, like, say, \W will be left alone instead of becoming just W.
* This is important to keep Hudson behave on Windows, which uses '\' as
- * the directory separator.
+ * the directory separator.
*/
private static final String ESCAPABLE_CHARS = "\\\"' ";
}
diff --git a/cli/src/test/java/hudson/cli/HexDumpTest.java b/cli/src/test/java/hudson/cli/HexDumpTest.java
index 52b6c2e631f41..9e15de1453cbc 100644
--- a/cli/src/test/java/hudson/cli/HexDumpTest.java
+++ b/cli/src/test/java/hudson/cli/HexDumpTest.java
@@ -24,9 +24,9 @@ public void testToHex1(String expected, byte[] buf) {
static Stream testToHex1Sources() {
return Stream.of(
arguments("'fooBar'", new byte[] {'f', 'o', 'o', 'B', 'a', 'r'}),
- arguments("0xc3", new byte[] {(byte)'Ã'}),
- arguments("0xac '100'", new byte[] {(byte)'€', '1', '0', '0'}),
- arguments("'1' 0xf7 '2'", new byte[] {'1', (byte)'÷', '2'}),
+ arguments("0xc3", new byte[] {(byte) 'Ã'}),
+ arguments("0xac '100'", new byte[] {(byte) '€', '1', '0', '0'}),
+ arguments("'1' 0xf7 '2'", new byte[] {'1', (byte) '÷', '2'}),
arguments("'foo' 0x0a\n'Bar'", new byte[] {'f', 'o', 'o', '\n', 'B', 'a', 'r'})
);
}
@@ -41,9 +41,9 @@ public void testToHex2(String expected, byte[] buf, int start, int len) {
static Stream testToHex2Sources() {
return Stream.of(
arguments("'ooBa'", new byte[] {'f', 'o', 'o', 'B', 'a', 'r'}, 1, 4),
- arguments("0xc3", new byte[] {(byte)'Ã'}, 0, 1),
- arguments("0xac '10'", new byte[] {(byte)'€', '1', '0', '0'}, 0, 3),
- arguments("0xf7 '2'", new byte[] {'1', (byte)'÷', '2'}, 1, 2),
+ arguments("0xc3", new byte[] {(byte) 'Ã'}, 0, 1),
+ arguments("0xac '10'", new byte[] {(byte) '€', '1', '0', '0'}, 0, 3),
+ arguments("0xf7 '2'", new byte[] {'1', (byte) '÷', '2'}, 1, 2),
arguments("'Bar'", new byte[] {'f', 'o', 'o', '\n', 'B', 'a', 'r'}, 4, 3),
arguments("", new byte[] {'f', 'o', 'o', 'B', 'a', 'r'}, 0, 0)
);
diff --git a/cli/src/test/java/hudson/cli/PlainCLIProtocolTest.java b/cli/src/test/java/hudson/cli/PlainCLIProtocolTest.java
index 3eb29728fd71b..98a4fefd8001f 100644
--- a/cli/src/test/java/hudson/cli/PlainCLIProtocolTest.java
+++ b/cli/src/test/java/hudson/cli/PlainCLIProtocolTest.java
@@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.nio.charset.Charset;
import org.junit.jupiter.api.Test;
public class PlainCLIProtocolTest {
@@ -42,27 +43,34 @@ public void ignoreUnknownOperations() throws Exception {
class Client extends PlainCLIProtocol.ClientSide {
int code = -1;
final ByteArrayOutputStream stdout = new ByteArrayOutputStream();
+
Client() throws IOException {
super(new PlainCLIProtocol.FramedOutput(upload));
}
+
@Override
protected synchronized void onExit(int code) {
this.code = code;
notifyAll();
}
+
@Override
protected void onStdout(byte[] chunk) throws IOException {
stdout.write(chunk);
}
+
@Override
protected void onStderr(byte[] chunk) throws IOException {}
+
@Override
protected void handleClose() {}
+
void send() throws IOException {
sendArg("command");
sendStart();
- streamStdin().write("hello".getBytes());
+ streamStdin().write("hello".getBytes(Charset.defaultCharset()));
}
+
void newop() throws IOException {
DataOutputStream dos = new DataOutputStream(upload);
dos.writeInt(0);
@@ -70,26 +78,33 @@ void newop() throws IOException {
dos.flush();
}
}
+
class Server extends PlainCLIProtocol.ServerSide {
String arg;
boolean started;
final ByteArrayOutputStream stdin = new ByteArrayOutputStream();
+
Server() throws IOException {
super(new PlainCLIProtocol.FramedOutput(download));
}
+
@Override
protected void onArg(String text) {
arg = text;
}
+
@Override
protected void onLocale(String text) {}
+
@Override
protected void onEncoding(String text) {}
+
@Override
protected synchronized void onStart() {
started = true;
notifyAll();
}
+
@Override
protected void onStdin(byte[] chunk) throws IOException {
/* To inject a race condition:
@@ -101,14 +116,18 @@ protected void onStdin(byte[] chunk) throws IOException {
*/
stdin.write(chunk);
}
+
@Override
protected void onEndStdin() throws IOException {}
+
@Override
protected void handleClose() {}
+
void send() throws IOException {
- streamStdout().write("goodbye".getBytes());
+ streamStdout().write("goodbye".getBytes(Charset.defaultCharset()));
sendExit(2);
}
+
void newop() throws IOException {
DataOutputStream dos = new DataOutputStream(download);
dos.writeInt(0);
@@ -116,6 +135,7 @@ void newop() throws IOException {
dos.flush();
}
}
+
Client client = new Client();
Server server = new Server();
new PlainCLIProtocol.FramedReader(client, new PipedInputStream(download)).start();
@@ -137,9 +157,9 @@ void newop() throws IOException {
while (server.stdin.size() == 0) {
Thread.sleep(100);
}
- assertEquals("hello", server.stdin.toString());
+ assertEquals("hello", server.stdin.toString(Charset.defaultCharset().name()));
assertEquals("command", server.arg);
- assertEquals("goodbye", client.stdout.toString());
+ assertEquals("goodbye", client.stdout.toString(Charset.defaultCharset().name()));
assertEquals(2, client.code);
}
diff --git a/cli/src/test/java/hudson/util/QuotedStringTokenizerTest.java b/cli/src/test/java/hudson/util/QuotedStringTokenizerTest.java
index 9af792ca7b2fb..e5c546d11c3ee 100644
--- a/cli/src/test/java/hudson/util/QuotedStringTokenizerTest.java
+++ b/cli/src/test/java/hudson/util/QuotedStringTokenizerTest.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson.util;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
@@ -38,19 +39,19 @@ public class QuotedStringTokenizerTest {
@Test
public void test1() {
check("foo bar",
- "foo","bar");
+ "foo", "bar");
}
@Test
public void test2() {
check("foo \"bar zot\"",
- "foo","bar zot");
+ "foo", "bar zot");
}
@Test
public void test3() {
check("foo bar=\"quote zot\"",
- "foo","bar=quote zot");
+ "foo", "bar=quote zot");
}
@Test
@@ -68,7 +69,7 @@ public void test5() {
@Test
public void test6() {
check("foo\\\\ bar",
- "foo\\","bar");
+ "foo\\", "bar");
}
// see http://www.nabble.com/Error-parsing-%22-in-msbuild-task-to20535754.html
diff --git a/core/src/main/java/hudson/AbortException.java b/core/src/main/java/hudson/AbortException.java
index b68276e8eec12..d3d58122c87ee 100644
--- a/core/src/main/java/hudson/AbortException.java
+++ b/core/src/main/java/hudson/AbortException.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import java.io.IOException;
diff --git a/core/src/main/java/hudson/AboutJenkins.java b/core/src/main/java/hudson/AboutJenkins.java
index 04847d28853e0..56f463da1db1e 100644
--- a/core/src/main/java/hudson/AboutJenkins.java
+++ b/core/src/main/java/hudson/AboutJenkins.java
@@ -11,7 +11,7 @@
/**
* Show "About Jenkins" link.
- *
+ *
* @author Kohsuke Kawaguchi
*/
@Extension @Symbol("about")
diff --git a/core/src/main/java/hudson/AbstractMarkupText.java b/core/src/main/java/hudson/AbstractMarkupText.java
index 59e65e9bcba02..b13eeaad3edd0 100644
--- a/core/src/main/java/hudson/AbstractMarkupText.java
+++ b/core/src/main/java/hudson/AbstractMarkupText.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import hudson.MarkupText.SubText;
@@ -74,15 +75,15 @@ public final int length() {
* For example, if the text was "abc", then {@code addMarkup(1,2,"","")}
* would generate {@code "abc"}
*/
- public abstract void addMarkup( int startPos, int endPos, String startTag, String endTag );
+ public abstract void addMarkup(int startPos, int endPos, String startTag, String endTag);
/**
* Inserts an A tag that surrounds the given position.
*
* @since 1.349
*/
- public void addHyperlink( int startPos, int endPos, String url ) {
- addMarkup(startPos,endPos,"","");
+ public void addHyperlink(int startPos, int endPos, String url) {
+ addMarkup(startPos, endPos, "", "");
}
/**
@@ -91,22 +92,22 @@ public void addHyperlink( int startPos, int endPos, String url ) {
*
* @since 1.395
*/
- public void addHyperlinkLowKey( int startPos, int endPos, String url ) {
- addMarkup(startPos,endPos,"","");
+ public void addHyperlinkLowKey(int startPos, int endPos, String url) {
+ addMarkup(startPos, endPos, "", "");
}
/**
* Hides the given text.
*/
- public void hide( int startPos, int endPos ) {
- addMarkup(startPos,endPos,"","");
+ public void hide(int startPos, int endPos) {
+ addMarkup(startPos, endPos, "", "");
}
/**
* Adds a start tag and end tag around the entire text
*/
public final void wrapBy(String startTag, String endTag) {
- addMarkup(0,length(),startTag,endTag);
+ addMarkup(0, length(), startTag, endTag);
}
/**
@@ -118,7 +119,7 @@ public MarkupText.SubText findToken(Pattern pattern) {
String text = getText();
Matcher m = pattern.matcher(text);
- if(m.find())
+ if (m.find())
return createSubText(m);
return null;
@@ -142,17 +143,17 @@ public List findTokens(Pattern pattern) {
Matcher m = pattern.matcher(text);
List r = new ArrayList<>();
- while(m.find()) {
+ while (m.find()) {
int idx = m.start();
- if(idx>0) {
- char ch = text.charAt(idx-1);
- if(Character.isLetter(ch) || Character.isDigit(ch))
+ if (idx > 0) {
+ char ch = text.charAt(idx - 1);
+ if (Character.isLetter(ch) || Character.isDigit(ch))
continue; // not at a word boundary
}
idx = m.end();
- if(idx optionalDepende
String pluginName = atts.getValue("Short-Name");
String jenkinsVersion = atts.getValue("Jenkins-Version");
- if (jenkinsVersion==null)
+ if (jenkinsVersion == null)
jenkinsVersion = atts.getValue("Hudson-Version");
for (Dependency d : DetachedPluginsUtil.getImpliedDependencies(pluginName, jenkinsVersion)) {
@@ -278,7 +279,7 @@ public static List getImpliedDependencies(String plugi
@Deprecated
protected ClassLoader createClassLoader(List paths, ClassLoader parent) throws IOException {
- return createClassLoader( paths, parent, null );
+ return createClassLoader(paths, parent, null);
}
/**
@@ -322,7 +323,7 @@ protected ClassLoader createClassLoader(List paths, ClassLoader parent, At
*/
private ClassLoader getBaseClassLoader(Attributes atts, ClassLoader base) {
String masked = atts.getValue("Mask-Classes");
- if(masked!=null)
+ if (masked != null)
base = new MaskingClassLoader(base, masked.trim().split("[ \t\r\n]+"));
return base;
}
@@ -335,7 +336,7 @@ public void initializeComponents(PluginWrapper plugin) {
public List> findComponents(Class type, Hudson hudson) {
List finders;
- if (type==ExtensionFinder.class) {
+ if (type == ExtensionFinder.class) {
// Avoid infinite recursion of using ExtensionFinders to find ExtensionFinders
finders = Collections.singletonList(new ExtensionFinder.Sezpoz());
} else {
@@ -346,7 +347,7 @@ public List> findComponents(Class type, Hudson huds
* See ExtensionFinder#scout(Class, Hudson) for the dead lock issue and what this does.
*/
if (LOGGER.isLoggable(Level.FINER))
- LOGGER.log(Level.FINER, "Scout-loading ExtensionList: "+type, new Throwable());
+ LOGGER.log(Level.FINER, "Scout-loading ExtensionList: " + type, new Throwable());
for (ExtensionFinder finder : finders) {
finder.scout(type, hudson);
}
@@ -364,7 +365,7 @@ public List> findComponents(Class type, Hudson huds
List> filtered = new ArrayList<>();
for (ExtensionComponent e : r) {
- if (ExtensionFilter.isAllowed(type,e))
+ if (ExtensionFilter.isAllowed(type, e))
filtered.add(e);
}
@@ -379,21 +380,21 @@ public void load(PluginWrapper wrapper) throws IOException {
Thread.currentThread().setContextClassLoader(wrapper.classLoader);
try {
String className = wrapper.getPluginClass();
- if(className==null) {
+ if (className == null) {
// use the default dummy instance
wrapper.setPlugin(new DummyImpl());
} else {
try {
Class> clazz = wrapper.classLoader.loadClass(className);
Object o = clazz.getDeclaredConstructor().newInstance();
- if(!(o instanceof Plugin)) {
- throw new IOException(className+" doesn't extend from hudson.Plugin");
+ if (!(o instanceof Plugin)) {
+ throw new IOException(className + " doesn't extend from hudson.Plugin");
}
wrapper.setPlugin((Plugin) o);
} catch (LinkageError | ClassNotFoundException e) {
- throw new IOException("Unable to load " + className + " from " + wrapper.getShortName(),e);
+ throw new IOException("Unable to load " + className + " from " + wrapper.getShortName(), e);
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
- throw new IOException("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
+ throw new IOException("Unable to create instance of " + className + " from " + wrapper.getShortName(), e);
}
}
@@ -402,9 +403,9 @@ public void load(PluginWrapper wrapper) throws IOException {
Plugin plugin = wrapper.getPluginOrFail();
plugin.setServletContext(pluginManager.context);
startPlugin(wrapper);
- } catch(Throwable t) {
+ } catch (Throwable t) {
// gracefully handle any error in plugin.
- throw new IOException("Failed to initialize",t);
+ throw new IOException("Failed to initialize", t);
}
} finally {
Thread.currentThread().setContextClassLoader(old);
@@ -428,14 +429,14 @@ private DependencyClassLoader findAncestorDependencyClassLoader(ClassLoader clas
{
for (; classLoader != null; classLoader = classLoader.getParent()) {
if (classLoader instanceof DependencyClassLoader) {
- return (DependencyClassLoader)classLoader;
+ return (DependencyClassLoader) classLoader;
}
if (classLoader instanceof AntClassLoader) {
// AntClassLoaders hold parents not only as AntClassLoader#getParent()
// but also as AntClassLoader#getConfiguredParent()
DependencyClassLoader ret = findAncestorDependencyClassLoader(
- ((AntClassLoader)classLoader).getConfiguredParent()
+ ((AntClassLoader) classLoader).getConfiguredParent()
);
if (ret != null) {
return ret;
@@ -448,29 +449,29 @@ private DependencyClassLoader findAncestorDependencyClassLoader(ClassLoader clas
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "Administrator action installing a plugin, which could do far worse.")
private static File resolve(File base, String relative) {
File rel = new File(relative);
- if(rel.isAbsolute())
+ if (rel.isAbsolute())
return rel;
else
- return new File(base.getParentFile(),relative);
+ return new File(base.getParentFile(), relative);
}
private static void parseClassPath(Manifest manifest, File archive, List paths, String attributeName, String separator) throws IOException {
String classPath = manifest.getMainAttributes().getValue(attributeName);
- if(classPath==null) return; // attribute not found
+ if (classPath == null) return; // attribute not found
for (String s : classPath.split(separator)) {
File file = resolve(archive, s);
- if(file.getName().contains("*")) {
+ if (file.getName().contains("*")) {
// handle wildcard
FileSet fs = new FileSet();
File dir = file.getParentFile();
fs.setDir(dir);
fs.setIncludes(file.getName());
- for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) {
- paths.add(new File(dir,included));
+ for (String included : fs.getDirectoryScanner(new Project()).getIncludedFiles()) {
+ paths.add(new File(dir, included));
}
} else {
- if(!file.exists())
- throw new IOException("No such file: "+file);
+ if (!file.exists())
+ throw new IOException("No such file: " + file);
paths.add(file);
}
}
@@ -483,8 +484,8 @@ private static void explode(File archive, File destDir) throws IOException {
Util.createDirectories(Util.fileToPath(destDir));
// timestamp check
- File explodeTime = new File(destDir,".timestamp2");
- if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified())
+ File explodeTime = new File(destDir, ".timestamp2");
+ if (explodeTime.exists() && explodeTime.lastModified() == archive.lastModified())
return; // no need to expand
// delete the contents so that old files won't interfere with new files
@@ -495,7 +496,7 @@ private static void explode(File archive, File destDir) throws IOException {
unzipExceptClasses(archive, destDir, prj);
createClassJarFromWebInfClasses(archive, destDir, prj);
} catch (BuildException x) {
- throw new IOException("Failed to expand " + archive,x);
+ throw new IOException("Failed to expand " + archive, x);
}
try {
@@ -530,7 +531,7 @@ private static void createClassJarFromWebInfClasses(File archive, File destDir,
try (ZipOutputStream wrappedZOut = new ZipOutputStream(NullOutputStream.NULL_OUTPUT_STREAM) {
@Override
public void putNextEntry(ZipEntry ze) throws IOException {
- ze.setTime(dirTime+1999); // roundup
+ ze.setTime(dirTime + 1999); // roundup
super.putNextEntry(ze);
}
}) {
@@ -544,7 +545,7 @@ protected void zipDir(Resource dir, ZipOutputStream zOut, String vPath,
int mode, ZipExtraField[] extra)
throws IOException {
// use wrappedZOut instead of zOut
- super.zipDir(dir,wrappedZOut,vPath,mode,extra);
+ super.zipDir(dir, wrappedZOut, vPath, mode, extra);
}
};
z.setProject(prj);
@@ -617,7 +618,7 @@ protected List getEdges(PluginWrapper pw) {
List dep = new ArrayList<>();
for (Dependency d : pw.getDependencies()) {
PluginWrapper p = pluginManager.getPlugin(d.shortName);
- if (p!=null && p.isActive())
+ if (p != null && p.isActive())
dep.add(p);
}
return dep;
@@ -627,7 +628,7 @@ protected List getEdges(PluginWrapper pw) {
try {
for (Dependency d : dependencies) {
PluginWrapper p = pluginManager.getPlugin(d.shortName);
- if (p!=null && p.isActive())
+ if (p != null && p.isActive())
cgd.run(Collections.singleton(p));
}
} catch (CycleDetectedException e) {
@@ -654,7 +655,7 @@ protected Class> findClass(String name) throws ClassNotFoundException {
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
- if(p!=null) {
+ if (p != null) {
try {
return p.classLoader.loadClass(name);
} catch (ClassNotFoundException ignored) {
@@ -682,7 +683,7 @@ protected Enumeration findResources(String name) throws IOException {
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
- if (p!=null) {
+ if (p != null) {
Enumeration urls = p.classLoader.getResources(name);
while (urls != null && urls.hasMoreElements())
result.add(urls.nextElement());
@@ -698,14 +699,14 @@ protected URL findResource(String name) {
if (PluginManager.FAST_LOOKUP) {
for (PluginWrapper pw : getTransitiveDependencies()) {
URL url = ClassLoaderReflectionToolkit._findResource(pw.classLoader, name);
- if (url!=null) return url;
+ if (url != null) return url;
}
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
- if(p!=null) {
+ if (p != null) {
URL url = p.classLoader.getResource(name);
- if (url!=null)
+ if (url != null)
return url;
}
}
diff --git a/core/src/main/java/hudson/CloseProofOutputStream.java b/core/src/main/java/hudson/CloseProofOutputStream.java
index 5a9090e79cc40..0fc4aee48a5ce 100644
--- a/core/src/main/java/hudson/CloseProofOutputStream.java
+++ b/core/src/main/java/hudson/CloseProofOutputStream.java
@@ -1,18 +1,18 @@
/*
* 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
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import hudson.util.DelegatingOutputStream;
diff --git a/core/src/main/java/hudson/CopyOnWrite.java b/core/src/main/java/hudson/CopyOnWrite.java
index a36dbaf4e9f91..04e737964a801 100644
--- a/core/src/main/java/hudson/CopyOnWrite.java
+++ b/core/src/main/java/hudson/CopyOnWrite.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import static java.lang.annotation.ElementType.FIELD;
diff --git a/core/src/main/java/hudson/DependencyRunner.java b/core/src/main/java/hudson/DependencyRunner.java
index 914be79ffa6f7..b7db91fb94164 100644
--- a/core/src/main/java/hudson/DependencyRunner.java
+++ b/core/src/main/java/hudson/DependencyRunner.java
@@ -1,19 +1,19 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
* Brian Westrich, Jean-Baptiste Quenot
- *
+ *
* 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
@@ -22,6 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import hudson.model.AbstractProject;
@@ -41,7 +42,7 @@
public class DependencyRunner implements Runnable {
private static final Logger LOGGER = Logger.getLogger(DependencyRunner.class.getName());
-
+
ProjectRunnable runnable;
List polledProjects = new ArrayList<>();
@@ -72,11 +73,11 @@ public void run() {
}
private void populate(Collection extends AbstractProject> projectList) {
- for (AbstractProject,?> p : projectList) {
+ for (AbstractProject, ?> p : projectList) {
if (polledProjects.contains(p)) {
// Project will be readded at the queue, so that we always use
// the longest path
- LOGGER.fine("removing project " + p.getName() + " for re-add");
+ LOGGER.fine("removing project " + p.getName() + " for re-add");
polledProjects.remove(p);
}
diff --git a/core/src/main/java/hudson/DescriptorExtensionList.java b/core/src/main/java/hudson/DescriptorExtensionList.java
index 25f1191706509..7c9fbbddccacc 100644
--- a/core/src/main/java/hudson/DescriptorExtensionList.java
+++ b/core/src/main/java/hudson/DescriptorExtensionList.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import edu.umd.cs.findbugs.annotations.CheckForNull;
@@ -71,8 +72,8 @@ public class DescriptorExtensionList, D extends Descrip
* Creates a new instance.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
- public static ,D extends Descriptor>
- DescriptorExtensionList createDescriptorList(Jenkins jenkins, Class describableType) {
+ public static , D extends Descriptor>
+ DescriptorExtensionList createDescriptorList(Jenkins jenkins, Class describableType) {
if (describableType == Publisher.class) {
return (DescriptorExtensionList) new Publisher.DescriptorExtensionListImpl(jenkins);
}
@@ -84,9 +85,9 @@ DescriptorExtensionList createDescriptorList(Jenkins jenkins, Class desc
* Use {@link #create(Jenkins, Class)}
*/
@Deprecated
- public static ,D extends Descriptor>
- DescriptorExtensionList createDescriptorList(Hudson hudson, Class describableType) {
- return (DescriptorExtensionList)createDescriptorList((Jenkins)hudson,describableType);
+ public static , D extends Descriptor>
+ DescriptorExtensionList createDescriptorList(Hudson hudson, Class describableType) {
+ return (DescriptorExtensionList) createDescriptorList((Jenkins) hudson, describableType);
}
/**
@@ -100,11 +101,11 @@ DescriptorExtensionList createDescriptorList(Hudson hudson, Class descri
*/
@Deprecated
protected DescriptorExtensionList(Hudson hudson, Class describableType) {
- this((Jenkins)hudson,describableType);
+ this((Jenkins) hudson, describableType);
}
protected DescriptorExtensionList(Jenkins jenkins, Class describableType) {
- super(jenkins, (Class)Descriptor.class, (CopyOnWriteArrayList)getLegacyDescriptors(describableType));
+ super(jenkins, (Class) Descriptor.class, (CopyOnWriteArrayList) getLegacyDescriptors(describableType));
this.describableType = describableType;
}
@@ -117,7 +118,7 @@ protected DescriptorExtensionList(Jenkins jenkins, Class describableType) {
*/
@Deprecated
public D find(String fqcn) {
- return Descriptor.find(this,fqcn);
+ return Descriptor.find(this, fqcn);
}
/**
@@ -126,7 +127,7 @@ public D find(String fqcn) {
*/
public D find(Class extends T> type) {
for (D d : this)
- if (d.clazz==type)
+ if (d.clazz == type)
return d;
return null;
}
@@ -141,10 +142,10 @@ public D find(Class extends T> type) {
*/
@CheckForNull
public T newInstanceFromRadioList(JSONObject config) throws FormException {
- if(config.isNullObject())
+ if (config.isNullObject())
return null; // none was selected
int idx = config.getInt("value");
- return get(idx).newInstance(Stapler.getCurrentRequest(),config);
+ return get(idx).newInstance(Stapler.getCurrentRequest(), config);
}
/**
@@ -171,7 +172,7 @@ public T newInstanceFromRadioList(@NonNull JSONObject parent, @NonNull String na
*/
public @CheckForNull D findByName(String id) {
for (D d : this)
- if(d.getId().equals(id))
+ if (d.getId().equals(id))
return d;
return null;
}
@@ -219,11 +220,11 @@ protected Collection> load(ExtensionComponentSet delta) {
private List> _load(Iterable> set) {
List> r = new ArrayList<>();
- for( ExtensionComponent c : set ) {
+ for (ExtensionComponent c : set) {
Descriptor d = c.getInstance();
try {
- if(d.getT()==describableType)
- r.add((ExtensionComponent)c);
+ if (d.getT() == describableType)
+ r.add((ExtensionComponent) c);
} catch (IllegalStateException e) {
LOGGER.log(Level.SEVERE, d.getClass() + " doesn't extend Descriptor with a type parameter", e); // skip this one
}
@@ -253,8 +254,8 @@ public static Iterable listLegacyInstances() {
return new Iterable() {
@Override
public Iterator iterator() {
- return new AdaptedIterator,Descriptor>(
- new FlattenIterator,CopyOnWriteArrayList>>(legacyDescriptors.values()) {
+ return new AdaptedIterator, Descriptor>(
+ new FlattenIterator, CopyOnWriteArrayList>>(legacyDescriptors.values()) {
@Override
protected Iterator> expand(CopyOnWriteArrayList> v) {
return v.iterator();
diff --git a/core/src/main/java/hudson/EnvVars.java b/core/src/main/java/hudson/EnvVars.java
index 673396061a6c3..cce69ede9ee84 100644
--- a/core/src/main/java/hudson/EnvVars.java
+++ b/core/src/main/java/hudson/EnvVars.java
@@ -1,18 +1,18 @@
/*
* The MIT License
- *
+ *
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Red Hat, Inc.
- *
+ *
* 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
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import edu.umd.cs.findbugs.annotations.CheckForNull;
@@ -71,7 +72,7 @@
*
* @author Kohsuke Kawaguchi
*/
-public class EnvVars extends TreeMap {
+public class EnvVars extends TreeMap {
private static final long serialVersionUID = 4320331661987259022L;
private static Logger LOGGER = Logger.getLogger(EnvVars.class.getName());
/**
@@ -84,7 +85,7 @@ public class EnvVars extends TreeMap {
* So this property remembers that information.
*/
private Platform platform;
-
+
/**
* Gets the platform for which these env vars targeted.
* @since 2.144
@@ -102,11 +103,12 @@ public class EnvVars extends TreeMap {
public void setPlatform(@NonNull Platform platform) {
this.platform = platform;
}
+
public EnvVars() {
super(String.CASE_INSENSITIVE_ORDER);
}
- public EnvVars(@NonNull Map m) {
+ public EnvVars(@NonNull Map m) {
this();
putAll(m);
@@ -121,7 +123,7 @@ public EnvVars(@NonNull Map m) {
@SuppressWarnings("CopyConstructorMissesField") // does not set #platform, see its Javadoc
public EnvVars(@NonNull EnvVars m) {
// this constructor is so that in future we can get rid of the downcasting.
- this((Map)m);
+ this((Map) m);
}
/**
@@ -129,10 +131,10 @@ public EnvVars(@NonNull EnvVars m) {
*/
public EnvVars(String... keyValuePairs) {
this();
- if(keyValuePairs.length%2!=0)
+ if (keyValuePairs.length % 2 != 0)
throw new IllegalArgumentException(Arrays.asList(keyValuePairs).toString());
- for( int i=0; i0) {
- String realKey = key.substring(0,idx);
+ if (idx > 0) {
+ String realKey = key.substring(0, idx);
String v = get(realKey);
- if(v==null) v=value;
+ if (v == null) v = value;
else {
// we might be handling environment variables for a agent that can have different path separator
// than the controller, so the following is an attempt to get it right.
// it's still more error prone that I'd like.
- char ch = platform==null ? File.pathSeparatorChar : platform.pathSeparator;
- v=value+ch+v;
+ char ch = platform == null ? File.pathSeparatorChar : platform.pathSeparator;
+ v = value + ch + v;
}
- put(realKey,v);
+ put(realKey, v);
return;
}
- put(key,value);
+ put(key, value);
}
/**
@@ -171,18 +173,18 @@ public void override(String key, String value) {
* See {@link #override(String, String)}.
* @return this
*/
- public EnvVars overrideAll(Map all) {
+ public EnvVars overrideAll(Map all) {
for (Map.Entry e : all.entrySet()) {
- override(e.getKey(),e.getValue());
+ override(e.getKey(), e.getValue());
}
return this;
}
/**
* Calculates the order to override variables.
- *
+ *
* Sort variables with topological sort with their reference graph.
- *
+ *
* This is package accessible for testing purpose.
*/
static class OverrideOrderCalculator {
@@ -192,31 +194,31 @@ static class OverrideOrderCalculator {
private static class TraceResolver implements VariableResolver {
private final Comparator super String> comparator;
public Set referredVariables;
-
+
TraceResolver(Comparator super String> comparator) {
this.comparator = comparator;
clear();
}
-
+
public void clear() {
referredVariables = new TreeSet<>(comparator);
}
-
+
@Override
public String resolve(String name) {
referredVariables.add(name);
return "";
}
}
-
+
private static class VariableReferenceSorter extends CyclicGraphDetector {
// map from a variable to a set of variables that variable refers.
private final Map> refereeSetMap;
-
+
VariableReferenceSorter(Map> refereeSetMap) {
this.refereeSetMap = refereeSetMap;
}
-
+
@Override
protected Iterable extends String> getEdges(String n) {
// return variables referred from the variable.
@@ -229,32 +231,32 @@ protected Iterable extends String> getEdges(String n) {
}
private final Comparator super String> comparator;
-
+
@NonNull
private final EnvVars target;
@NonNull
- private final Map overrides;
-
+ private final Map overrides;
+
private Map> refereeSetMap;
private List orderedVariableNames;
-
- OverrideOrderCalculator(@NonNull EnvVars target, @NonNull Map overrides) {
+
+ OverrideOrderCalculator(@NonNull EnvVars target, @NonNull Map overrides) {
comparator = target.comparator();
this.target = target;
this.overrides = overrides;
scan();
}
-
+
public List getOrderedVariableNames() {
return orderedVariableNames;
}
-
+
// Cut the reference to the variable in a cycle.
private void cutCycleAt(String referee, List cycle) {
// cycle contains variables in referrer-to-referee order.
// This should not be negative, for the first and last one is same.
int refererIndex = cycle.lastIndexOf(referee) - 1;
-
+
assert refererIndex >= 0;
String referrer = cycle.get(refererIndex);
boolean removed = refereeSetMap.get(referrer).remove(referee);
@@ -262,7 +264,7 @@ private void cutCycleAt(String referee, List cycle) {
LOGGER.warning(String.format("Cyclic reference detected: %s", String.join(" -> ", cycle)));
LOGGER.warning(String.format("Cut the reference %s -> %s", referrer, referee));
}
-
+
// Cut the variable reference in a cycle.
private void cutCycle(List cycle) {
// if an existing variable is contained in that cycle,
@@ -273,27 +275,27 @@ private void cutCycle(List cycle) {
// PATH1=/usr/local/bin:${PATH}
// PATH=/opt/something/bin:${PATH1}
// then consider reference PATH1 -> PATH can be ignored.
- for (String referee: cycle) {
+ for (String referee : cycle) {
if (target.containsKey(referee)) {
cutCycleAt(referee, cycle);
return;
}
}
-
+
// if not, cut the reference to the first one.
cutCycleAt(cycle.get(0), cycle);
}
-
+
/**
* Scan all variables and list all referring variables.
*/
public void scan() {
refereeSetMap = new TreeMap<>(comparator);
List extendingVariableNames = new ArrayList<>();
-
+
TraceResolver resolver = new TraceResolver(comparator);
-
- for (Map.Entry entry: overrides.entrySet()) {
+
+ for (Map.Entry entry : overrides.entrySet()) {
if (entry.getKey().indexOf('+') > 0) {
// XYZ+AAA variables should be always processed in last.
extendingVariableNames.add(entry.getKey());
@@ -301,20 +303,20 @@ public void scan() {
}
resolver.clear();
Util.replaceMacro(entry.getValue(), resolver);
-
+
// Variables directly referred from the current scanning variable.
Set refereeSet = resolver.referredVariables;
// Ignore self reference.
refereeSet.remove(entry.getKey());
refereeSetMap.put(entry.getKey(), refereeSet);
}
-
+
VariableReferenceSorter sorter;
- while(true) {
+ while (true) {
sorter = new VariableReferenceSorter(refereeSetMap);
try {
sorter.run(refereeSetMap.keySet());
- } catch(CycleDetectedException e) {
+ } catch (CycleDetectedException e) {
// cyclic reference found.
// cut the cycle and retry.
@SuppressWarnings("unchecked")
@@ -324,15 +326,15 @@ public void scan() {
}
break;
}
-
+
// When A refers B, the last appearance of B always comes after
// the last appearance of A.
List reversedDuplicatedOrder = new ArrayList<>(sorter.getSorted());
Collections.reverse(reversedDuplicatedOrder);
-
+
orderedVariableNames = new ArrayList<>(overrides.size());
- for(String key: reversedDuplicatedOrder) {
- if(overrides.containsKey(key) && !orderedVariableNames.contains(key)) {
+ for (String key : reversedDuplicatedOrder) {
+ if (overrides.containsKey(key) && !orderedVariableNames.contains(key)) {
orderedVariableNames.add(key);
}
}
@@ -340,14 +342,14 @@ public void scan() {
orderedVariableNames.addAll(extendingVariableNames);
}
}
-
+
/**
* Overrides all values in the map by the given map. Expressions in values will be expanded.
* See {@link #override(String, String)}.
* @return {@code this}
*/
- public EnvVars overrideExpandingAll(@NonNull Map all) {
+ public EnvVars overrideExpandingAll(@NonNull Map all) {
for (String key : new OverrideOrderCalculator(this, all).getOrderedVariableNames()) {
override(key, expand(all.get(key)));
}
@@ -357,11 +359,11 @@ public EnvVars overrideExpandingAll(@NonNull Map all) {
/**
* Resolves environment variables against each other.
*/
- public static void resolve(Map env) {
- for (Map.Entry entry: env.entrySet()) {
- entry.setValue(Util.replaceMacro(entry.getValue(), env));
- }
- }
+ public static void resolve(Map env) {
+ for (Map.Entry entry : env.entrySet()) {
+ entry.setValue(Util.replaceMacro(entry.getValue(), env));
+ }
+ }
/**
* Convenience message
@@ -369,14 +371,14 @@ public static void resolve(Map env) {
**/
public String get(String key, String defaultValue) {
String v = get(key);
- if (v==null) v=defaultValue;
+ if (v == null) v = defaultValue;
return v;
}
@Override
public String put(String key, String value) {
- if (value==null) throw new IllegalArgumentException("Null value not allowed as an environment variable: "+key);
- return super.put(key,value);
+ if (value == null) throw new IllegalArgumentException("Null value not allowed as an environment variable: " + key);
+ return super.put(key, value);
}
/**
@@ -384,8 +386,8 @@ public String put(String key, String value) {
* @since 1.556
*/
public void putIfNotNull(String key, String value) {
- if (value!=null)
- put(key,value);
+ if (value != null)
+ put(key, value);
}
/**
@@ -396,14 +398,14 @@ public void putAllNonNull(Map map) {
map.forEach(this::putIfNotNull);
}
-
+
/**
* Takes a string that looks like "a=b" and adds that to this map.
*/
public void addLine(String line) {
int sep = line.indexOf('=');
- if(sep > 0) {
- put(line.substring(0,sep),line.substring(sep+1));
+ if (sep > 0) {
+ put(line.substring(0, sep), line.substring(sep + 1));
}
}
@@ -431,16 +433,17 @@ public static EnvVars createCookie() {
* A fresh copy that can be owned and modified by the caller.
*/
public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException {
- if(channel==null)
- return new EnvVars("N/A","N/A");
+ if (channel == null)
+ return new EnvVars("N/A", "N/A");
return channel.call(new GetEnvVars());
}
- private static final class GetEnvVars extends MasterToSlaveCallable {
+ private static final class GetEnvVars extends MasterToSlaveCallable {
@Override
public EnvVars call() {
return new EnvVars(EnvVars.masterEnvVars);
}
+
private static final long serialVersionUID = 1L;
}
@@ -456,12 +459,12 @@ public EnvVars call() {
* If you access this field from agents, then this is the environment
* variable of the agent.
*/
- public static final Map masterEnvVars = initMaster();
+ public static final Map masterEnvVars = initMaster();
private static EnvVars initMaster() {
EnvVars vars = new EnvVars(System.getenv());
vars.platform = Platform.current();
- if(Main.isUnitTest || Main.isDevelopmentMode)
+ if (Main.isUnitTest || Main.isDevelopmentMode)
// if unit test is launched with maven debug switch,
// we need to prevent forked Maven processes from seeing it, or else
// they'll hang
diff --git a/core/src/main/java/hudson/ExpressionFactory2.java b/core/src/main/java/hudson/ExpressionFactory2.java
index e71202f4552b1..7fcec22e76047 100644
--- a/core/src/main/java/hudson/ExpressionFactory2.java
+++ b/core/src/main/java/hudson/ExpressionFactory2.java
@@ -72,14 +72,14 @@ public String getExpressionText() {
public Object evaluate(JellyContext context) {
try {
CURRENT_CONTEXT.set(context);
- JexlContext jexlContext = new JellyJexlContext( context );
+ JexlContext jexlContext = new JellyJexlContext(context);
return expression.evaluate(jexlContext);
} catch (AccessDeniedException e) {
// let the security exception pass through
throw e;
} catch (Exception e) {
StaplerRequest currentRequest = Stapler.getCurrentRequest();
- LOGGER.log(Level.WARNING,"Caught exception evaluating: " + expression + " in " + (currentRequest != null ? currentRequest.getOriginalRequestURI() : "?") + ". Reason: " + e, e);
+ LOGGER.log(Level.WARNING, "Caught exception evaluating: " + expression + " in " + (currentRequest != null ? currentRequest.getOriginalRequestURI() : "?") + ". Reason: " + e, e);
return null;
} finally {
CURRENT_CONTEXT.set(null);
@@ -93,13 +93,13 @@ static final class JellyJexlContext implements JexlContext {
private Map vars;
JellyJexlContext(JellyContext context) {
- this.vars = new JellyMap( context );
+ this.vars = new JellyMap(context);
}
@Override
public void setVars(Map vars) {
this.vars.clear();
- this.vars.putAll( vars );
+ this.vars.putAll(vars);
}
@Override
@@ -119,7 +119,7 @@ static final class JellyMap implements Map {
@Override
public Object get(Object key) {
- return context.getVariable( (String) key );
+ return context.getVariable((String) key);
}
@Override
diff --git a/core/src/main/java/hudson/Extension.java b/core/src/main/java/hudson/Extension.java
index 0bcffcefbe294..b240e37f87db1 100644
--- a/core/src/main/java/hudson/Extension.java
+++ b/core/src/main/java/hudson/Extension.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import static java.lang.annotation.ElementType.FIELD;
diff --git a/core/src/main/java/hudson/ExtensionComponent.java b/core/src/main/java/hudson/ExtensionComponent.java
index e80eb8edc1d63..4ef48d08008d0 100644
--- a/core/src/main/java/hudson/ExtensionComponent.java
+++ b/core/src/main/java/hudson/ExtensionComponent.java
@@ -50,11 +50,11 @@ public ExtensionComponent(T instance, double ordinal) {
}
public ExtensionComponent(T instance, Extension annotation) {
- this(instance,annotation.ordinal());
+ this(instance, annotation.ordinal());
}
public ExtensionComponent(T instance) {
- this(instance,0);
+ this(instance, 0);
}
/**
@@ -79,7 +79,7 @@ public T getInstance() {
* For example, {@code component.isDescriptorOf(Builder.class)}
*/
public boolean isDescriptorOf(Class extends Describable> c) {
- return instance instanceof Descriptor && ((Descriptor)instance).isSubTypeOf(c);
+ return instance instanceof Descriptor && ((Descriptor) instance).isSubTypeOf(c);
}
/**
diff --git a/core/src/main/java/hudson/ExtensionFinder.java b/core/src/main/java/hudson/ExtensionFinder.java
index 10ca19bef5016..5bddd008f5f08 100644
--- a/core/src/main/java/hudson/ExtensionFinder.java
+++ b/core/src/main/java/hudson/ExtensionFinder.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import com.google.inject.AbstractModule;
@@ -38,6 +39,7 @@
import hudson.init.InitMilestone;
import hudson.model.Descriptor;
import hudson.model.Hudson;
+import jakarta.annotation.PostConstruct;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
@@ -55,7 +57,6 @@
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
-import javax.annotation.PostConstruct;
import jenkins.ExtensionComponentSet;
import jenkins.ExtensionFilter;
import jenkins.ExtensionRefreshException;
@@ -98,7 +99,7 @@ public Collection findExtensions(Class type, Hudson hudson) {
*/
public boolean isRefreshable() {
try {
- return getClass().getMethod("refresh").getDeclaringClass()!=ExtensionFinder.class;
+ return getClass().getMethod("refresh").getDeclaringClass() != ExtensionFinder.class;
} catch (NoSuchMethodException e) {
return false;
}
@@ -153,7 +154,7 @@ public Collection> _find(Class type, Hudson hudson)
}
/**
- * Performs class initializations without creating instances.
+ * Performs class initializations without creating instances.
*
* If two threads try to initialize classes in the opposite order, a dead lock will ensue,
* and we can get into a similar situation with {@link ExtensionFinder}s.
@@ -227,7 +228,7 @@ protected GuiceExtensionAnnotation(Class annotationType) {
protected abstract boolean isOptional(T annotation);
}
-
+
/**
* Discovers components via sezpoz but instantiates them by using Guice.
*/
@@ -246,15 +247,15 @@ public static class GuiceFinder extends ExtensionFinder {
* Sezpoz index we are currently using in {@link #container} (and its ancestors.)
* Needed to compute delta.
*/
- private List> sezpozIndex;
+ private List> sezpozIndex;
- private final Map annotations = new HashMap<>();
+ private final Map annotations = new HashMap<>();
private final Sezpoz moduleFinder = new Sezpoz();
/**
* Map from {@link GuiceExtensionAnnotation#annotationType} to {@link GuiceExtensionAnnotation}
*/
- private Map,GuiceExtensionAnnotation>> extensionAnnotations = new HashMap<>();
+ private Map, GuiceExtensionAnnotation>> extensionAnnotations = new HashMap<>();
public GuiceFinder() {
refreshExtensionAnnotations();
@@ -280,14 +281,14 @@ protected void configure() {
container = Guice.createInjector(modules);
sezpozIndex = extensions.getLoadedIndex();
} catch (Throwable e) {
- LOGGER.log(Level.SEVERE, "Failed to create Guice container from all the plugins",e);
+ LOGGER.log(Level.SEVERE, "Failed to create Guice container from all the plugins", e);
// failing to load all bindings are disastrous, so recover by creating minimum that works
// by just including the core
container = Guice.createInjector(new SezpozModule(loadSezpozIndices(Jenkins.class.getClassLoader())));
}
// expose Injector via lookup mechanism for interop with non-Guice clients
- Jenkins.get().lookup.set(Injector.class,new ProxyInjector() {
+ Jenkins.get().lookup.set(Injector.class, new ProxyInjector() {
@Override
protected Injector resolve() {
return getContainer();
@@ -298,12 +299,12 @@ protected Injector resolve() {
private void refreshExtensionAnnotations() {
for (ExtensionComponent ec : moduleFinder.find(GuiceExtensionAnnotation.class, Hudson.getInstance())) {
GuiceExtensionAnnotation gea = ec.getInstance();
- extensionAnnotations.put(gea.annotationType,gea);
+ extensionAnnotations.put(gea.annotationType, gea);
}
}
private List> loadSezpozIndices(ClassLoader classLoader) {
- List> indices = new ArrayList<>();
+ List> indices = new ArrayList<>();
for (GuiceExtensionAnnotation> gea : extensionAnnotations.values()) {
for (IndexItem, Object> indexItem : Index.load(gea.annotationType, Object.class, classLoader)) {
indices.add(indexItem);
@@ -330,7 +331,7 @@ public synchronized ExtensionComponentSet refresh() throws ExtensionRefreshExcep
// figure out newly discovered sezpoz components
List> delta = new ArrayList<>();
for (Class extends Annotation> annotationType : extensionAnnotations.keySet()) {
- delta.addAll(Sezpoz.listDelta(annotationType,sezpozIndex));
+ delta.addAll(Sezpoz.listDelta(annotationType, sezpozIndex));
}
SezpozModule deltaExtensions = new SezpozModule(delta);
@@ -357,19 +358,19 @@ public Collection> find(Class type) {
}
};
} catch (Throwable e) {
- LOGGER.log(Level.SEVERE, "Failed to create Guice container from newly added plugins",e);
+ LOGGER.log(Level.SEVERE, "Failed to create Guice container from newly added plugins", e);
throw new ExtensionRefreshException(e);
}
}
- private Object instantiate(IndexItem,Object> item) {
+ private Object instantiate(IndexItem, Object> item) {
try {
return item.instance();
} catch (LinkageError | Exception e) {
// sometimes the instantiation fails in an indirect classloading failure,
// which results in a LinkageError
LOGGER.log(isOptional(item.annotation()) ? Level.FINE : Level.WARNING,
- "Failed to load "+item.className(), e);
+ "Failed to load " + item.className(), e);
}
return null;
}
@@ -388,7 +389,7 @@ private boolean isActive(Annotation annotation, AnnotatedElement e) {
public Collection> find(Class type, Hudson jenkins) {
// the find method contract requires us to traverse all known components
List> result = new ArrayList<>();
- for (Injector i=container; i!=null; i=i.getParent()) {
+ for (Injector i = container; i != null; i = i.getParent()) {
_find(type, result, i);
}
return result;
@@ -399,8 +400,8 @@ private void _find(Class type, List> result, Inject
if (type.isAssignableFrom(e.getKey().getTypeLiteral().getRawType())) {
Annotation a = annotations.get(e.getKey());
Object o = e.getValue().getProvider().get();
- if (o!=null) {
- GuiceExtensionAnnotation gea = a!=null ? extensionAnnotations.get(a.annotationType()) : null;
+ if (o != null) {
+ GuiceExtensionAnnotation gea = a != null ? extensionAnnotations.get(a.annotationType()) : null;
result.add(new ExtensionComponent<>(type.cast(o), gea != null ? gea.getOrdinal(a) : 0));
}
}
@@ -425,15 +426,17 @@ public void scout(Class extensionType, Hudson hudson) {
*/
public static final Scope FAULT_TOLERANT_SCOPE = new FaultTolerantScope(true);
private static final Scope QUIET_FAULT_TOLERANT_SCOPE = new FaultTolerantScope(false);
-
+
private static final class FaultTolerantScope implements Scope {
private final boolean verbose;
+
FaultTolerantScope(boolean verbose) {
this.verbose = verbose;
}
+
@Override
public Provider scope(final Key key, final Provider unscoped) {
- final Provider base = Scopes.SINGLETON.scope(key,unscoped);
+ final Provider base = Scopes.SINGLETON.scope(key, unscoped);
return new Provider() {
@Override
public T get() {
@@ -444,6 +447,7 @@ public T get() {
return null;
}
}
+
void error(Key key, Throwable x) {
LOGGER.log(verbose ? Level.WARNING : Level.FINE, "Failed to instantiate " + key + "; skipping this component", x);
}
@@ -459,10 +463,10 @@ void error(Key key, Throwable x) {
* so that we can take advantage of dependency injection.
*/
private class SezpozModule extends AbstractModule implements ProvisionListener {
- private final List> index;
- private final List> loadedIndex;
+ private final List> index;
+ private final List> loadedIndex;
- SezpozModule(List> index) {
+ SezpozModule(List> index) {
this.index = index;
this.loadedIndex = new ArrayList<>();
}
@@ -482,6 +486,7 @@ private class SezpozModule extends AbstractModule implements ProvisionListener {
private void resolve(Class> c) {
resolve(c, new HashSet<>());
}
+
private void resolve(Class> c, Set> encountered) {
if (!encountered.add(c)) {
return;
@@ -503,7 +508,7 @@ private void resolve(Class> c, Set> encountered) {
}
LOGGER.log(Level.FINER, "{0} looks OK", c);
} catch (RuntimeException x) {
- throw new LinkageError("Failed to resolve "+c, x);
+ throw new LinkageError("Failed to resolve " + c, x);
}
}
@@ -513,26 +518,26 @@ protected void configure() {
bindListener(Matchers.any(), this);
- for (final IndexItem,Object> item : index) {
+ for (final IndexItem, Object> item : index) {
boolean optional = isOptional(item.annotation());
try {
AnnotatedElement e = item.element();
Annotation a = item.annotation();
- if (!isActive(a,e)) continue;
+ if (!isActive(a, e)) continue;
Scope scope = optional ? QUIET_FAULT_TOLERANT_SCOPE : FAULT_TOLERANT_SCOPE;
if (e instanceof Class) {
- Key key = Key.get((Class)e);
- resolve((Class)e);
- annotations.put(key,a);
+ Key key = Key.get((Class) e);
+ resolve((Class) e);
+ annotations.put(key, a);
bind(key).in(scope);
} else {
Class extType;
if (e instanceof Field) {
- extType = ((Field)e).getType();
+ extType = ((Field) e).getType();
} else
if (e instanceof Method) {
- extType = ((Method)e).getReturnType();
+ extType = ((Method) e).getReturnType();
} else {
throw new AssertionError();
}
@@ -541,15 +546,15 @@ protected void configure() {
// make unique key, because Guice wants that.
Key key = Key.get(extType, Names.named(item.className() + "." + item.memberName()));
- annotations.put(key,a);
+ annotations.put(key, a);
bind(key).toProvider(() -> instantiate(item)).in(scope);
}
loadedIndex.add(item);
- } catch (Exception|LinkageError e) {
+ } catch (Exception | LinkageError e) {
// sometimes the instantiation fails in an indirect classloading failure,
// which results in a LinkageError
LOGGER.log(optional ? Level.FINE : Level.WARNING,
- "Failed to load "+item.className(), e);
+ "Failed to load " + item.className(), e);
}
}
}
@@ -575,7 +580,7 @@ public void onProvision(ProvisionInvocation provision) {
Arrays.stream(c.getDeclaredMethods())
.map(m -> getMethodAndInterfaceDeclarations(m, interfaces))
.flatMap(Collection::stream)
- .filter(m -> m.getAnnotation(PostConstruct.class) != null)
+ .filter(m -> m.getAnnotation(PostConstruct.class) != null || m.getAnnotation(javax.annotation.PostConstruct.class) != null)
.findFirst()
.ifPresent(method -> methods.add(0, method));
c = c.getSuperclass();
@@ -623,7 +628,7 @@ Collection getMethodAndInterfaceDeclarations(Method method, Collection> indices;
+ private volatile List> indices;
/**
* Loads indices (ideally once but as few times as possible), then reuse them later.
@@ -631,14 +636,14 @@ public static final class Sezpoz extends ExtensionFinder {
* {@link InitMilestone#PLUGINS_PREPARED} is attained, so this method is guaranteed to
* see all the classes and indices.
*/
- private List> getIndices() {
+ private List> getIndices() {
// this method cannot be synchronized because of a dead lock possibility in the following order of events:
// 1. thread X can start listing indices, locking this object 'SZ'
// 2. thread Y starts loading a class, locking a classloader 'CL'
// 3. thread X needs to load a class, now blocked on CL
// 4. thread Y decides to load extensions, now blocked on SZ.
// 5. dead lock
- if (indices==null) {
+ if (indices == null) {
ClassLoader cl = Jenkins.get().getPluginManager().uberClassLoader;
indices = Collections.unmodifiableList(StreamSupport.stream(Index.load(Extension.class, Object.class, cl).spliterator(), false).collect(Collectors.toList()));
}
@@ -653,28 +658,28 @@ private List> getIndices() {
*/
@Override
public synchronized ExtensionComponentSet refresh() {
- final List> old = indices;
- if (old==null) return ExtensionComponentSet.EMPTY; // we haven't loaded anything
+ final List> old = indices;
+ if (old == null) return ExtensionComponentSet.EMPTY; // we haven't loaded anything
- final List> delta = listDelta(Extension.class,old);
+ final List> delta = listDelta(Extension.class, old);
- List> r = new ArrayList<>(old);
+ List> r = new ArrayList<>(old);
r.addAll(delta);
indices = Collections.unmodifiableList(r);
return new ExtensionComponentSet() {
@Override
public Collection> find(Class type) {
- return _find(type,delta);
+ return _find(type, delta);
}
};
}
- static List> listDelta(Class annotationType, List extends IndexItem,Object>> old) {
+ static List> listDelta(Class annotationType, List extends IndexItem, Object>> old) {
// list up newly discovered components
- final List> delta = new ArrayList<>();
+ final List> delta = new ArrayList<>();
ClassLoader cl = Jenkins.get().getPluginManager().uberClassLoader;
- for (IndexItem ii : Index.load(annotationType, Object.class, cl)) {
+ for (IndexItem ii : Index.load(annotationType, Object.class, cl)) {
if (!old.contains(ii)) {
delta.add(ii);
}
@@ -684,28 +689,28 @@ static List> listDelta(Class annot
@Override
public Collection> find(Class type, Hudson jenkins) {
- return _find(type,getIndices());
+ return _find(type, getIndices());
}
/**
* Finds all the matching {@link IndexItem}s that match the given type and instantiate them.
*/
- private Collection> _find(Class type, List> indices) {
+ private Collection> _find(Class type, List> indices) {
List> result = new ArrayList<>();
- for (IndexItem item : indices) {
+ for (IndexItem item : indices) {
try {
Class> extType = getClassFromIndex(item);
- if(type.isAssignableFrom(extType)) {
+ if (type.isAssignableFrom(extType)) {
Object instance = item.instance();
- if(instance!=null)
- result.add(new ExtensionComponent<>(type.cast(instance),item.annotation()));
+ if (instance != null)
+ result.add(new ExtensionComponent<>(type.cast(instance), item.annotation()));
}
- } catch (LinkageError|Exception e) {
+ } catch (LinkageError | Exception e) {
// sometimes the instantiation fails in an indirect classloading failure,
// which results in a LinkageError
- LOGGER.log(logLevel(item), "Failed to load "+item.className(), e);
+ LOGGER.log(logLevel(item), "Failed to load " + item.className(), e);
}
}
@@ -714,7 +719,7 @@ private Collection> _find(Class type, List item : getIndices()) {
+ for (IndexItem item : getIndices()) {
try {
// we might end up having multiple threads concurrently calling into element(),
// but we can't synchronize this --- if we do, the one thread that's supposed to load a class
@@ -722,9 +727,9 @@ public void scout(Class extensionType, Hudson hudson) {
// looking at the sezpoz code, it should be safe to do so
Class> extType = getClassFromIndex(item);
// according to JDK-4993813 this is the only way to force class initialization
- Class.forName(extType.getName(),true,extType.getClassLoader());
+ Class.forName(extType.getName(), true, extType.getClassLoader());
} catch (Exception | LinkageError e) {
- LOGGER.log(logLevel(item), "Failed to scout "+item.className(), e);
+ LOGGER.log(logLevel(item), "Failed to scout " + item.className(), e);
}
}
}
diff --git a/core/src/main/java/hudson/ExtensionList.java b/core/src/main/java/hudson/ExtensionList.java
index 89098e86ea280..7bae8ff5d83b1 100644
--- a/core/src/main/java/hudson/ExtensionList.java
+++ b/core/src/main/java/hudson/ExtensionList.java
@@ -21,6 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
package hudson;
import edu.umd.cs.findbugs.annotations.CheckForNull;
@@ -62,7 +63,7 @@
* and {@link jenkins.model.Jenkins#getDescriptorList(Class)} to obtain the instances.
*
* @param
- * Type of the extension point. This class holds instances of the subtypes of 'T'.
+ * Type of the extension point. This class holds instances of the subtypes of 'T'.
*
* @author Kohsuke Kawaguchi
* @since 1.286
@@ -99,11 +100,11 @@ public class ExtensionList extends AbstractList implements OnMaster {
*/
@Deprecated
protected ExtensionList(Hudson hudson, Class extensionType) {
- this((Jenkins)hudson,extensionType);
+ this((Jenkins) hudson, extensionType);
}
protected ExtensionList(Jenkins jenkins, Class extensionType) {
- this(jenkins,extensionType, new CopyOnWriteArrayList<>());
+ this(jenkins, extensionType, new CopyOnWriteArrayList<>());
}
/**
@@ -112,7 +113,7 @@ protected ExtensionList(Jenkins jenkins, Class extensionType) {
*/
@Deprecated
protected ExtensionList(Hudson hudson, Class extensionType, CopyOnWriteArrayList> legacyStore) {
- this((Jenkins)hudson,extensionType,legacyStore);
+ this((Jenkins) hudson, extensionType, legacyStore);
}
/**
@@ -120,10 +121,10 @@ protected ExtensionList(Hudson hudson, Class extensionType, CopyOnWriteArrayL
* @param legacyStore
* Place to store manually registered instances. The version of the constructor that
* omits this uses a new {@link Vector}, making the storage lifespan tied to the life of {@link ExtensionList}.
- * If the manually registered instances are scoped to VM level, the caller should pass in a static list.
+ * If the manually registered instances are scoped to VM level, the caller should pass in a static list.
*/
protected ExtensionList(Jenkins jenkins, Class extensionType, CopyOnWriteArrayList> legacyStore) {
- this.hudson = (Hudson)jenkins;
+ this.hudson = (Hudson) jenkins;
this.jenkins = jenkins;
this.extensionType = extensionType;
this.legacyInstances = legacyStore;
@@ -146,7 +147,7 @@ public void addListener(@NonNull ExtensionListListener listener) {
*/
public @CheckForNull U get(@NonNull Class type) {
for (T ext : this)
- if(ext.getClass()==type)
+ if (ext.getClass() == type)
return type.cast(ext);
return null;
}
@@ -154,21 +155,21 @@ public void addListener(@NonNull ExtensionListListener listener) {
/**
* Looks for the extension instance of the given type (subclasses excluded),
* or throws an IllegalStateException.
- *
+ *
* Meant to simplify call inside @Extension annotated class to retrieve their own instance.
*/
public @NonNull U getInstance(@NonNull Class type) throws IllegalStateException {
for (T ext : this)
- if(ext.getClass()==type)
+ if (ext.getClass() == type)
return type.cast(ext);
-
+
throw new IllegalStateException("The class " + type.getName() + " was not found, potentially not yet loaded");
}
@Override
public @NonNull Iterator iterator() {
- // we need to intercept mutation, so for now don't allow Iterator.remove
- return new AdaptedIterator,T>(Iterators.readOnly(ensureLoaded().iterator())) {
+ // we need to intercept mutation, so for now don't allow Iterator.remove
+ return new AdaptedIterator, T>(Iterators.readOnly(ensureLoaded().iterator())) {
@Override
protected T adapt(ExtensionComponent item) {
return item.getInstance();
@@ -187,7 +188,7 @@ public List> getComponents() {
public T get(int index) {
return ensureLoaded().get(index).getInstance();
}
-
+
@Override
public int size() {
return ensureLoaded().size();
@@ -200,7 +201,7 @@ public List reverseView() {
return new AbstractList() {
@Override
public T get(int index) {
- return ExtensionList.this.get(size()-index-1);
+ return ExtensionList.this.get(size() - index - 1);
}
@Override
@@ -215,7 +216,7 @@ public boolean remove(Object o) {
try {
return removeSync(o);
} finally {
- if(extensions!=null) {
+ if (extensions != null) {
fireOnChangeListeners();
}
}
@@ -238,9 +239,9 @@ public boolean removeAll(Collection> c) {
private synchronized boolean removeSync(Object o) {
boolean removed = removeComponent(legacyInstances, o);
- if(extensions!=null) {
+ if (extensions != null) {
List> r = new ArrayList<>(extensions);
- removed |= removeComponent(r,o);
+ removed |= removeComponent(r, o);
extensions = sort(r);
}
return removed;
@@ -274,7 +275,7 @@ public boolean add(T t) {
try {
return addSync(t);
} finally {
- if(extensions!=null) {
+ if (extensions != null) {
fireOnChangeListeners();
}
}
@@ -283,7 +284,7 @@ public boolean add(T t) {
private synchronized boolean addSync(T t) {
legacyInstances.add(new ExtensionComponent<>(t));
// if we've already filled extensions, add it
- if(extensions!=null) {
+ if (extensions != null) {
List> r = new ArrayList<>(extensions);
r.add(new ExtensionComponent<>(t));
extensions = sort(r);
@@ -309,13 +310,13 @@ public T getDynamic(String className) {
}
private List> ensureLoaded() {
- if(extensions!=null)
+ if (extensions != null)
return extensions; // already loaded
if (jenkins == null || jenkins.getInitLevel().compareTo(InitMilestone.PLUGINS_PREPARED) < 0)
return legacyInstances; // can't perform the auto discovery until all plugins are loaded, so just make the legacy instances visible
synchronized (getLoadLock()) {
- if(extensions==null) {
+ if (extensions == null) {
List> r = load();
r.addAll(legacyInstances);
extensions = sort(r);
@@ -328,7 +329,7 @@ private List> ensureLoaded() {
* Chooses the object that locks the loading of the extension instances.
*/
protected Object getLoadLock() {
- return Objects.requireNonNull(jenkins).lookup.setIfNull(Lock.class,new Lock());
+ return Objects.requireNonNull(jenkins).lookup.setIfNull(Lock.class, new Lock());
}
/**
@@ -338,7 +339,7 @@ protected Object getLoadLock() {
public void refresh(ExtensionComponentSet delta) {
boolean fireOnChangeListeners = false;
synchronized (getLoadLock()) {
- if (extensions==null)
+ if (extensions == null)
return; // not yet loaded. when we load it, we'll load everything visible by then, so no work needed
Collection> found = load(delta);
@@ -410,12 +411,12 @@ protected List> sort(List> r) {
*/
@Deprecated
public static ExtensionList create(Hudson hudson, Class type) {
- return create((Jenkins)hudson,type);
+ return create((Jenkins) hudson, type);
}
@SuppressWarnings({"unchecked", "rawtypes"})
public static ExtensionList