id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
125,500 | jenkinsci/jenkins | core/src/main/java/hudson/model/AbstractProject.java | AbstractProject.doDoWipeOutWorkspace | @RequirePOST
public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException {
checkPermission(Functions.isWipeOutPermissionEnabled() ? WIPEOUT : BUILD);
R b = getSomeBuildWithWorkspace();
FilePath ws = b!=null ? b.getWorkspace() : null;
if (ws!=... | java | @RequirePOST
public HttpResponse doDoWipeOutWorkspace() throws IOException, ServletException, InterruptedException {
checkPermission(Functions.isWipeOutPermissionEnabled() ? WIPEOUT : BUILD);
R b = getSomeBuildWithWorkspace();
FilePath ws = b!=null ? b.getWorkspace() : null;
if (ws!=... | [
"@",
"RequirePOST",
"public",
"HttpResponse",
"doDoWipeOutWorkspace",
"(",
")",
"throws",
"IOException",
",",
"ServletException",
",",
"InterruptedException",
"{",
"checkPermission",
"(",
"Functions",
".",
"isWipeOutPermissionEnabled",
"(",
")",
"?",
"WIPEOUT",
":",
"... | Wipes out the workspace. | [
"Wipes",
"out",
"the",
"workspace",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractProject.java#L1860-L1875 |
125,501 | jenkinsci/jenkins | core/src/main/java/hudson/model/labels/LabelExpression.java | LabelExpression.paren | static String paren(LabelOperatorPrecedence op, Label l) {
if (op.compareTo(l.precedence())<0)
return '('+l.getExpression()+')';
return l.getExpression();
} | java | static String paren(LabelOperatorPrecedence op, Label l) {
if (op.compareTo(l.precedence())<0)
return '('+l.getExpression()+')';
return l.getExpression();
} | [
"static",
"String",
"paren",
"(",
"LabelOperatorPrecedence",
"op",
",",
"Label",
"l",
")",
"{",
"if",
"(",
"op",
".",
"compareTo",
"(",
"l",
".",
"precedence",
"(",
")",
")",
"<",
"0",
")",
"return",
"'",
"'",
"+",
"l",
".",
"getExpression",
"(",
"... | Puts the label name into a parenthesis if the given operator will have a higher precedence. | [
"Puts",
"the",
"label",
"name",
"into",
"a",
"parenthesis",
"if",
"the",
"given",
"operator",
"will",
"have",
"a",
"higher",
"precedence",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/labels/LabelExpression.java#L99-L103 |
125,502 | jenkinsci/jenkins | core/src/main/java/hudson/util/Iterators.java | Iterators.sequence | public static List<Integer> sequence(final int start, int end, final int step) {
final int size = (end-start)/step;
if(size<0) throw new IllegalArgumentException("List size is negative");
return new AbstractList<Integer>() {
public Integer get(int index) {
if(index... | java | public static List<Integer> sequence(final int start, int end, final int step) {
final int size = (end-start)/step;
if(size<0) throw new IllegalArgumentException("List size is negative");
return new AbstractList<Integer>() {
public Integer get(int index) {
if(index... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"sequence",
"(",
"final",
"int",
"start",
",",
"int",
"end",
",",
"final",
"int",
"step",
")",
"{",
"final",
"int",
"size",
"=",
"(",
"end",
"-",
"start",
")",
"/",
"step",
";",
"if",
"(",
"size",
... | Returns a list that represents [start,end).
For example sequence(1,5,1)={1,2,3,4}, and sequence(7,1,-2)={7.5,3}
@since 1.150 | [
"Returns",
"a",
"list",
"that",
"represents",
"[",
"start",
"end",
")",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/Iterators.java#L226-L242 |
125,503 | jenkinsci/jenkins | core/src/main/java/hudson/util/Iterators.java | Iterators.removeNull | public static <T> Iterator<T> removeNull(final Iterator<T> itr) {
return com.google.common.collect.Iterators.filter(itr, Predicates.notNull());
} | java | public static <T> Iterator<T> removeNull(final Iterator<T> itr) {
return com.google.common.collect.Iterators.filter(itr, Predicates.notNull());
} | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"removeNull",
"(",
"final",
"Iterator",
"<",
"T",
">",
"itr",
")",
"{",
"return",
"com",
".",
"google",
".",
"common",
".",
"collect",
".",
"Iterators",
".",
"filter",
"(",
"itr",
",",
"... | Wraps another iterator and throws away nulls. | [
"Wraps",
"another",
"iterator",
"and",
"throws",
"away",
"nulls",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/Iterators.java#L311-L313 |
125,504 | jenkinsci/jenkins | core/src/main/java/hudson/util/Iterators.java | Iterators.limit | public static <T> Iterator<T> limit(final Iterator<? extends T> base, final CountingPredicate<? super T> filter) {
return new Iterator<T>() {
private T next;
private boolean end;
private int index=0;
public boolean hasNext() {
fetch();
... | java | public static <T> Iterator<T> limit(final Iterator<? extends T> base, final CountingPredicate<? super T> filter) {
return new Iterator<T>() {
private T next;
private boolean end;
private int index=0;
public boolean hasNext() {
fetch();
... | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"limit",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"base",
",",
"final",
"CountingPredicate",
"<",
"?",
"super",
"T",
">",
"filter",
")",
"{",
"return",
"new",
"Iterator",
"... | Returns the elements in the base iterator until it hits any element that doesn't satisfy the filter.
Then the rest of the elements in the base iterator gets ignored.
@since 1.485 | [
"Returns",
"the",
"elements",
"in",
"the",
"base",
"iterator",
"until",
"it",
"hits",
"any",
"element",
"that",
"doesn",
"t",
"satisfy",
"the",
"filter",
".",
"Then",
"the",
"rest",
"of",
"the",
"elements",
"in",
"the",
"base",
"iterator",
"gets",
"ignored... | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/Iterators.java#L369-L404 |
125,505 | jenkinsci/jenkins | core/src/main/java/hudson/init/InitStrategy.java | InitStrategy.get | public static InitStrategy get(ClassLoader cl) throws IOException {
Iterator<InitStrategy> it = ServiceLoader.load(InitStrategy.class, cl).iterator();
if (!it.hasNext()) {
return new InitStrategy(); // default
}
InitStrategy s = it.next();
LOGGER.log(Level.FINE, "Usin... | java | public static InitStrategy get(ClassLoader cl) throws IOException {
Iterator<InitStrategy> it = ServiceLoader.load(InitStrategy.class, cl).iterator();
if (!it.hasNext()) {
return new InitStrategy(); // default
}
InitStrategy s = it.next();
LOGGER.log(Level.FINE, "Usin... | [
"public",
"static",
"InitStrategy",
"get",
"(",
"ClassLoader",
"cl",
")",
"throws",
"IOException",
"{",
"Iterator",
"<",
"InitStrategy",
">",
"it",
"=",
"ServiceLoader",
".",
"load",
"(",
"InitStrategy",
".",
"class",
",",
"cl",
")",
".",
"iterator",
"(",
... | Obtains the instance to be used. | [
"Obtains",
"the",
"instance",
"to",
"be",
"used",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/init/InitStrategy.java#L116-L124 |
125,506 | jenkinsci/jenkins | core/src/main/java/hudson/EnvVars.java | EnvVars.override | public void override(String key, String value) {
if(value==null || value.length()==0) {
remove(key);
return;
}
int idx = key.indexOf('+');
if(idx>0) {
String realKey = key.substring(0,idx);
String v = get(realKey);
if(v==null) ... | java | public void override(String key, String value) {
if(value==null || value.length()==0) {
remove(key);
return;
}
int idx = key.indexOf('+');
if(idx>0) {
String realKey = key.substring(0,idx);
String v = get(realKey);
if(v==null) ... | [
"public",
"void",
"override",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"remove",
"(",
"key",
")",
";",
"return",
";",
"}",
"int",
"idx",... | Overrides the current entry by the given entry.
<p>
Handles {@code PATH+XYZ} notation. | [
"Overrides",
"the",
"current",
"entry",
"by",
"the",
"given",
"entry",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L145-L168 |
125,507 | jenkinsci/jenkins | core/src/main/java/hudson/EnvVars.java | EnvVars.resolve | public static void resolve(Map<String, String> env) {
for (Map.Entry<String,String> entry: env.entrySet()) {
entry.setValue(Util.replaceMacro(entry.getValue(), env));
}
} | java | public static void resolve(Map<String, String> env) {
for (Map.Entry<String,String> entry: env.entrySet()) {
entry.setValue(Util.replaceMacro(entry.getValue(), env));
}
} | [
"public",
"static",
"void",
"resolve",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"env",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"env",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"se... | Resolves environment variables against each other. | [
"Resolves",
"environment",
"variables",
"against",
"each",
"other",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L360-L364 |
125,508 | jenkinsci/jenkins | core/src/main/java/hudson/EnvVars.java | EnvVars.addLine | public void addLine(String line) {
int sep = line.indexOf('=');
if(sep > 0) {
put(line.substring(0,sep),line.substring(sep+1));
}
} | java | public void addLine(String line) {
int sep = line.indexOf('=');
if(sep > 0) {
put(line.substring(0,sep),line.substring(sep+1));
}
} | [
"public",
"void",
"addLine",
"(",
"String",
"line",
")",
"{",
"int",
"sep",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"sep",
">",
"0",
")",
"{",
"put",
"(",
"line",
".",
"substring",
"(",
"0",
",",
"sep",
")",
",",
"lin... | Takes a string that looks like "a=b" and adds that to this map. | [
"Takes",
"a",
"string",
"that",
"looks",
"like",
"a",
"=",
"b",
"and",
"adds",
"that",
"to",
"this",
"map",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L394-L399 |
125,509 | jenkinsci/jenkins | core/src/main/java/hudson/EnvVars.java | EnvVars.getRemote | public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException {
if(channel==null)
return new EnvVars("N/A","N/A");
return channel.call(new GetEnvVars());
} | java | public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException {
if(channel==null)
return new EnvVars("N/A","N/A");
return channel.call(new GetEnvVars());
} | [
"public",
"static",
"EnvVars",
"getRemote",
"(",
"VirtualChannel",
"channel",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"return",
"new",
"EnvVars",
"(",
"\"N/A\"",
",",
"\"N/A\"",
")",
";",
"return... | Obtains the environment variables of a remote peer.
@param channel
Can be null, in which case the map indicating "N/A" will be returned.
@return
A fresh copy that can be owned and modified by the caller. | [
"Obtains",
"the",
"environment",
"variables",
"of",
"a",
"remote",
"peer",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L424-L428 |
125,510 | jenkinsci/jenkins | core/src/main/java/hudson/security/AuthorizationStrategy.java | AuthorizationStrategy.getACL | public @Nonnull ACL getACL(final @Nonnull View item) {
return ACL.lambda((a, permission) -> {
ACL base = item.getOwner().getACL();
boolean hasPermission = base.hasPermission(a, permission);
if (!hasPermission && permission == View.READ) {
retu... | java | public @Nonnull ACL getACL(final @Nonnull View item) {
return ACL.lambda((a, permission) -> {
ACL base = item.getOwner().getACL();
boolean hasPermission = base.hasPermission(a, permission);
if (!hasPermission && permission == View.READ) {
retu... | [
"public",
"@",
"Nonnull",
"ACL",
"getACL",
"(",
"final",
"@",
"Nonnull",
"View",
"item",
")",
"{",
"return",
"ACL",
".",
"lambda",
"(",
"(",
"a",
",",
"permission",
")",
"->",
"{",
"ACL",
"base",
"=",
"item",
".",
"getOwner",
"(",
")",
".",
"getACL... | Implementation can choose to provide different ACL for different views.
This can be used as a basis for more fine-grained access control.
<p>
The default implementation makes the view visible if any of the items are visible
or the view is configurable.
@since 1.220 | [
"Implementation",
"can",
"choose",
"to",
"provide",
"different",
"ACL",
"for",
"different",
"views",
".",
"This",
"can",
"be",
"used",
"as",
"a",
"basis",
"for",
"more",
"fine",
"-",
"grained",
"access",
"control",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/AuthorizationStrategy.java#L98-L109 |
125,511 | jenkinsci/jenkins | core/src/main/java/hudson/slaves/AbstractCloudComputer.java | AbstractCloudComputer.doDoDelete | @Override
@RequirePOST
public HttpResponse doDoDelete() throws IOException {
checkPermission(DELETE);
try {
T node = getNode();
if (node != null) { // No need to terminate nodes again
node.terminate();
}
return new HttpRedirect(".."... | java | @Override
@RequirePOST
public HttpResponse doDoDelete() throws IOException {
checkPermission(DELETE);
try {
T node = getNode();
if (node != null) { // No need to terminate nodes again
node.terminate();
}
return new HttpRedirect(".."... | [
"@",
"Override",
"@",
"RequirePOST",
"public",
"HttpResponse",
"doDoDelete",
"(",
")",
"throws",
"IOException",
"{",
"checkPermission",
"(",
"DELETE",
")",
";",
"try",
"{",
"T",
"node",
"=",
"getNode",
"(",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",... | When the agent is deleted, free the node right away. | [
"When",
"the",
"agent",
"is",
"deleted",
"free",
"the",
"node",
"right",
"away",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/AbstractCloudComputer.java#L56-L69 |
125,512 | jenkinsci/jenkins | core/src/main/java/hudson/util/CopyOnWriteList.java | CopyOnWriteList.remove | public synchronized boolean remove(E e) {
List<E> n = new ArrayList<>(core);
boolean r = n.remove(e);
core = n;
return r;
} | java | public synchronized boolean remove(E e) {
List<E> n = new ArrayList<>(core);
boolean r = n.remove(e);
core = n;
return r;
} | [
"public",
"synchronized",
"boolean",
"remove",
"(",
"E",
"e",
")",
"{",
"List",
"<",
"E",
">",
"n",
"=",
"new",
"ArrayList",
"<>",
"(",
"core",
")",
";",
"boolean",
"r",
"=",
"n",
".",
"remove",
"(",
"e",
")",
";",
"core",
"=",
"n",
";",
"retur... | Removes an item from the list.
@return
true if the list contained the item. False if it didn't,
in which case there's no change. | [
"Removes",
"an",
"item",
"from",
"the",
"list",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/CopyOnWriteList.java#L88-L93 |
125,513 | jenkinsci/jenkins | core/src/main/java/hudson/util/CopyOnWriteList.java | CopyOnWriteList.iterator | public Iterator<E> iterator() {
final Iterator<? extends E> itr = core.iterator();
return new Iterator<E>() {
private E last;
public boolean hasNext() {
return itr.hasNext();
}
public E next() {
return last=itr.next();
... | java | public Iterator<E> iterator() {
final Iterator<? extends E> itr = core.iterator();
return new Iterator<E>() {
private E last;
public boolean hasNext() {
return itr.hasNext();
}
public E next() {
return last=itr.next();
... | [
"public",
"Iterator",
"<",
"E",
">",
"iterator",
"(",
")",
"{",
"final",
"Iterator",
"<",
"?",
"extends",
"E",
">",
"itr",
"=",
"core",
".",
"iterator",
"(",
")",
";",
"return",
"new",
"Iterator",
"<",
"E",
">",
"(",
")",
"{",
"private",
"E",
"la... | Returns an iterator. | [
"Returns",
"an",
"iterator",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/CopyOnWriteList.java#L98-L114 |
125,514 | jenkinsci/jenkins | core/src/main/java/hudson/triggers/SafeTimerTask.java | SafeTimerTask.getLogsRoot | public static File getLogsRoot() {
String tagsLogsPath = SystemProperties.getString(LOGS_ROOT_PATH_PROPERTY);
if (tagsLogsPath == null) {
return new File(Jenkins.get().getRootDir(), "logs");
} else {
Level logLevel = Level.INFO;
if (ALREADY_LOGGED) {
... | java | public static File getLogsRoot() {
String tagsLogsPath = SystemProperties.getString(LOGS_ROOT_PATH_PROPERTY);
if (tagsLogsPath == null) {
return new File(Jenkins.get().getRootDir(), "logs");
} else {
Level logLevel = Level.INFO;
if (ALREADY_LOGGED) {
... | [
"public",
"static",
"File",
"getLogsRoot",
"(",
")",
"{",
"String",
"tagsLogsPath",
"=",
"SystemProperties",
".",
"getString",
"(",
"LOGS_ROOT_PATH_PROPERTY",
")",
";",
"if",
"(",
"tagsLogsPath",
"==",
"null",
")",
"{",
"return",
"new",
"File",
"(",
"Jenkins",... | The root path that should be used to put logs related to the tasks running in Jenkins.
@see AsyncAperiodicWork#getLogFile()
@see AsyncPeriodicWork#getLogFile()
@return the path where the logs should be put.
@since 2.114 | [
"The",
"root",
"path",
"that",
"should",
"be",
"used",
"to",
"put",
"logs",
"related",
"to",
"the",
"tasks",
"running",
"in",
"Jenkins",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/triggers/SafeTimerTask.java#L91-L106 |
125,515 | jenkinsci/jenkins | core/src/main/java/hudson/tasks/LogRotator.java | LogRotator.copy | private <R> Collection<R> copy(Iterable<R> src) {
return Lists.newArrayList(src);
} | java | private <R> Collection<R> copy(Iterable<R> src) {
return Lists.newArrayList(src);
} | [
"private",
"<",
"R",
">",
"Collection",
"<",
"R",
">",
"copy",
"(",
"Iterable",
"<",
"R",
">",
"src",
")",
"{",
"return",
"Lists",
".",
"newArrayList",
"(",
"src",
")",
";",
"}"
] | Creates a copy since we'll be deleting some entries from them. | [
"Creates",
"a",
"copy",
"since",
"we",
"ll",
"be",
"deleting",
"some",
"entries",
"from",
"them",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/LogRotator.java#L211-L213 |
125,516 | jenkinsci/jenkins | core/src/main/java/hudson/org/apache/tools/tar/TarOutputStream.java | TarOutputStream.closeEntry | public void closeEntry() throws IOException {
if (this.assemLen > 0) {
for (int i = this.assemLen; i < this.assemBuf.length; ++i) {
this.assemBuf[i] = 0;
}
this.buffer.writeRecord(this.assemBuf);
this.currBytes += this.assemLen;
this.... | java | public void closeEntry() throws IOException {
if (this.assemLen > 0) {
for (int i = this.assemLen; i < this.assemBuf.length; ++i) {
this.assemBuf[i] = 0;
}
this.buffer.writeRecord(this.assemBuf);
this.currBytes += this.assemLen;
this.... | [
"public",
"void",
"closeEntry",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"assemLen",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"assemLen",
";",
"i",
"<",
"this",
".",
"assemBuf",
".",
"length",
";",
"++",
... | Close an entry. This method MUST be called for all file
entries that contain data. The reason is that we must
buffer data written to the stream in order to satisfy
the buffer's record based writes. Thus, there may be
data fragments still being assembled that must be written
to the output stream before this entry is clo... | [
"Close",
"an",
"entry",
".",
"This",
"method",
"MUST",
"be",
"called",
"for",
"all",
"file",
"entries",
"that",
"contain",
"data",
".",
"The",
"reason",
"is",
"that",
"we",
"must",
"buffer",
"data",
"written",
"to",
"the",
"stream",
"in",
"order",
"to",
... | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/org/apache/tools/tar/TarOutputStream.java#L226-L244 |
125,517 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.setFullName | public void setFullName(String name) {
if (Util.fixEmptyAndTrim(name) == null) name = id;
this.fullName = name;
} | java | public void setFullName(String name) {
if (Util.fixEmptyAndTrim(name) == null) name = id;
this.fullName = name;
} | [
"public",
"void",
"setFullName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"Util",
".",
"fixEmptyAndTrim",
"(",
"name",
")",
"==",
"null",
")",
"name",
"=",
"id",
";",
"this",
".",
"fullName",
"=",
"name",
";",
"}"
] | Sets the human readable name of the user.
If the input parameter is empty, the user's ID will be set. | [
"Sets",
"the",
"human",
"readable",
"name",
"of",
"the",
"user",
".",
"If",
"the",
"input",
"parameter",
"is",
"empty",
"the",
"user",
"s",
"ID",
"will",
"be",
"set",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L298-L301 |
125,518 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.getProperty | public <T extends UserProperty> T getProperty(Class<T> clazz) {
for (UserProperty p : properties) {
if (clazz.isInstance(p))
return clazz.cast(p);
}
return null;
} | java | public <T extends UserProperty> T getProperty(Class<T> clazz) {
for (UserProperty p : properties) {
if (clazz.isInstance(p))
return clazz.cast(p);
}
return null;
} | [
"public",
"<",
"T",
"extends",
"UserProperty",
">",
"T",
"getProperty",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"for",
"(",
"UserProperty",
"p",
":",
"properties",
")",
"{",
"if",
"(",
"clazz",
".",
"isInstance",
"(",
"p",
")",
")",
"return",... | Gets the specific property, or null. | [
"Gets",
"the",
"specific",
"property",
"or",
"null",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L354-L360 |
125,519 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.getAll | public static @Nonnull
Collection<User> getAll() {
final IdStrategy strategy = idStrategy();
ArrayList<User> users = new ArrayList<>(AllUsers.values());
users.sort((o1, o2) -> strategy.compare(o1.getId(), o2.getId()));
return users;
} | java | public static @Nonnull
Collection<User> getAll() {
final IdStrategy strategy = idStrategy();
ArrayList<User> users = new ArrayList<>(AllUsers.values());
users.sort((o1, o2) -> strategy.compare(o1.getId(), o2.getId()));
return users;
} | [
"public",
"static",
"@",
"Nonnull",
"Collection",
"<",
"User",
">",
"getAll",
"(",
")",
"{",
"final",
"IdStrategy",
"strategy",
"=",
"idStrategy",
"(",
")",
";",
"ArrayList",
"<",
"User",
">",
"users",
"=",
"new",
"ArrayList",
"<>",
"(",
"AllUsers",
".",... | Gets all the users. | [
"Gets",
"all",
"the",
"users",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L621-L627 |
125,520 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.clear | @Deprecated
public static void clear() {
if (ExtensionList.lookup(AllUsers.class).isEmpty()) {
return;
}
UserIdMapper.getInstance().clear();
AllUsers.clear();
} | java | @Deprecated
public static void clear() {
if (ExtensionList.lookup(AllUsers.class).isEmpty()) {
return;
}
UserIdMapper.getInstance().clear();
AllUsers.clear();
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"ExtensionList",
".",
"lookup",
"(",
"AllUsers",
".",
"class",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"UserIdMapper",
".",
"getInstance",
"(",
")",
... | Called by tests in the JTH. Otherwise this shouldn't be called.
Even in the tests this usage is questionable. | [
"Called",
"by",
"tests",
"in",
"the",
"JTH",
".",
"Otherwise",
"this",
"shouldn",
"t",
"be",
"called",
".",
"Even",
"in",
"the",
"tests",
"this",
"usage",
"is",
"questionable",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L718-L725 |
125,521 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.save | public synchronized void save() throws IOException {
if (!isIdOrFullnameAllowed(id)) {
throw FormValidation.error(Messages.User_IllegalUsername(id));
}
if (!isIdOrFullnameAllowed(fullName)) {
throw FormValidation.error(Messages.User_IllegalFullname(fullName));
}
... | java | public synchronized void save() throws IOException {
if (!isIdOrFullnameAllowed(id)) {
throw FormValidation.error(Messages.User_IllegalUsername(id));
}
if (!isIdOrFullnameAllowed(fullName)) {
throw FormValidation.error(Messages.User_IllegalFullname(fullName));
}
... | [
"public",
"synchronized",
"void",
"save",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isIdOrFullnameAllowed",
"(",
"id",
")",
")",
"{",
"throw",
"FormValidation",
".",
"error",
"(",
"Messages",
".",
"User_IllegalUsername",
"(",
"id",
")",
")",
... | Save the user configuration. | [
"Save",
"the",
"user",
"configuration",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L786-L799 |
125,522 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.delete | public void delete() throws IOException {
String idKey = idStrategy().keyFor(id);
File existingUserFolder = getExistingUserFolder();
UserIdMapper.getInstance().remove(id);
AllUsers.remove(id);
deleteExistingUserFolder(existingUserFolder);
UserDetailsCache.get().invalidate... | java | public void delete() throws IOException {
String idKey = idStrategy().keyFor(id);
File existingUserFolder = getExistingUserFolder();
UserIdMapper.getInstance().remove(id);
AllUsers.remove(id);
deleteExistingUserFolder(existingUserFolder);
UserDetailsCache.get().invalidate... | [
"public",
"void",
"delete",
"(",
")",
"throws",
"IOException",
"{",
"String",
"idKey",
"=",
"idStrategy",
"(",
")",
".",
"keyFor",
"(",
"id",
")",
";",
"File",
"existingUserFolder",
"=",
"getExistingUserFolder",
"(",
")",
";",
"UserIdMapper",
".",
"getInstan... | Deletes the data directory and removes this user from Hudson.
@throws IOException if we fail to delete. | [
"Deletes",
"the",
"data",
"directory",
"and",
"removes",
"this",
"user",
"from",
"Hudson",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L814-L821 |
125,523 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.doDoDelete | @RequirePOST
public void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException {
checkPermission(Jenkins.ADMINISTER);
if (idStrategy().equals(id, Jenkins.getAuthentication().getName())) {
rsp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cannot delete self");
... | java | @RequirePOST
public void doDoDelete(StaplerRequest req, StaplerResponse rsp) throws IOException {
checkPermission(Jenkins.ADMINISTER);
if (idStrategy().equals(id, Jenkins.getAuthentication().getName())) {
rsp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cannot delete self");
... | [
"@",
"RequirePOST",
"public",
"void",
"doDoDelete",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
"{",
"checkPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
";",
"if",
"(",
"idStrategy",
"(",
")",
".",
"equals"... | Deletes this user from Hudson. | [
"Deletes",
"this",
"user",
"from",
"Hudson",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L880-L891 |
125,524 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.canDelete | public boolean canDelete() {
final IdStrategy strategy = idStrategy();
return hasPermission(Jenkins.ADMINISTER) && !strategy.equals(id, Jenkins.getAuthentication().getName())
&& UserIdMapper.getInstance().isMapped(id);
} | java | public boolean canDelete() {
final IdStrategy strategy = idStrategy();
return hasPermission(Jenkins.ADMINISTER) && !strategy.equals(id, Jenkins.getAuthentication().getName())
&& UserIdMapper.getInstance().isMapped(id);
} | [
"public",
"boolean",
"canDelete",
"(",
")",
"{",
"final",
"IdStrategy",
"strategy",
"=",
"idStrategy",
"(",
")",
";",
"return",
"hasPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
"&&",
"!",
"strategy",
".",
"equals",
"(",
"id",
",",
"Jenkins",
".",
... | With ADMINISTER permission, can delete users with persisted data but can't delete self. | [
"With",
"ADMINISTER",
"permission",
"can",
"delete",
"users",
"with",
"persisted",
"data",
"but",
"can",
"t",
"delete",
"self",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L934-L938 |
125,525 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.getPropertyActions | public List<Action> getPropertyActions() {
List<Action> actions = new ArrayList<>();
for (UserProperty userProp : getProperties().values()) {
if (userProp instanceof Action) {
actions.add((Action) userProp);
}
}
return Collections.unmodifiableList(... | java | public List<Action> getPropertyActions() {
List<Action> actions = new ArrayList<>();
for (UserProperty userProp : getProperties().values()) {
if (userProp instanceof Action) {
actions.add((Action) userProp);
}
}
return Collections.unmodifiableList(... | [
"public",
"List",
"<",
"Action",
">",
"getPropertyActions",
"(",
")",
"{",
"List",
"<",
"Action",
">",
"actions",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"UserProperty",
"userProp",
":",
"getProperties",
"(",
")",
".",
"values",
"(",
... | Return all properties that are also actions.
@return the list can be empty but never null. read only. | [
"Return",
"all",
"properties",
"that",
"are",
"also",
"actions",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L991-L999 |
125,526 | jenkinsci/jenkins | core/src/main/java/hudson/model/User.java | User.getTransientActions | public List<Action> getTransientActions() {
List<Action> actions = new ArrayList<>();
for (TransientUserActionFactory factory : TransientUserActionFactory.all()) {
actions.addAll(factory.createFor(this));
}
return Collections.unmodifiableList(actions);
} | java | public List<Action> getTransientActions() {
List<Action> actions = new ArrayList<>();
for (TransientUserActionFactory factory : TransientUserActionFactory.all()) {
actions.addAll(factory.createFor(this));
}
return Collections.unmodifiableList(actions);
} | [
"public",
"List",
"<",
"Action",
">",
"getTransientActions",
"(",
")",
"{",
"List",
"<",
"Action",
">",
"actions",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"TransientUserActionFactory",
"factory",
":",
"TransientUserActionFactory",
".",
"all",... | Return all transient actions associated with this user.
@return the list can be empty but never null. read only. | [
"Return",
"all",
"transient",
"actions",
"associated",
"with",
"this",
"user",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L1006-L1012 |
125,527 | jenkinsci/jenkins | core/src/main/java/hudson/model/Resource.java | Resource.isCollidingWith | public boolean isCollidingWith(Resource that, int count) {
assert that!=null;
for(Resource r=that; r!=null; r=r.parent)
if(this.equals(r) && r.numConcurrentWrite<count)
return true;
for(Resource r=this; r!=null; r=r.parent)
if(that.equals(r) && r.numConcur... | java | public boolean isCollidingWith(Resource that, int count) {
assert that!=null;
for(Resource r=that; r!=null; r=r.parent)
if(this.equals(r) && r.numConcurrentWrite<count)
return true;
for(Resource r=this; r!=null; r=r.parent)
if(that.equals(r) && r.numConcur... | [
"public",
"boolean",
"isCollidingWith",
"(",
"Resource",
"that",
",",
"int",
"count",
")",
"{",
"assert",
"that",
"!=",
"null",
";",
"for",
"(",
"Resource",
"r",
"=",
"that",
";",
"r",
"!=",
"null",
";",
"r",
"=",
"r",
".",
"parent",
")",
"if",
"("... | Checks the resource collision.
@param count
If we are testing W/W conflict, total # of write counts.
For R/W conflict test, this value should be set to {@link Integer#MAX_VALUE}. | [
"Checks",
"the",
"resource",
"collision",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Resource.java#L92-L101 |
125,528 | jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java | WindowsInstallerLink.doDoInstall | @RequirePOST
public void doDoInstall(StaplerRequest req, StaplerResponse rsp, @QueryParameter("dir") String _dir) throws IOException, ServletException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
if(installationDir!=null) {
// installation already complete
se... | java | @RequirePOST
public void doDoInstall(StaplerRequest req, StaplerResponse rsp, @QueryParameter("dir") String _dir) throws IOException, ServletException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
if(installationDir!=null) {
// installation already complete
se... | [
"@",
"RequirePOST",
"public",
"void",
"doDoInstall",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"@",
"QueryParameter",
"(",
"\"dir\"",
")",
"String",
"_dir",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"Jenkins",
".",
"getI... | Performs installation. | [
"Performs",
"installation",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java#L112-L159 |
125,529 | jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java | WindowsInstallerLink.copy | private void copy(StaplerRequest req, StaplerResponse rsp, File dir, URL src, String name) throws ServletException, IOException {
try {
FileUtils.copyURLToFile(src,new File(dir, name));
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to copy "+name,e);
send... | java | private void copy(StaplerRequest req, StaplerResponse rsp, File dir, URL src, String name) throws ServletException, IOException {
try {
FileUtils.copyURLToFile(src,new File(dir, name));
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to copy "+name,e);
send... | [
"private",
"void",
"copy",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"File",
"dir",
",",
"URL",
"src",
",",
"String",
"name",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"try",
"{",
"FileUtils",
".",
"copyURLToFile",
"... | Copies a single resource into the target folder, by the given name, and handle errors gracefully. | [
"Copies",
"a",
"single",
"resource",
"into",
"the",
"target",
"folder",
"by",
"the",
"given",
"name",
"and",
"handle",
"errors",
"gracefully",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java#L164-L172 |
125,530 | jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java | WindowsInstallerLink.sendError | protected final void sendError(Exception e, StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
sendError(e.getMessage(),req,rsp);
} | java | protected final void sendError(Exception e, StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
sendError(e.getMessage(),req,rsp);
} | [
"protected",
"final",
"void",
"sendError",
"(",
"Exception",
"e",
",",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"sendError",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"req",
",",
"r... | Displays the error in a page. | [
"Displays",
"the",
"error",
"in",
"a",
"page",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java#L243-L245 |
125,531 | jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java | WindowsInstallerLink.runElevated | static int runElevated(File jenkinsExe, String command, TaskListener out, File pwd) throws IOException, InterruptedException {
try {
return new LocalLauncher(out).launch().cmds(jenkinsExe, command).stdout(out).pwd(pwd).join();
} catch (IOException e) {
if (e.getMessage().contains... | java | static int runElevated(File jenkinsExe, String command, TaskListener out, File pwd) throws IOException, InterruptedException {
try {
return new LocalLauncher(out).launch().cmds(jenkinsExe, command).stdout(out).pwd(pwd).join();
} catch (IOException e) {
if (e.getMessage().contains... | [
"static",
"int",
"runElevated",
"(",
"File",
"jenkinsExe",
",",
"String",
"command",
",",
"TaskListener",
"out",
",",
"File",
"pwd",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"try",
"{",
"return",
"new",
"LocalLauncher",
"(",
"out",
")",
... | Invokes jenkins.exe with a SCM management command.
<p>
If it fails in a way that indicates the presence of UAC, retry in an UAC compatible manner. | [
"Invokes",
"jenkins",
".",
"exe",
"with",
"a",
"SCM",
"management",
"command",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java#L286-L318 |
125,532 | jenkinsci/jenkins | core/src/main/java/jenkins/security/apitoken/ApiTokenStats.java | ApiTokenStats.keepLastUpdatedUnique | private void keepLastUpdatedUnique() {
Map<String, SingleTokenStats> temp = new HashMap<>();
this.tokenStats.forEach(candidate -> {
SingleTokenStats current = temp.get(candidate.tokenUuid);
if (current == null) {
temp.put(candidate.tokenUuid, candidate);
... | java | private void keepLastUpdatedUnique() {
Map<String, SingleTokenStats> temp = new HashMap<>();
this.tokenStats.forEach(candidate -> {
SingleTokenStats current = temp.get(candidate.tokenUuid);
if (current == null) {
temp.put(candidate.tokenUuid, candidate);
... | [
"private",
"void",
"keepLastUpdatedUnique",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"SingleTokenStats",
">",
"temp",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"this",
".",
"tokenStats",
".",
"forEach",
"(",
"candidate",
"->",
"{",
"SingleTokenStats",
"... | In case of duplicate entries, we keep only the last updated element | [
"In",
"case",
"of",
"duplicate",
"entries",
"we",
"keep",
"only",
"the",
"last",
"updated",
"element"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/apitoken/ApiTokenStats.java#L86-L102 |
125,533 | jenkinsci/jenkins | core/src/main/java/hudson/model/CauseAction.java | CauseAction.getCauses | @Exported(visibility=2)
public List<Cause> getCauses() {
List<Cause> r = new ArrayList<>();
for (Map.Entry<Cause,Integer> entry : causeBag.entrySet()) {
r.addAll(Collections.nCopies(entry.getValue(), entry.getKey()));
}
return Collections.unmodifiableList(r);
} | java | @Exported(visibility=2)
public List<Cause> getCauses() {
List<Cause> r = new ArrayList<>();
for (Map.Entry<Cause,Integer> entry : causeBag.entrySet()) {
r.addAll(Collections.nCopies(entry.getValue(), entry.getKey()));
}
return Collections.unmodifiableList(r);
} | [
"@",
"Exported",
"(",
"visibility",
"=",
"2",
")",
"public",
"List",
"<",
"Cause",
">",
"getCauses",
"(",
")",
"{",
"List",
"<",
"Cause",
">",
"r",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Cause",
",",
... | Lists all causes of this build.
Note that the current implementation does not preserve insertion order of duplicates.
@return an immutable list;
to create an action with multiple causes use either of the constructors that support this;
to append causes retroactively to a build you must create a new {@link CauseAction} ... | [
"Lists",
"all",
"causes",
"of",
"this",
"build",
".",
"Note",
"that",
"the",
"current",
"implementation",
"does",
"not",
"preserve",
"insertion",
"order",
"of",
"duplicates",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/CauseAction.java#L93-L100 |
125,534 | jenkinsci/jenkins | core/src/main/java/hudson/model/CauseAction.java | CauseAction.findCause | public <T extends Cause> T findCause(Class<T> type) {
for (Cause c : causeBag.keySet())
if (type.isInstance(c))
return type.cast(c);
return null;
} | java | public <T extends Cause> T findCause(Class<T> type) {
for (Cause c : causeBag.keySet())
if (type.isInstance(c))
return type.cast(c);
return null;
} | [
"public",
"<",
"T",
"extends",
"Cause",
">",
"T",
"findCause",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"for",
"(",
"Cause",
"c",
":",
"causeBag",
".",
"keySet",
"(",
")",
")",
"if",
"(",
"type",
".",
"isInstance",
"(",
"c",
")",
")",
"re... | Finds the cause of the specific type. | [
"Finds",
"the",
"cause",
"of",
"the",
"specific",
"type",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/CauseAction.java#L105-L110 |
125,535 | jenkinsci/jenkins | core/src/main/java/hudson/scheduler/CronTabList.java | CronTabList.getValidTimezone | public static @CheckForNull String getValidTimezone(String timezone) {
String[] validIDs = TimeZone.getAvailableIDs();
for (String str : validIDs) {
if (str != null && str.equals(timezone)) {
return timezone;
}
}
return null;
} | java | public static @CheckForNull String getValidTimezone(String timezone) {
String[] validIDs = TimeZone.getAvailableIDs();
for (String str : validIDs) {
if (str != null && str.equals(timezone)) {
return timezone;
}
}
return null;
} | [
"public",
"static",
"@",
"CheckForNull",
"String",
"getValidTimezone",
"(",
"String",
"timezone",
")",
"{",
"String",
"[",
"]",
"validIDs",
"=",
"TimeZone",
".",
"getAvailableIDs",
"(",
")",
";",
"for",
"(",
"String",
"str",
":",
"validIDs",
")",
"{",
"if"... | Checks if given timezone string is supported by TimeZone and returns
the same string if valid, null otherwise
@since 1.615 | [
"Checks",
"if",
"given",
"timezone",
"string",
"is",
"supported",
"by",
"TimeZone",
"and",
"returns",
"the",
"same",
"string",
"if",
"valid",
"null",
"otherwise"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scheduler/CronTabList.java#L85-L93 |
125,536 | jenkinsci/jenkins | core/src/main/java/hudson/DescriptorExtensionList.java | DescriptorExtensionList.listLegacyInstances | public static Iterable<Descriptor> listLegacyInstances() {
return new Iterable<Descriptor>() {
public Iterator<Descriptor> iterator() {
return new AdaptedIterator<ExtensionComponent<Descriptor>,Descriptor>(
new FlattenIterator<ExtensionComponent<Descriptor>,CopyOn... | java | public static Iterable<Descriptor> listLegacyInstances() {
return new Iterable<Descriptor>() {
public Iterator<Descriptor> iterator() {
return new AdaptedIterator<ExtensionComponent<Descriptor>,Descriptor>(
new FlattenIterator<ExtensionComponent<Descriptor>,CopyOn... | [
"public",
"static",
"Iterable",
"<",
"Descriptor",
">",
"listLegacyInstances",
"(",
")",
"{",
"return",
"new",
"Iterable",
"<",
"Descriptor",
">",
"(",
")",
"{",
"public",
"Iterator",
"<",
"Descriptor",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"Ada... | List up all the legacy instances currently in use. | [
"List",
"up",
"all",
"the",
"legacy",
"instances",
"currently",
"in",
"use",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/DescriptorExtensionList.java#L233-L249 |
125,537 | jenkinsci/jenkins | core/src/main/java/hudson/util/jna/RegistryKey.java | RegistryKey.setValue | public void setValue(String name, String value) {
byte[] bytes = value.getBytes(StandardCharsets.UTF_16LE);
int newLength = bytes.length+2; // for 0 padding
byte[] with0 = new byte[newLength];
System.arraycopy(bytes, 0, with0, 0, newLength);
check(Advapi32.INSTANCE.RegSetValueEx(... | java | public void setValue(String name, String value) {
byte[] bytes = value.getBytes(StandardCharsets.UTF_16LE);
int newLength = bytes.length+2; // for 0 padding
byte[] with0 = new byte[newLength];
System.arraycopy(bytes, 0, with0, 0, newLength);
check(Advapi32.INSTANCE.RegSetValueEx(... | [
"public",
"void",
"setValue",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"value",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_16LE",
")",
";",
"int",
"newLength",
"=",
"bytes",
".",
"length",
"+",
"... | Writes a String value. | [
"Writes",
"a",
"String",
"value",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L127-L133 |
125,538 | jenkinsci/jenkins | core/src/main/java/hudson/util/jna/RegistryKey.java | RegistryKey.setValue | public void setValue(String name, int value) {
byte[] data = new byte[4];
data[0] = (byte) (value & 0xff);
data[1] = (byte) ((value >> 8) & 0xff);
data[2] = (byte) ((value >> 16) & 0xff);
data[3] = (byte) ((value >> 24) & 0xff);
check(Advapi32.INSTANCE.RegSetValueEx(hand... | java | public void setValue(String name, int value) {
byte[] data = new byte[4];
data[0] = (byte) (value & 0xff);
data[1] = (byte) ((value >> 8) & 0xff);
data[2] = (byte) ((value >> 16) & 0xff);
data[3] = (byte) ((value >> 24) & 0xff);
check(Advapi32.INSTANCE.RegSetValueEx(hand... | [
"public",
"void",
"setValue",
"(",
"String",
"name",
",",
"int",
"value",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"data",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
"&",
"0xff",
")",
";",
"data",
"... | Writes a DWORD value. | [
"Writes",
"a",
"DWORD",
"value",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L138-L146 |
125,539 | jenkinsci/jenkins | core/src/main/java/hudson/util/jna/RegistryKey.java | RegistryKey.valueExists | public boolean valueExists(String name) {
IntByReference pType, lpcbData;
byte[] lpData = new byte[1];
pType = new IntByReference();
lpcbData = new IntByReference();
OUTER:
while(true) {
int r = Advapi32.INSTANCE.RegQueryValueEx(handle, name, null, pType, lp... | java | public boolean valueExists(String name) {
IntByReference pType, lpcbData;
byte[] lpData = new byte[1];
pType = new IntByReference();
lpcbData = new IntByReference();
OUTER:
while(true) {
int r = Advapi32.INSTANCE.RegQueryValueEx(handle, name, null, pType, lp... | [
"public",
"boolean",
"valueExists",
"(",
"String",
"name",
")",
"{",
"IntByReference",
"pType",
",",
"lpcbData",
";",
"byte",
"[",
"]",
"lpData",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"pType",
"=",
"new",
"IntByReference",
"(",
")",
";",
"lpcbData",
... | Does a specified value exist? | [
"Does",
"a",
"specified",
"value",
"exist?"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L151-L173 |
125,540 | jenkinsci/jenkins | core/src/main/java/hudson/util/jna/RegistryKey.java | RegistryKey.getSubKeys | public Collection<String> getSubKeys() {
WINBASE.FILETIME lpftLastWriteTime;
TreeSet<String> subKeys = new TreeSet<>();
char[] lpName = new char[256];
IntByReference lpcName = new IntByReference(256);
lpftLastWriteTime = new WINBASE.FILETIME();
int dwIndex = 0;
w... | java | public Collection<String> getSubKeys() {
WINBASE.FILETIME lpftLastWriteTime;
TreeSet<String> subKeys = new TreeSet<>();
char[] lpName = new char[256];
IntByReference lpcName = new IntByReference(256);
lpftLastWriteTime = new WINBASE.FILETIME();
int dwIndex = 0;
w... | [
"public",
"Collection",
"<",
"String",
">",
"getSubKeys",
"(",
")",
"{",
"WINBASE",
".",
"FILETIME",
"lpftLastWriteTime",
";",
"TreeSet",
"<",
"String",
">",
"subKeys",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"char",
"[",
"]",
"lpName",
"=",
"new",
... | Get all sub keys of a key.
@return array with all sub key names | [
"Get",
"all",
"sub",
"keys",
"of",
"a",
"key",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L188-L204 |
125,541 | jenkinsci/jenkins | core/src/main/java/hudson/util/jna/RegistryKey.java | RegistryKey.getValues | public TreeMap<String, Object> getValues() {
int dwIndex, result;
char[] lpValueName;
byte[] lpData;
IntByReference lpcchValueName, lpType, lpcbData;
String name;
TreeMap<String, Object> values = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
lpValueName = new cha... | java | public TreeMap<String, Object> getValues() {
int dwIndex, result;
char[] lpValueName;
byte[] lpData;
IntByReference lpcchValueName, lpType, lpcbData;
String name;
TreeMap<String, Object> values = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
lpValueName = new cha... | [
"public",
"TreeMap",
"<",
"String",
",",
"Object",
">",
"getValues",
"(",
")",
"{",
"int",
"dwIndex",
",",
"result",
";",
"char",
"[",
"]",
"lpValueName",
";",
"byte",
"[",
"]",
"lpData",
";",
"IntByReference",
"lpcchValueName",
",",
"lpType",
",",
"lpcb... | Get all values under a key.
@return TreeMap with name and value pairs | [
"Get",
"all",
"values",
"under",
"a",
"key",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/jna/RegistryKey.java#L225-L276 |
125,542 | jenkinsci/jenkins | core/src/main/java/jenkins/scm/SCMCheckoutStrategy.java | SCMCheckoutStrategy.preCheckout | public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException {
AbstractProject<?, ?> project = build.getProject();
if (project instanceof BuildableItemWithBuildWrappers) {
BuildableItemWithBuildWrappers biwbw = (Buil... | java | public void preCheckout(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException {
AbstractProject<?, ?> project = build.getProject();
if (project instanceof BuildableItemWithBuildWrappers) {
BuildableItemWithBuildWrappers biwbw = (Buil... | [
"public",
"void",
"preCheckout",
"(",
"AbstractBuild",
"<",
"?",
",",
"?",
">",
"build",
",",
"Launcher",
"launcher",
",",
"BuildListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"AbstractProject",
"<",
"?",
",",
"?",
">",
... | Performs the pre checkout step.
This method is called by the {@link Executor} that's carrying out the build.
@param build
Build being in progress. Never null.
@param launcher
Allows you to launch process on the node where the build is actually running. Never null.
@param listener
Allows you to write to console output... | [
"Performs",
"the",
"pre",
"checkout",
"step",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/scm/SCMCheckoutStrategy.java#L71-L78 |
125,543 | jenkinsci/jenkins | core/src/main/java/hudson/diagnosis/HudsonHomeDiskUsageMonitor.java | HudsonHomeDiskUsageMonitor.getSolution | public Solution getSolution(String id) {
for( Solution s : Solution.all() )
if(s.id.equals(id))
return s;
return null;
} | java | public Solution getSolution(String id) {
for( Solution s : Solution.all() )
if(s.id.equals(id))
return s;
return null;
} | [
"public",
"Solution",
"getSolution",
"(",
"String",
"id",
")",
"{",
"for",
"(",
"Solution",
"s",
":",
"Solution",
".",
"all",
"(",
")",
")",
"if",
"(",
"s",
".",
"id",
".",
"equals",
"(",
"id",
")",
")",
"return",
"s",
";",
"return",
"null",
";",... | Binds a solution to the URL. | [
"Binds",
"a",
"solution",
"to",
"the",
"URL",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/diagnosis/HudsonHomeDiskUsageMonitor.java#L85-L90 |
125,544 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.getIndexPage | public URL getIndexPage() {
// In the current impl dependencies are checked first, so the plugin itself
// will add the last entry in the getResources result.
URL idx = null;
try {
Enumeration<URL> en = classLoader.getResources("index.jelly");
while (en.hasMoreEle... | java | public URL getIndexPage() {
// In the current impl dependencies are checked first, so the plugin itself
// will add the last entry in the getResources result.
URL idx = null;
try {
Enumeration<URL> en = classLoader.getResources("index.jelly");
while (en.hasMoreEle... | [
"public",
"URL",
"getIndexPage",
"(",
")",
"{",
"// In the current impl dependencies are checked first, so the plugin itself",
"// will add the last entry in the getResources result.",
"URL",
"idx",
"=",
"null",
";",
"try",
"{",
"Enumeration",
"<",
"URL",
">",
"en",
"=",
"c... | Returns the URL of the index page jelly script. | [
"Returns",
"the",
"URL",
"of",
"the",
"index",
"page",
"jelly",
"script",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L412-L424 |
125,545 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.getUrl | @Exported
public String getUrl() {
// first look for the manifest entry. This is new in maven-hpi-plugin 1.30
String url = manifest.getMainAttributes().getValue("Url");
if(url!=null) return url;
// fallback to update center metadata
UpdateSite.Plugin ui = getInfo();
... | java | @Exported
public String getUrl() {
// first look for the manifest entry. This is new in maven-hpi-plugin 1.30
String url = manifest.getMainAttributes().getValue("Url");
if(url!=null) return url;
// fallback to update center metadata
UpdateSite.Plugin ui = getInfo();
... | [
"@",
"Exported",
"public",
"String",
"getUrl",
"(",
")",
"{",
"// first look for the manifest entry. This is new in maven-hpi-plugin 1.30",
"String",
"url",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"\"Url\"",
")",
";",
"if",
"(",
"u... | Gets the URL that shows more information about this plugin.
@return
null if this information is unavailable.
@since 1.283 | [
"Gets",
"the",
"URL",
"that",
"shows",
"more",
"information",
"about",
"this",
"plugin",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L473-L484 |
125,546 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.getLongName | @Exported
public String getLongName() {
String name = manifest.getMainAttributes().getValue("Long-Name");
if(name!=null) return name;
return shortName;
} | java | @Exported
public String getLongName() {
String name = manifest.getMainAttributes().getValue("Long-Name");
if(name!=null) return name;
return shortName;
} | [
"@",
"Exported",
"public",
"String",
"getLongName",
"(",
")",
"{",
"String",
"name",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"\"Long-Name\"",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"return",
"name",
";",
"retur... | Returns a one-line descriptive name of this plugin. | [
"Returns",
"a",
"one",
"-",
"line",
"descriptive",
"name",
"of",
"this",
"plugin",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L496-L501 |
125,547 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.supportsDynamicLoad | @Exported
public YesNoMaybe supportsDynamicLoad() {
String v = manifest.getMainAttributes().getValue("Support-Dynamic-Loading");
if (v==null) return YesNoMaybe.MAYBE;
return Boolean.parseBoolean(v) ? YesNoMaybe.YES : YesNoMaybe.NO;
} | java | @Exported
public YesNoMaybe supportsDynamicLoad() {
String v = manifest.getMainAttributes().getValue("Support-Dynamic-Loading");
if (v==null) return YesNoMaybe.MAYBE;
return Boolean.parseBoolean(v) ? YesNoMaybe.YES : YesNoMaybe.NO;
} | [
"@",
"Exported",
"public",
"YesNoMaybe",
"supportsDynamicLoad",
"(",
")",
"{",
"String",
"v",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"\"Support-Dynamic-Loading\"",
")",
";",
"if",
"(",
"v",
"==",
"null",
")",
"return",
"Ye... | Does this plugin supports dynamic loading? | [
"Does",
"this",
"plugin",
"supports",
"dynamic",
"loading?"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L506-L511 |
125,548 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.getRequiredCoreVersion | @Exported
public @CheckForNull String getRequiredCoreVersion() {
String v = manifest.getMainAttributes().getValue("Jenkins-Version");
if (v!= null) return v;
v = manifest.getMainAttributes().getValue("Hudson-Version");
if (v!= null) return v;
return null;
} | java | @Exported
public @CheckForNull String getRequiredCoreVersion() {
String v = manifest.getMainAttributes().getValue("Jenkins-Version");
if (v!= null) return v;
v = manifest.getMainAttributes().getValue("Hudson-Version");
if (v!= null) return v;
return null;
} | [
"@",
"Exported",
"public",
"@",
"CheckForNull",
"String",
"getRequiredCoreVersion",
"(",
")",
"{",
"String",
"v",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"\"Jenkins-Version\"",
")",
";",
"if",
"(",
"v",
"!=",
"null",
")",
... | Returns the required Jenkins core version of this plugin.
@return the required Jenkins core version of this plugin.
@since 2.16 | [
"Returns",
"the",
"required",
"Jenkins",
"core",
"version",
"of",
"this",
"plugin",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L537-L545 |
125,549 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.stop | public void stop() {
Plugin plugin = getPlugin();
if (plugin != null) {
try {
LOGGER.log(Level.FINE, "Stopping {0}", shortName);
plugin.stop();
} catch (Throwable t) {
LOGGER.log(WARNING, "Failed to shut down " + shortName, t);
... | java | public void stop() {
Plugin plugin = getPlugin();
if (plugin != null) {
try {
LOGGER.log(Level.FINE, "Stopping {0}", shortName);
plugin.stop();
} catch (Throwable t) {
LOGGER.log(WARNING, "Failed to shut down " + shortName, t);
... | [
"public",
"void",
"stop",
"(",
")",
"{",
"Plugin",
"plugin",
"=",
"getPlugin",
"(",
")",
";",
"if",
"(",
"plugin",
"!=",
"null",
")",
"{",
"try",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Stopping {0}\"",
",",
"shortName",
")",
... | Terminates the plugin. | [
"Terminates",
"the",
"plugin",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L584-L599 |
125,550 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.enable | public void enable() throws IOException {
if (!disableFile.exists()) {
LOGGER.log(Level.FINEST, "Plugin {0} has been already enabled. Skipping the enable() operation", getShortName());
return;
}
if(!disableFile.delete())
throw new IOException("Failed to delete... | java | public void enable() throws IOException {
if (!disableFile.exists()) {
LOGGER.log(Level.FINEST, "Plugin {0} has been already enabled. Skipping the enable() operation", getShortName());
return;
}
if(!disableFile.delete())
throw new IOException("Failed to delete... | [
"public",
"void",
"enable",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"disableFile",
".",
"exists",
"(",
")",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Plugin {0} has been already enabled. Skipping the enable() operation\""... | Enables this plugin next time Jenkins runs. | [
"Enables",
"this",
"plugin",
"next",
"time",
"Jenkins",
"runs",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L613-L620 |
125,551 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.disableWithoutCheck | private void disableWithoutCheck() throws IOException {
// creates an empty file
try (OutputStream os = Files.newOutputStream(disableFile.toPath())) {
os.close();
} catch (InvalidPathException e) {
throw new IOException(e);
}
} | java | private void disableWithoutCheck() throws IOException {
// creates an empty file
try (OutputStream os = Files.newOutputStream(disableFile.toPath())) {
os.close();
} catch (InvalidPathException e) {
throw new IOException(e);
}
} | [
"private",
"void",
"disableWithoutCheck",
"(",
")",
"throws",
"IOException",
"{",
"// creates an empty file",
"try",
"(",
"OutputStream",
"os",
"=",
"Files",
".",
"newOutputStream",
"(",
"disableFile",
".",
"toPath",
"(",
")",
")",
")",
"{",
"os",
".",
"close"... | Disable a plugin wihout checking any dependency. Only add the disable file.
@throws IOException | [
"Disable",
"a",
"plugin",
"wihout",
"checking",
"any",
"dependency",
".",
"Only",
"add",
"the",
"disable",
"file",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L635-L642 |
125,552 | jenkinsci/jenkins | core/src/main/java/hudson/PluginWrapper.java | PluginWrapper.getBackupVersion | @Exported
public String getBackupVersion() {
File backup = getBackupFile();
if (backup.exists()) {
try {
try (JarFile backupPlugin = new JarFile(backup)) {
return backupPlugin.getManifest().getMainAttributes().getValue("Plugin-Version");
... | java | @Exported
public String getBackupVersion() {
File backup = getBackupFile();
if (backup.exists()) {
try {
try (JarFile backupPlugin = new JarFile(backup)) {
return backupPlugin.getManifest().getMainAttributes().getValue("Plugin-Version");
... | [
"@",
"Exported",
"public",
"String",
"getBackupVersion",
"(",
")",
"{",
"File",
"backup",
"=",
"getBackupFile",
"(",
")",
";",
"if",
"(",
"backup",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"try",
"(",
"JarFile",
"backupPlugin",
"=",
"new",
"JarFi... | returns the version of the backed up plugin,
or null if there's no back up. | [
"returns",
"the",
"version",
"of",
"the",
"backed",
"up",
"plugin",
"or",
"null",
"if",
"there",
"s",
"no",
"back",
"up",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/PluginWrapper.java#L975-L990 |
125,553 | jenkinsci/jenkins | core/src/main/java/jenkins/management/AsynchronousAdministrativeMonitor.java | AsynchronousAdministrativeMonitor.start | protected synchronized Thread start(boolean forceRestart) {
if (!forceRestart && isFixingActive()) {
fixThread.interrupt();
}
if (forceRestart || !isFixingActive()) {
fixThread = new FixThread();
fixThread.start();
}
return fixThread;
} | java | protected synchronized Thread start(boolean forceRestart) {
if (!forceRestart && isFixingActive()) {
fixThread.interrupt();
}
if (forceRestart || !isFixingActive()) {
fixThread = new FixThread();
fixThread.start();
}
return fixThread;
} | [
"protected",
"synchronized",
"Thread",
"start",
"(",
"boolean",
"forceRestart",
")",
"{",
"if",
"(",
"!",
"forceRestart",
"&&",
"isFixingActive",
"(",
")",
")",
"{",
"fixThread",
".",
"interrupt",
"(",
")",
";",
"}",
"if",
"(",
"forceRestart",
"||",
"!",
... | Starts the background fixing activity.
@param forceRestart
If true, any ongoing fixing activity gets interrupted and the new one starts right away. | [
"Starts",
"the",
"background",
"fixing",
"activity",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/management/AsynchronousAdministrativeMonitor.java#L76-L86 |
125,554 | jenkinsci/jenkins | core/src/main/java/hudson/model/RSS.java | RSS.doTrackback | public static void doTrackback( Object it, StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
String url = req.getParameter("url");
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setContentType("application/xml; charset=UTF-8");
try (PrintWriter pw = rsp.ge... | java | public static void doTrackback( Object it, StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
String url = req.getParameter("url");
rsp.setStatus(HttpServletResponse.SC_OK);
rsp.setContentType("application/xml; charset=UTF-8");
try (PrintWriter pw = rsp.ge... | [
"public",
"static",
"void",
"doTrackback",
"(",
"Object",
"it",
",",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"String",
"url",
"=",
"req",
".",
"getParameter",
"(",
"\"url\"",
")",
";",... | Parses trackback ping. | [
"Parses",
"trackback",
"ping",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/RSS.java#L47-L61 |
125,555 | jenkinsci/jenkins | core/src/main/java/hudson/model/RSS.java | RSS.forwardToRss | public static <E> void forwardToRss(String title, String url, Collection<? extends E> entries, FeedAdapter<E> adapter, StaplerRequest req, HttpServletResponse rsp) throws IOException, ServletException {
req.setAttribute("adapter",adapter);
req.setAttribute("title",title);
req.setAttribute("url",... | java | public static <E> void forwardToRss(String title, String url, Collection<? extends E> entries, FeedAdapter<E> adapter, StaplerRequest req, HttpServletResponse rsp) throws IOException, ServletException {
req.setAttribute("adapter",adapter);
req.setAttribute("title",title);
req.setAttribute("url",... | [
"public",
"static",
"<",
"E",
">",
"void",
"forwardToRss",
"(",
"String",
"title",
",",
"String",
"url",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"entries",
",",
"FeedAdapter",
"<",
"E",
">",
"adapter",
",",
"StaplerRequest",
"req",
",",
"HttpSe... | Sends the RSS feed to the client.
@param title
Title of the feed.
@param url
URL of the model object that owns this feed. Relative to the context root.
@param entries
Entries to be listed in the RSS feed.
@param adapter
Controls how to render entries to RSS. | [
"Sends",
"the",
"RSS",
"feed",
"to",
"the",
"client",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/RSS.java#L75-L87 |
125,556 | jenkinsci/jenkins | core/src/main/java/hudson/cli/CLICommand.java | CLICommand.getName | public String getName() {
String name = getClass().getName();
name = name.substring(name.lastIndexOf('.') + 1); // short name
name = name.substring(name.lastIndexOf('$')+1);
if(name.endsWith("Command"))
name = name.substring(0,name.length()-7); // trim off the command
... | java | public String getName() {
String name = getClass().getName();
name = name.substring(name.lastIndexOf('.') + 1); // short name
name = name.substring(name.lastIndexOf('$')+1);
if(name.endsWith("Command"))
name = name.substring(0,name.length()-7); // trim off the command
... | [
"public",
"String",
"getName",
"(",
")",
"{",
"String",
"name",
"=",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"// short name... | Gets the command name.
<p>
For example, if the CLI is invoked as {@code java -jar cli.jar foo arg1 arg2 arg4},
on the server side {@link CLICommand} that returns "foo" from {@link #getName()}
will be invoked.
<p>
By default, this method creates "foo-bar-zot" from "FooBarZotCommand". | [
"Gets",
"the",
"command",
"name",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/cli/CLICommand.java#L167-L177 |
125,557 | jenkinsci/jenkins | core/src/main/java/hudson/cli/CLICommand.java | CLICommand.getTransportAuthentication | public Authentication getTransportAuthentication() {
Authentication a = transportAuth;
if (a==null) a = Jenkins.ANONYMOUS;
return a;
} | java | public Authentication getTransportAuthentication() {
Authentication a = transportAuth;
if (a==null) a = Jenkins.ANONYMOUS;
return a;
} | [
"public",
"Authentication",
"getTransportAuthentication",
"(",
")",
"{",
"Authentication",
"a",
"=",
"transportAuth",
";",
"if",
"(",
"a",
"==",
"null",
")",
"a",
"=",
"Jenkins",
".",
"ANONYMOUS",
";",
"return",
"a",
";",
"}"
] | Returns the identity of the client as determined at the CLI transport level.
<p>
When the CLI connection to the server is tunneled over HTTP, that HTTP connection
can authenticate the client, just like any other HTTP connections to the server
can authenticate the client. This method returns that information, if one is... | [
"Returns",
"the",
"identity",
"of",
"the",
"client",
"as",
"determined",
"at",
"the",
"CLI",
"transport",
"level",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/cli/CLICommand.java#L365-L369 |
125,558 | jenkinsci/jenkins | core/src/main/java/hudson/cli/CLICommand.java | CLICommand.getSingleLineSummary | @Restricted(NoExternalUse.class)
public final String getSingleLineSummary() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
getCmdLineParser().printSingleLineUsage(out);
return out.toString();
} | java | @Restricted(NoExternalUse.class)
public final String getSingleLineSummary() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
getCmdLineParser().printSingleLineUsage(out);
return out.toString();
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"final",
"String",
"getSingleLineSummary",
"(",
")",
"{",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"getCmdLineParser",
"(",
")",
".",
"printSingleLineU... | Get single line summary as a string. | [
"Get",
"single",
"line",
"summary",
"as",
"a",
"string",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/cli/CLICommand.java#L413-L418 |
125,559 | jenkinsci/jenkins | core/src/main/java/hudson/cli/CLICommand.java | CLICommand.getUsage | @Restricted(NoExternalUse.class)
public final String getUsage() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
getCmdLineParser().printUsage(out);
return out.toString();
} | java | @Restricted(NoExternalUse.class)
public final String getUsage() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
getCmdLineParser().printUsage(out);
return out.toString();
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"final",
"String",
"getUsage",
"(",
")",
"{",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"getCmdLineParser",
"(",
")",
".",
"printUsage",
"(",
"out",... | Get usage as a string. | [
"Get",
"usage",
"as",
"a",
"string",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/cli/CLICommand.java#L423-L428 |
125,560 | jenkinsci/jenkins | core/src/main/java/hudson/cli/CLICommand.java | CLICommand.getLongDescription | @Restricted(NoExternalUse.class)
public final String getLongDescription() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(out);
printUsageSummary(ps);
ps.close();
return out.toString();
} | java | @Restricted(NoExternalUse.class)
public final String getLongDescription() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(out);
printUsageSummary(ps);
ps.close();
return out.toString();
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"final",
"String",
"getLongDescription",
"(",
")",
"{",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"PrintStream",
"ps",
"=",
"new",
"PrintStream",
"(",... | Get long description as a string. | [
"Get",
"long",
"description",
"as",
"a",
"string",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/cli/CLICommand.java#L433-L441 |
125,561 | jenkinsci/jenkins | core/src/main/java/hudson/tools/ToolInstaller.java | ToolInstaller.preferredLocation | protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDesc... | java | protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDesc... | [
"protected",
"final",
"FilePath",
"preferredLocation",
"(",
"ToolInstallation",
"tool",
",",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"must pass non-null node\"",
")",
";",
"}",
"Stri... | Convenience method to find a location to install a tool.
@param tool the tool being installed
@param node the computer on which to install the tool
@return {@link ToolInstallation#getHome} if specified, else a path within the local
Jenkins work area named according to {@link ToolInstallation#getName}
@since 1.310 | [
"Convenience",
"method",
"to",
"find",
"a",
"location",
"to",
"install",
"a",
"tool",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tools/ToolInstaller.java#L114-L127 |
125,562 | jenkinsci/jenkins | core/src/main/java/hudson/model/FileParameterDefinition.java | FileParameterDefinition.getFileName | private String getFileName(String possiblyPathName) {
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('/')+1);
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('\\')+1);
return possiblyPathName;
} | java | private String getFileName(String possiblyPathName) {
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('/')+1);
possiblyPathName = possiblyPathName.substring(possiblyPathName.lastIndexOf('\\')+1);
return possiblyPathName;
} | [
"private",
"String",
"getFileName",
"(",
"String",
"possiblyPathName",
")",
"{",
"possiblyPathName",
"=",
"possiblyPathName",
".",
"substring",
"(",
"possiblyPathName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"possiblyPathName",
"=",
"possibl... | Strip off the path portion if the given path contains it. | [
"Strip",
"off",
"the",
"path",
"portion",
"if",
"the",
"given",
"path",
"contains",
"it",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/FileParameterDefinition.java#L95-L99 |
125,563 | jenkinsci/jenkins | core/src/main/java/hudson/tasks/ArtifactArchiver.java | ArtifactArchiver.readResolve | @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
justification = "Null checks in readResolve are valid since we deserialize and upgrade objects")
protected Object readResolve() {
if (allowEmptyArchive == null) {
this.allowEmptyArchive = SystemProperties.getBool... | java | @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE",
justification = "Null checks in readResolve are valid since we deserialize and upgrade objects")
protected Object readResolve() {
if (allowEmptyArchive == null) {
this.allowEmptyArchive = SystemProperties.getBool... | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE\"",
",",
"justification",
"=",
"\"Null checks in readResolve are valid since we deserialize and upgrade objects\"",
")",
"protected",
"Object",
"readResolve",
"(",
")",
"{",
"if",
"(",
"al... | Backwards compatibility for older builds | [
"Backwards",
"compatibility",
"for",
"older",
"builds"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/ArtifactArchiver.java#L144-L157 |
125,564 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.applyForcedChanges | private void applyForcedChanges(){
// Disable the legacy system of API Token only if the new system was not installed
// in such case it means there was already an upgrade before
// and potentially the admin has re-enabled the features
ApiTokenPropertyConfiguration apiTokenPropertyConfi... | java | private void applyForcedChanges(){
// Disable the legacy system of API Token only if the new system was not installed
// in such case it means there was already an upgrade before
// and potentially the admin has re-enabled the features
ApiTokenPropertyConfiguration apiTokenPropertyConfi... | [
"private",
"void",
"applyForcedChanges",
"(",
")",
"{",
"// Disable the legacy system of API Token only if the new system was not installed",
"// in such case it means there was already an upgrade before ",
"// and potentially the admin has re-enabled the features",
"ApiTokenPropertyConfiguration"... | Put here the different changes that are enforced after an update. | [
"Put",
"here",
"the",
"different",
"changes",
"that",
"are",
"enforced",
"after",
"an",
"update",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L77-L87 |
125,565 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.isDue | public boolean isDue() {
if (isUpToDate)
return false;
// only admin users should see this
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER))
return false;
// only show when Jenkins is fully up & running
WebApp wa = WebApp.getCurrent();
... | java | public boolean isDue() {
if (isUpToDate)
return false;
// only admin users should see this
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER))
return false;
// only show when Jenkins is fully up & running
WebApp wa = WebApp.getCurrent();
... | [
"public",
"boolean",
"isDue",
"(",
")",
"{",
"if",
"(",
"isUpToDate",
")",
"return",
"false",
";",
"// only admin users should see this",
"if",
"(",
"!",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"hasPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
"... | Do we need to show the upgrade wizard prompt? | [
"Do",
"we",
"need",
"to",
"show",
"the",
"upgrade",
"wizard",
"prompt?"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L108-L122 |
125,566 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.isShowUpgradeWizard | public boolean isShowUpgradeWizard() {
HttpSession session = Stapler.getCurrentRequest().getSession(false);
if(session != null) {
return Boolean.TRUE.equals(session.getAttribute(SHOW_UPGRADE_WIZARD_FLAG));
}
return false;
} | java | public boolean isShowUpgradeWizard() {
HttpSession session = Stapler.getCurrentRequest().getSession(false);
if(session != null) {
return Boolean.TRUE.equals(session.getAttribute(SHOW_UPGRADE_WIZARD_FLAG));
}
return false;
} | [
"public",
"boolean",
"isShowUpgradeWizard",
"(",
")",
"{",
"HttpSession",
"session",
"=",
"Stapler",
".",
"getCurrentRequest",
"(",
")",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"return",
"Boolean",
".",
"TRU... | Whether to show the upgrade wizard | [
"Whether",
"to",
"show",
"the",
"upgrade",
"wizard"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L127-L133 |
125,567 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.doShowUpgradeWizard | public HttpResponse doShowUpgradeWizard() throws Exception {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
HttpSession session = Stapler.getCurrentRequest().getSession(true);
session.setAttribute(SHOW_UPGRADE_WIZARD_FLAG, true);
return HttpResponses.redirectToContextRoot();
... | java | public HttpResponse doShowUpgradeWizard() throws Exception {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
HttpSession session = Stapler.getCurrentRequest().getSession(true);
session.setAttribute(SHOW_UPGRADE_WIZARD_FLAG, true);
return HttpResponses.redirectToContextRoot();
... | [
"public",
"HttpResponse",
"doShowUpgradeWizard",
"(",
")",
"throws",
"Exception",
"{",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"checkPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
";",
"HttpSession",
"session",
"=",
"Stapler",
".",
"getCurrentRequest",... | Call this to show the upgrade wizard | [
"Call",
"this",
"to",
"show",
"the",
"upgrade",
"wizard"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L137-L142 |
125,568 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.doHideUpgradeWizard | public HttpResponse doHideUpgradeWizard() {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
HttpSession session = Stapler.getCurrentRequest().getSession(false);
if(session != null) {
session.removeAttribute(SHOW_UPGRADE_WIZARD_FLAG);
}
return HttpResponses.... | java | public HttpResponse doHideUpgradeWizard() {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
HttpSession session = Stapler.getCurrentRequest().getSession(false);
if(session != null) {
session.removeAttribute(SHOW_UPGRADE_WIZARD_FLAG);
}
return HttpResponses.... | [
"public",
"HttpResponse",
"doHideUpgradeWizard",
"(",
")",
"{",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"checkPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
";",
"HttpSession",
"session",
"=",
"Stapler",
".",
"getCurrentRequest",
"(",
")",
".",
"ge... | Call this to hide the upgrade wizard | [
"Call",
"this",
"to",
"hide",
"the",
"upgrade",
"wizard"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L147-L154 |
125,569 | jenkinsci/jenkins | core/src/main/java/jenkins/install/UpgradeWizard.java | UpgradeWizard.doSnooze | @RequirePOST
public HttpResponse doSnooze() throws IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
File f = SetupWizard.getUpdateStateFile();
FileUtils.touch(f);
f.setLastModified(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1));
LOGGER.log(FIN... | java | @RequirePOST
public HttpResponse doSnooze() throws IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
File f = SetupWizard.getUpdateStateFile();
FileUtils.touch(f);
f.setLastModified(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1));
LOGGER.log(FIN... | [
"@",
"RequirePOST",
"public",
"HttpResponse",
"doSnooze",
"(",
")",
"throws",
"IOException",
"{",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"checkPermission",
"(",
"Jenkins",
".",
"ADMINISTER",
")",
";",
"File",
"f",
"=",
"SetupWizard",
".",
"getUpdateStat... | Snooze the upgrade wizard notice. | [
"Snooze",
"the",
"upgrade",
"wizard",
"notice",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/UpgradeWizard.java#L159-L167 |
125,570 | jenkinsci/jenkins | core/src/main/java/hudson/model/FingerprintCleanupThread.java | FingerprintCleanupThread.deleteIfEmpty | private void deleteIfEmpty(File dir) {
String[] r = dir.list();
if(r==null) return; // can happen in a rare occasion
if(r.length==0)
dir.delete();
} | java | private void deleteIfEmpty(File dir) {
String[] r = dir.list();
if(r==null) return; // can happen in a rare occasion
if(r.length==0)
dir.delete();
} | [
"private",
"void",
"deleteIfEmpty",
"(",
"File",
"dir",
")",
"{",
"String",
"[",
"]",
"r",
"=",
"dir",
".",
"list",
"(",
")",
";",
"if",
"(",
"r",
"==",
"null",
")",
"return",
";",
"// can happen in a rare occasion",
"if",
"(",
"r",
".",
"length",
"=... | Deletes a directory if it's empty. | [
"Deletes",
"a",
"directory",
"if",
"it",
"s",
"empty",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/FingerprintCleanupThread.java#L97-L102 |
125,571 | jenkinsci/jenkins | core/src/main/java/hudson/model/FingerprintCleanupThread.java | FingerprintCleanupThread.check | private boolean check(File fingerprintFile, TaskListener listener) {
try {
Fingerprint fp = loadFingerprint(fingerprintFile);
if (fp == null || !fp.isAlive()) {
listener.getLogger().println("deleting obsolete " + fingerprintFile);
fingerprintFile.delete();... | java | private boolean check(File fingerprintFile, TaskListener listener) {
try {
Fingerprint fp = loadFingerprint(fingerprintFile);
if (fp == null || !fp.isAlive()) {
listener.getLogger().println("deleting obsolete " + fingerprintFile);
fingerprintFile.delete();... | [
"private",
"boolean",
"check",
"(",
"File",
"fingerprintFile",
",",
"TaskListener",
"listener",
")",
"{",
"try",
"{",
"Fingerprint",
"fp",
"=",
"loadFingerprint",
"(",
"fingerprintFile",
")",
";",
"if",
"(",
"fp",
"==",
"null",
"||",
"!",
"fp",
".",
"isAli... | Examines the file and returns true if a file was deleted. | [
"Examines",
"the",
"file",
"and",
"returns",
"true",
"if",
"a",
"file",
"was",
"deleted",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/FingerprintCleanupThread.java#L107-L124 |
125,572 | jenkinsci/jenkins | core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java | CallableDirectionChecker.isWhitelisted | private boolean isWhitelisted(RoleSensitive subject, Collection<Role> expected) {
for (CallableWhitelist w : CallableWhitelist.all()) {
if (w.isWhitelisted(subject, expected, context))
return true;
}
return false;
} | java | private boolean isWhitelisted(RoleSensitive subject, Collection<Role> expected) {
for (CallableWhitelist w : CallableWhitelist.all()) {
if (w.isWhitelisted(subject, expected, context))
return true;
}
return false;
} | [
"private",
"boolean",
"isWhitelisted",
"(",
"RoleSensitive",
"subject",
",",
"Collection",
"<",
"Role",
">",
"expected",
")",
"{",
"for",
"(",
"CallableWhitelist",
"w",
":",
"CallableWhitelist",
".",
"all",
"(",
")",
")",
"{",
"if",
"(",
"w",
".",
"isWhite... | Is this subject class name whitelisted? | [
"Is",
"this",
"subject",
"class",
"name",
"whitelisted?"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/s2m/CallableDirectionChecker.java#L69-L75 |
125,573 | jenkinsci/jenkins | core/src/main/java/hudson/util/KeyedDataStorage.java | KeyedDataStorage.get | public @CheckForNull T get(String key) throws IOException {
return get(key,false,null);
} | java | public @CheckForNull T get(String key) throws IOException {
return get(key,false,null);
} | [
"public",
"@",
"CheckForNull",
"T",
"get",
"(",
"String",
"key",
")",
"throws",
"IOException",
"{",
"return",
"get",
"(",
"key",
",",
"false",
",",
"null",
")",
";",
"}"
] | Finds the data object that matches the given key if available, or null
if not found.
@return Item with the specified {@code key}
@throws IOException Loading error | [
"Finds",
"the",
"data",
"object",
"that",
"matches",
"the",
"given",
"key",
"if",
"available",
"or",
"null",
"if",
"not",
"found",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/KeyedDataStorage.java#L120-L122 |
125,574 | jenkinsci/jenkins | core/src/main/java/hudson/util/KeyedDataStorage.java | KeyedDataStorage.getPerformanceStats | public String getPerformanceStats() {
int total = totalQuery.get();
int hit = cacheHit.get();
int weakRef = weakRefLost.get();
int failure = loadFailure.get();
int miss = total-hit-weakRef;
return MessageFormat.format("total={0} hit={1}% lostRef={2}% failure={3}% miss={4... | java | public String getPerformanceStats() {
int total = totalQuery.get();
int hit = cacheHit.get();
int weakRef = weakRefLost.get();
int failure = loadFailure.get();
int miss = total-hit-weakRef;
return MessageFormat.format("total={0} hit={1}% lostRef={2}% failure={3}% miss={4... | [
"public",
"String",
"getPerformanceStats",
"(",
")",
"{",
"int",
"total",
"=",
"totalQuery",
".",
"get",
"(",
")",
";",
"int",
"hit",
"=",
"cacheHit",
".",
"get",
"(",
")",
";",
"int",
"weakRef",
"=",
"weakRefLost",
".",
"get",
"(",
")",
";",
"int",
... | Gets the short summary of performance statistics. | [
"Gets",
"the",
"short",
"summary",
"of",
"performance",
"statistics",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/KeyedDataStorage.java#L234-L243 |
125,575 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.hasSomeUser | private static boolean hasSomeUser() {
for (User u : User.getAll())
if(u.getProperty(Details.class)!=null)
return true;
return false;
} | java | private static boolean hasSomeUser() {
for (User u : User.getAll())
if(u.getProperty(Details.class)!=null)
return true;
return false;
} | [
"private",
"static",
"boolean",
"hasSomeUser",
"(",
")",
"{",
"for",
"(",
"User",
"u",
":",
"User",
".",
"getAll",
"(",
")",
")",
"if",
"(",
"u",
".",
"getProperty",
"(",
"Details",
".",
"class",
")",
"!=",
"null",
")",
"return",
"true",
";",
"retu... | Computes if this Hudson has some user accounts configured.
<p>
This is used to check for the initial | [
"Computes",
"if",
"this",
"Hudson",
"has",
"some",
"user",
"accounts",
"configured",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L171-L176 |
125,576 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.commenceSignup | @Override
public HttpResponse commenceSignup(final FederatedIdentity identity) {
// store the identity in the session so that we can use this later
Stapler.getCurrentRequest().getSession().setAttribute(FEDERATED_IDENTITY_SESSION_KEY,identity);
return new ForwardToView(this,"signupWithFederat... | java | @Override
public HttpResponse commenceSignup(final FederatedIdentity identity) {
// store the identity in the session so that we can use this later
Stapler.getCurrentRequest().getSession().setAttribute(FEDERATED_IDENTITY_SESSION_KEY,identity);
return new ForwardToView(this,"signupWithFederat... | [
"@",
"Override",
"public",
"HttpResponse",
"commenceSignup",
"(",
"final",
"FederatedIdentity",
"identity",
")",
"{",
"// store the identity in the session so that we can use this later",
"Stapler",
".",
"getCurrentRequest",
"(",
")",
".",
"getSession",
"(",
")",
".",
"se... | Show the sign up page with the data from the identity. | [
"Show",
"the",
"sign",
"up",
"page",
"with",
"the",
"data",
"from",
"the",
"identity",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L215-L228 |
125,577 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.doCreateAccount | @RequirePOST
public User doCreateAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
return _doCreateAccount(req, rsp, "signup.jelly");
} | java | @RequirePOST
public User doCreateAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
return _doCreateAccount(req, rsp, "signup.jelly");
} | [
"@",
"RequirePOST",
"public",
"User",
"doCreateAccount",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"return",
"_doCreateAccount",
"(",
"req",
",",
"rsp",
",",
"\"signup.jelly\"",
")",
";... | Creates an user account. Used for self-registration. | [
"Creates",
"an",
"user",
"account",
".",
"Used",
"for",
"self",
"-",
"registration",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L247-L250 |
125,578 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.loginAndTakeBack | @SuppressWarnings("ACL.impersonate")
private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session != null) {
// avoid session fixation
session.invalidate();
... | java | @SuppressWarnings("ACL.impersonate")
private void loginAndTakeBack(StaplerRequest req, StaplerResponse rsp, User u) throws ServletException, IOException {
HttpSession session = req.getSession(false);
if (session != null) {
// avoid session fixation
session.invalidate();
... | [
"@",
"SuppressWarnings",
"(",
"\"ACL.impersonate\"",
")",
"private",
"void",
"loginAndTakeBack",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"User",
"u",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"HttpSession",
"session",
"=",... | Lets the current user silently login as the given user and report back accordingly. | [
"Lets",
"the",
"current",
"user",
"silently",
"login",
"as",
"the",
"given",
"user",
"and",
"report",
"back",
"accordingly",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L269-L287 |
125,579 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.doCreateAccountByAdmin | @RequirePOST
public void doCreateAccountByAdmin(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
createAccountByAdmin(req, rsp, "addUser.jelly", "."); // send the user back to the listing page on success
} | java | @RequirePOST
public void doCreateAccountByAdmin(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
createAccountByAdmin(req, rsp, "addUser.jelly", "."); // send the user back to the listing page on success
} | [
"@",
"RequirePOST",
"public",
"void",
"doCreateAccountByAdmin",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"createAccountByAdmin",
"(",
"req",
",",
"rsp",
",",
"\"addUser.jelly\"",
",",
"\... | Creates a user account. Used by admins.
This version behaves differently from {@link #doCreateAccount(StaplerRequest, StaplerResponse)} in that
this is someone creating another user. | [
"Creates",
"a",
"user",
"account",
".",
"Used",
"by",
"admins",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L295-L298 |
125,580 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.doCreateFirstAccount | @RequirePOST
public void doCreateFirstAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(hasSomeUser()) {
rsp.sendError(SC_UNAUTHORIZED,"First user was already created");
return;
}
User u = createAccount(req, rsp, false, "firstU... | java | @RequirePOST
public void doCreateFirstAccount(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(hasSomeUser()) {
rsp.sendError(SC_UNAUTHORIZED,"First user was already created");
return;
}
User u = createAccount(req, rsp, false, "firstU... | [
"@",
"RequirePOST",
"public",
"void",
"doCreateFirstAccount",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"hasSomeUser",
"(",
")",
")",
"{",
"rsp",
".",
"sendError",
"(",
"... | Creates a first admin user account.
<p>
This can be run by anyone, but only to create the very first user account. | [
"Creates",
"a",
"first",
"admin",
"user",
"account",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L348-L359 |
125,581 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.tryToMakeAdmin | private void tryToMakeAdmin(User u) {
AuthorizationStrategy as = Jenkins.getInstance().getAuthorizationStrategy();
for (PermissionAdder adder : ExtensionList.lookup(PermissionAdder.class)) {
if (adder.add(as, u, Jenkins.ADMINISTER)) {
return;
}
}
} | java | private void tryToMakeAdmin(User u) {
AuthorizationStrategy as = Jenkins.getInstance().getAuthorizationStrategy();
for (PermissionAdder adder : ExtensionList.lookup(PermissionAdder.class)) {
if (adder.add(as, u, Jenkins.ADMINISTER)) {
return;
}
}
} | [
"private",
"void",
"tryToMakeAdmin",
"(",
"User",
"u",
")",
"{",
"AuthorizationStrategy",
"as",
"=",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"getAuthorizationStrategy",
"(",
")",
";",
"for",
"(",
"PermissionAdder",
"adder",
":",
"ExtensionList",
".",
"lo... | Try to make this user a super-user | [
"Try",
"to",
"make",
"this",
"user",
"a",
"super",
"-",
"user"
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L364-L371 |
125,582 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.createAccount | public User createAccount(String userName, String password) throws IOException {
User user = User.getById(userName, true);
user.addProperty(Details.fromPlainPassword(password));
SecurityListener.fireUserCreated(user.getId());
return user;
} | java | public User createAccount(String userName, String password) throws IOException {
User user = User.getById(userName, true);
user.addProperty(Details.fromPlainPassword(password));
SecurityListener.fireUserCreated(user.getId());
return user;
} | [
"public",
"User",
"createAccount",
"(",
"String",
"userName",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"User",
"user",
"=",
"User",
".",
"getById",
"(",
"userName",
",",
"true",
")",
";",
"user",
".",
"addProperty",
"(",
"Details",
"."... | Creates a new user account by registering a password to the user. | [
"Creates",
"a",
"new",
"user",
"account",
"by",
"registering",
"a",
"password",
"to",
"the",
"user",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L507-L512 |
125,583 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.createAccountWithHashedPassword | public User createAccountWithHashedPassword(String userName, String hashedPassword) throws IOException {
if (!PASSWORD_ENCODER.isPasswordHashed(hashedPassword)) {
throw new IllegalArgumentException("this method should only be called with a pre-hashed password");
}
User user = User.ge... | java | public User createAccountWithHashedPassword(String userName, String hashedPassword) throws IOException {
if (!PASSWORD_ENCODER.isPasswordHashed(hashedPassword)) {
throw new IllegalArgumentException("this method should only be called with a pre-hashed password");
}
User user = User.ge... | [
"public",
"User",
"createAccountWithHashedPassword",
"(",
"String",
"userName",
",",
"String",
"hashedPassword",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"PASSWORD_ENCODER",
".",
"isPasswordHashed",
"(",
"hashedPassword",
")",
")",
"{",
"throw",
"new",
"... | Creates a new user account by registering a JBCrypt Hashed password with the user.
@param userName The user's name
@param hashedPassword A hashed password, must begin with <code>#jbcrypt:</code> | [
"Creates",
"a",
"new",
"user",
"account",
"by",
"registering",
"a",
"JBCrypt",
"Hashed",
"password",
"with",
"the",
"user",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L520-L528 |
125,584 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.getAllUsers | public List<User> getAllUsers() {
List<User> r = new ArrayList<User>();
for (User u : User.getAll()) {
if(u.getProperty(Details.class)!=null)
r.add(u);
}
Collections.sort(r);
return r;
} | java | public List<User> getAllUsers() {
List<User> r = new ArrayList<User>();
for (User u : User.getAll()) {
if(u.getProperty(Details.class)!=null)
r.add(u);
}
Collections.sort(r);
return r;
} | [
"public",
"List",
"<",
"User",
">",
"getAllUsers",
"(",
")",
"{",
"List",
"<",
"User",
">",
"r",
"=",
"new",
"ArrayList",
"<",
"User",
">",
"(",
")",
";",
"for",
"(",
"User",
"u",
":",
"User",
".",
"getAll",
"(",
")",
")",
"{",
"if",
"(",
"u"... | All users who can login to the system. | [
"All",
"users",
"who",
"can",
"login",
"to",
"the",
"system",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L554-L562 |
125,585 | jenkinsci/jenkins | core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java | HudsonPrivateSecurityRealm.getUser | @Restricted(NoExternalUse.class)
public User getUser(String id) {
return User.getById(id, User.ALLOW_USER_CREATION_VIA_URL && hasPermission(Jenkins.ADMINISTER));
} | java | @Restricted(NoExternalUse.class)
public User getUser(String id) {
return User.getById(id, User.ALLOW_USER_CREATION_VIA_URL && hasPermission(Jenkins.ADMINISTER));
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"User",
"getUser",
"(",
"String",
"id",
")",
"{",
"return",
"User",
".",
"getById",
"(",
"id",
",",
"User",
".",
"ALLOW_USER_CREATION_VIA_URL",
"&&",
"hasPermission",
"(",
"Jenkins",
".",
... | This is to map users under the security realm URL.
This in turn helps us set up the right navigation breadcrumb. | [
"This",
"is",
"to",
"map",
"users",
"under",
"the",
"security",
"realm",
"URL",
".",
"This",
"in",
"turn",
"helps",
"us",
"set",
"up",
"the",
"right",
"navigation",
"breadcrumb",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L568-L571 |
125,586 | jenkinsci/jenkins | core/src/main/java/hudson/widgets/RenderOnDemandClosure.java | RenderOnDemandClosure.render | @JavaScriptMethod
public HttpResponse render() {
return new HttpResponse() {
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
try {
new DefaultScriptInvoker() {
@O... | java | @JavaScriptMethod
public HttpResponse render() {
return new HttpResponse() {
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
try {
new DefaultScriptInvoker() {
@O... | [
"@",
"JavaScriptMethod",
"public",
"HttpResponse",
"render",
"(",
")",
"{",
"return",
"new",
"HttpResponse",
"(",
")",
"{",
"public",
"void",
"generateResponse",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
",",
"Object",
"node",
")",
"throws",
... | Renders the captured fragment. | [
"Renders",
"the",
"captured",
"fragment",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/widgets/RenderOnDemandClosure.java#L94-L128 |
125,587 | jenkinsci/jenkins | core/src/main/java/hudson/model/queue/WorkUnitContext.java | WorkUnitContext.abort | public synchronized void abort(Throwable cause) {
if (cause==null) throw new IllegalArgumentException();
if (aborted!=null) return; // already aborted
aborted = cause;
startLatch.abort(cause);
endLatch.abort(cause);
Thread c = Thread.currentThread();
... | java | public synchronized void abort(Throwable cause) {
if (cause==null) throw new IllegalArgumentException();
if (aborted!=null) return; // already aborted
aborted = cause;
startLatch.abort(cause);
endLatch.abort(cause);
Thread c = Thread.currentThread();
... | [
"public",
"synchronized",
"void",
"abort",
"(",
"Throwable",
"cause",
")",
"{",
"if",
"(",
"cause",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"aborted",
"!=",
"null",
")",
"return",
";",
"// already aborted "... | When one of the work unit is aborted, call this method to abort all the other work units. | [
"When",
"one",
"of",
"the",
"work",
"unit",
"is",
"aborted",
"call",
"this",
"method",
"to",
"abort",
"all",
"the",
"other",
"work",
"units",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/WorkUnitContext.java#L151-L164 |
125,588 | jenkinsci/jenkins | core/src/main/java/jenkins/util/TreeStringBuilder.java | TreeStringBuilder.intern | public TreeString intern(final String s) {
if (s==null) return null;
return root.intern(s).node;
} | java | public TreeString intern(final String s) {
if (s==null) return null;
return root.intern(s).node;
} | [
"public",
"TreeString",
"intern",
"(",
"final",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"return",
"root",
".",
"intern",
"(",
"s",
")",
".",
"node",
";",
"}"
] | Interns a string. | [
"Interns",
"a",
"string",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/TreeStringBuilder.java#L128-L131 |
125,589 | jenkinsci/jenkins | core/src/main/java/hudson/slaves/Channels.java | Channels.forProcess | public static Channel forProcess(String name, ExecutorService execService, InputStream in, OutputStream out, OutputStream header, final Proc proc) throws IOException {
ChannelBuilder cb = new ChannelBuilder(name,execService) {
@Override
public Channel build(CommandTransport transport) th... | java | public static Channel forProcess(String name, ExecutorService execService, InputStream in, OutputStream out, OutputStream header, final Proc proc) throws IOException {
ChannelBuilder cb = new ChannelBuilder(name,execService) {
@Override
public Channel build(CommandTransport transport) th... | [
"public",
"static",
"Channel",
"forProcess",
"(",
"String",
"name",
",",
"ExecutorService",
"execService",
",",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"OutputStream",
"header",
",",
"final",
"Proc",
"proc",
")",
"throws",
"IOException",
"{",
"Chan... | Creates a channel that wraps a remote process, so that when we shut down the connection
we kill the process. | [
"Creates",
"a",
"channel",
"that",
"wraps",
"a",
"remote",
"process",
"so",
"that",
"when",
"we",
"shut",
"down",
"the",
"connection",
"we",
"kill",
"the",
"process",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/slaves/Channels.java#L75-L117 |
125,590 | jenkinsci/jenkins | core/src/main/java/hudson/model/LargeText.java | LargeText.doProgressText | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!source.exists()) {
// file doesn't exist yet
rsp.addHeader("X-Text-Size","0");
rsp.addHead... | java | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!source.exists()) {
// file doesn't exist yet
rsp.addHeader("X-Text-Size","0");
rsp.addHead... | [
"public",
"void",
"doProgressText",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
"{",
"rsp",
".",
"setContentType",
"(",
"\"text/plain\"",
")",
";",
"rsp",
".",
"setStatus",
"(",
"HttpServletResponse",
".",
"SC_OK",
... | Implements the progressive text handling.
This method is used as a "web method" with progressiveText.jelly. | [
"Implements",
"the",
"progressive",
"text",
"handling",
".",
"This",
"method",
"is",
"used",
"as",
"a",
"web",
"method",
"with",
"progressiveText",
".",
"jelly",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/LargeText.java#L178-L213 |
125,591 | jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/SolarisSMFLifecycle.java | SolarisSMFLifecycle.restart | @Override
public void restart() throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart
try {
if (jenkins != null) {
jenkins.cleanUp();
}
} catch (Exception e) {
... | java | @Override
public void restart() throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart
try {
if (jenkins != null) {
jenkins.cleanUp();
}
} catch (Exception e) {
... | [
"@",
"Override",
"public",
"void",
"restart",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"Jenkins",
"jenkins",
"=",
"Jenkins",
".",
"getInstanceOrNull",
"(",
")",
";",
"// guard against repeated concurrent calls to restart",
"try",
"{",
"if",... | In SMF managed environment, just commit a suicide and the service will be restarted by SMF. | [
"In",
"SMF",
"managed",
"environment",
"just",
"commit",
"a",
"suicide",
"and",
"the",
"service",
"will",
"be",
"restarted",
"by",
"SMF",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/SolarisSMFLifecycle.java#L41-L52 |
125,592 | jenkinsci/jenkins | core/src/main/java/hudson/tools/PropertyDescriptor.java | PropertyDescriptor.isApplicable | public boolean isApplicable(Class<? extends T> targetType) {
Class<? extends T> applicable = Functions.getTypeParameter(clazz,getP(),0);
return applicable.isAssignableFrom(targetType);
} | java | public boolean isApplicable(Class<? extends T> targetType) {
Class<? extends T> applicable = Functions.getTypeParameter(clazz,getP(),0);
return applicable.isAssignableFrom(targetType);
} | [
"public",
"boolean",
"isApplicable",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"targetType",
")",
"{",
"Class",
"<",
"?",
"extends",
"T",
">",
"applicable",
"=",
"Functions",
".",
"getTypeParameter",
"(",
"clazz",
",",
"getP",
"(",
")",
",",
"0",
")... | Returns true if this property type is applicable to the
given target type.
<p>
The default implementation of this method checks if the given node type is assignable
according to the parameterization, but subtypes can extend this to change this behavior.
@return
true to indicate applicable, in which case the property ... | [
"Returns",
"true",
"if",
"this",
"property",
"type",
"is",
"applicable",
"to",
"the",
"given",
"target",
"type",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tools/PropertyDescriptor.java#L47-L50 |
125,593 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getLogDir | protected @Nonnull File getLogDir() {
File dir = new File(Jenkins.getInstance().getRootDir(),"logs/slaves/"+nodeName);
if (!dir.exists() && !dir.mkdirs()) {
LOGGER.severe("Failed to create agent log directory " + dir.getAbsolutePath());
}
return dir;
} | java | protected @Nonnull File getLogDir() {
File dir = new File(Jenkins.getInstance().getRootDir(),"logs/slaves/"+nodeName);
if (!dir.exists() && !dir.mkdirs()) {
LOGGER.severe("Failed to create agent log directory " + dir.getAbsolutePath());
}
return dir;
} | [
"protected",
"@",
"Nonnull",
"File",
"getLogDir",
"(",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"getRootDir",
"(",
")",
",",
"\"logs/slaves/\"",
"+",
"nodeName",
")",
";",
"if",
"(",
"!",
"dir",
... | Directory where rotated agent logs are stored.
The method also creates a log directory if required.
@since 1.613 | [
"Directory",
"where",
"rotated",
"agent",
"logs",
"are",
"stored",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L302-L308 |
125,594 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getDisplayExecutors | @Restricted(NoExternalUse.class)
public List<DisplayExecutor> getDisplayExecutors() {
// The size may change while we are populating, but let's start with a reasonable guess to minimize resizing
List<DisplayExecutor> result = new ArrayList<>(executors.size() + oneOffExecutors.size());
int in... | java | @Restricted(NoExternalUse.class)
public List<DisplayExecutor> getDisplayExecutors() {
// The size may change while we are populating, but let's start with a reasonable guess to minimize resizing
List<DisplayExecutor> result = new ArrayList<>(executors.size() + oneOffExecutors.size());
int in... | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"List",
"<",
"DisplayExecutor",
">",
"getDisplayExecutors",
"(",
")",
"{",
"// The size may change while we are populating, but let's start with a reasonable guess to minimize resizing",
"List",
"<",
"Display... | Used to render the list of executors.
@return a snapshot of the executor display information
@since 1.607 | [
"Used",
"to",
"render",
"the",
"list",
"of",
"executors",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L997-L1016 |
125,595 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.isIdle | @Exported
public final boolean isIdle() {
if (!oneOffExecutors.isEmpty())
return false;
for (Executor e : executors)
if(!e.isIdle())
return false;
return true;
} | java | @Exported
public final boolean isIdle() {
if (!oneOffExecutors.isEmpty())
return false;
for (Executor e : executors)
if(!e.isIdle())
return false;
return true;
} | [
"@",
"Exported",
"public",
"final",
"boolean",
"isIdle",
"(",
")",
"{",
"if",
"(",
"!",
"oneOffExecutors",
".",
"isEmpty",
"(",
")",
")",
"return",
"false",
";",
"for",
"(",
"Executor",
"e",
":",
"executors",
")",
"if",
"(",
"!",
"e",
".",
"isIdle",
... | Returns true if all the executors of this computer are idle. | [
"Returns",
"true",
"if",
"all",
"the",
"executors",
"of",
"this",
"computer",
"are",
"idle",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L1021-L1029 |
125,596 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getIdleStartMilliseconds | public final long getIdleStartMilliseconds() {
long firstIdle = Long.MIN_VALUE;
for (Executor e : oneOffExecutors) {
firstIdle = Math.max(firstIdle, e.getIdleStartMilliseconds());
}
for (Executor e : executors) {
firstIdle = Math.max(firstIdle, e.getIdleStartMilli... | java | public final long getIdleStartMilliseconds() {
long firstIdle = Long.MIN_VALUE;
for (Executor e : oneOffExecutors) {
firstIdle = Math.max(firstIdle, e.getIdleStartMilliseconds());
}
for (Executor e : executors) {
firstIdle = Math.max(firstIdle, e.getIdleStartMilli... | [
"public",
"final",
"long",
"getIdleStartMilliseconds",
"(",
")",
"{",
"long",
"firstIdle",
"=",
"Long",
".",
"MIN_VALUE",
";",
"for",
"(",
"Executor",
"e",
":",
"oneOffExecutors",
")",
"{",
"firstIdle",
"=",
"Math",
".",
"max",
"(",
"firstIdle",
",",
"e",
... | Returns the time when this computer last became idle.
<p>
If this computer is already idle, the return value will point to the
time in the past since when this computer has been idle.
<p>
If this computer is busy, the return value will point to the
time in the future where this computer will be expected to become fre... | [
"Returns",
"the",
"time",
"when",
"this",
"computer",
"last",
"became",
"idle",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L1052-L1061 |
125,597 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getDemandStartMilliseconds | public final long getDemandStartMilliseconds() {
long firstDemand = Long.MAX_VALUE;
for (Queue.BuildableItem item : Jenkins.getInstance().getQueue().getBuildableItems(this)) {
firstDemand = Math.min(item.buildableStartMilliseconds, firstDemand);
}
return firstDemand;
} | java | public final long getDemandStartMilliseconds() {
long firstDemand = Long.MAX_VALUE;
for (Queue.BuildableItem item : Jenkins.getInstance().getQueue().getBuildableItems(this)) {
firstDemand = Math.min(item.buildableStartMilliseconds, firstDemand);
}
return firstDemand;
} | [
"public",
"final",
"long",
"getDemandStartMilliseconds",
"(",
")",
"{",
"long",
"firstDemand",
"=",
"Long",
".",
"MAX_VALUE",
";",
"for",
"(",
"Queue",
".",
"BuildableItem",
"item",
":",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"getQueue",
"(",
")",
"... | Returns the time when this computer first became in demand. | [
"Returns",
"the",
"time",
"when",
"this",
"computer",
"first",
"became",
"in",
"demand",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L1066-L1072 |
125,598 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getMonitorData | @Exported(inline=true)
public Map<String/*monitor name*/,Object> getMonitorData() {
Map<String,Object> r = new HashMap<>();
if (hasPermission(CONNECT)) {
for (NodeMonitor monitor : NodeMonitor.getAll())
r.put(monitor.getClass().getName(), monitor.data(this));
}
... | java | @Exported(inline=true)
public Map<String/*monitor name*/,Object> getMonitorData() {
Map<String,Object> r = new HashMap<>();
if (hasPermission(CONNECT)) {
for (NodeMonitor monitor : NodeMonitor.getAll())
r.put(monitor.getClass().getName(), monitor.data(this));
}
... | [
"@",
"Exported",
"(",
"inline",
"=",
"true",
")",
"public",
"Map",
"<",
"String",
"/*monitor name*/",
",",
"Object",
">",
"getMonitorData",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"r",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if"... | Expose monitoring data for the remote API. | [
"Expose",
"monitoring",
"data",
"for",
"the",
"remote",
"API",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L1153-L1161 |
125,599 | jenkinsci/jenkins | core/src/main/java/hudson/model/Computer.java | Computer.getHostName | public String getHostName() throws IOException, InterruptedException {
if(hostNameCached)
// in the worst case we end up having multiple threads computing the host name simultaneously, but that's not harmful, just wasteful.
return cachedHostName;
VirtualChannel channel = getChan... | java | public String getHostName() throws IOException, InterruptedException {
if(hostNameCached)
// in the worst case we end up having multiple threads computing the host name simultaneously, but that's not harmful, just wasteful.
return cachedHostName;
VirtualChannel channel = getChan... | [
"public",
"String",
"getHostName",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"hostNameCached",
")",
"// in the worst case we end up having multiple threads computing the host name simultaneously, but that's not harmful, just wasteful.",
"return",
... | This method tries to compute the name of the host that's reachable by all the other nodes.
<p>
Since it's possible that the agent is not reachable from the master (it may be behind a firewall,
connecting to master via inbound protocol), this method may return null.
It's surprisingly tricky for a machine to know a nam... | [
"This",
"method",
"tries",
"to",
"compute",
"the",
"name",
"of",
"the",
"host",
"that",
"s",
"reachable",
"by",
"all",
"the",
"other",
"nodes",
"."
] | 44c4d3989232082c254d27ae360aa810669f44b7 | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L1263-L1298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.