mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-23 00:35:30 +00:00
s/javax.annotation.Nonnull/edu.umd.cs.findbugs.annotations.NonNull/g
This commit is contained in:
1 parent
928d40fea8
commit
819f80b12f
266 files changed
+1548
-1548
No files matched your search
@@ -108,7 +108,7 @@ import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import edu.umd.cs.findbugs.annotations.Nullable;
|
||||
import jenkins.FilePathFilter;
|
||||
import jenkins.MasterToSlaveFileCallable;
|
||||
@@ -256,7 +256,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* To create a path that represents a remote path, pass in a {@link Channel}
|
||||
* that's connected to that machine. If {@code null}, that means the local file path.
|
||||
*/
|
||||
public FilePath(@CheckForNull VirtualChannel channel, @Nonnull String remote) {
|
||||
public FilePath(@CheckForNull VirtualChannel channel, @NonNull String remote) {
|
||||
this.channel = channel instanceof LocalChannel ? null : channel;
|
||||
this.remote = normalize(remote);
|
||||
}
|
||||
@@ -268,7 +268,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* A "local" path means a file path on the computer where the
|
||||
* constructor invocation happened.
|
||||
*/
|
||||
public FilePath(@Nonnull File localPath) {
|
||||
public FilePath(@NonNull File localPath) {
|
||||
this.channel = null;
|
||||
this.remote = normalize(localPath.getPath());
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* @param base starting point for resolution, and defines channel
|
||||
* @param rel a path which if relative will be resolved against base
|
||||
*/
|
||||
public FilePath(@Nonnull FilePath base, @Nonnull String rel) {
|
||||
public FilePath(@NonNull FilePath base, @NonNull String rel) {
|
||||
this.channel = base.channel;
|
||||
this.remote = normalize(resolvePathIfRelative(base, rel));
|
||||
}
|
||||
@@ -288,7 +288,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return this;
|
||||
}
|
||||
|
||||
private String resolvePathIfRelative(@Nonnull FilePath base, @Nonnull String rel) {
|
||||
private String resolvePathIfRelative(@NonNull FilePath base, @NonNull String rel) {
|
||||
if(isAbsolute(rel)) return rel;
|
||||
if(base.isUnix()) {
|
||||
// shouldn't need this replace, but better safe than sorry
|
||||
@@ -303,7 +303,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
/**
|
||||
* Is the given path name an absolute path?
|
||||
*/
|
||||
private static boolean isAbsolute(@Nonnull String rel) {
|
||||
private static boolean isAbsolute(@NonNull String rel) {
|
||||
return rel.startsWith("/") || DRIVE_PATTERN.matcher(rel).matches() || UNC_PATTERN.matcher(rel).matches();
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* so remove them.
|
||||
*/
|
||||
@Restricted(NoExternalUse.class)
|
||||
public static String normalize(@Nonnull String path) {
|
||||
public static String normalize(@NonNull String path) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
// Check for prefix designating absolute path
|
||||
Matcher m = ABSOLUTE_PREFIX_PATTERN.matcher(path);
|
||||
@@ -843,14 +843,14 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* was considered up to date.
|
||||
* @since 1.299
|
||||
*/
|
||||
public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskListener listener, @Nonnull String message) throws IOException, InterruptedException {
|
||||
public boolean installIfNecessaryFrom(@NonNull URL archive, @CheckForNull TaskListener listener, @NonNull String message) throws IOException, InterruptedException {
|
||||
if (listener == null) {
|
||||
listener = TaskListener.NULL;
|
||||
}
|
||||
return installIfNecessaryFrom(archive, listener, message, MAX_REDIRECTS);
|
||||
}
|
||||
|
||||
private boolean installIfNecessaryFrom(@Nonnull URL archive, @Nonnull TaskListener listener, @Nonnull String message, int maxRedirects) throws InterruptedException, IOException {
|
||||
private boolean installIfNecessaryFrom(@NonNull URL archive, @NonNull TaskListener listener, @NonNull String message, int maxRedirects) throws InterruptedException, IOException {
|
||||
try {
|
||||
FilePath timestamp = this.child(".timestamp");
|
||||
long lastModified = timestamp.lastModified();
|
||||
@@ -1342,7 +1342,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* @param relOrAbsolute a relative or absolute path
|
||||
* @return a file on the same channel
|
||||
*/
|
||||
public @Nonnull FilePath child(String relOrAbsolute) {
|
||||
public @NonNull FilePath child(String relOrAbsolute) {
|
||||
return new FilePath(this,relOrAbsolute);
|
||||
}
|
||||
|
||||
@@ -1793,7 +1793,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* <p>
|
||||
* This method returns direct children of the directory denoted by the 'this' object.
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public List<FilePath> list() throws IOException, InterruptedException {
|
||||
return list((FileFilter)null);
|
||||
}
|
||||
@@ -1803,7 +1803,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
*
|
||||
* @return can be empty but never null. Doesn't contain "." and ".."
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public List<FilePath> listDirectories() throws IOException, InterruptedException {
|
||||
return list(new DirectoryFilter());
|
||||
}
|
||||
@@ -1824,7 +1824,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* If this {@link FilePath} represents a remote path,
|
||||
* the filter object will be executed on the remote machine.
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public List<FilePath> list(final FileFilter filter) throws IOException, InterruptedException {
|
||||
if (filter != null && !(filter instanceof Serializable)) {
|
||||
throw new IllegalArgumentException("Non-serializable filter of " + filter.getClass());
|
||||
@@ -1860,7 +1860,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* @return
|
||||
* can be empty but always non-null.
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public FilePath[] list(final String includes) throws IOException, InterruptedException {
|
||||
return list(includes, null);
|
||||
}
|
||||
@@ -1875,7 +1875,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* can be empty but always non-null.
|
||||
* @since 1.407
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public FilePath[] list(final String includes, final String excludes) throws IOException, InterruptedException {
|
||||
return list(includes, excludes, true);
|
||||
}
|
||||
@@ -1891,7 +1891,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* can be empty but always non-null.
|
||||
* @since 1.465
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public FilePath[] list(final String includes, final String excludes, final boolean defaultExcludes) throws IOException, InterruptedException {
|
||||
return act(new ListGlob(includes, excludes, defaultExcludes));
|
||||
}
|
||||
@@ -1923,7 +1923,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* @return
|
||||
* A set of relative file names from the base directory.
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
private static String[] glob(File dir, String includes, String excludes, boolean defaultExcludes) throws IOException {
|
||||
if(isAbsolute(includes))
|
||||
throw new IOException("Expecting Ant GLOB pattern, but saw '"+includes+"'. See http://ant.apache.org/manual/Types/fileset.html for syntax");
|
||||
@@ -2363,7 +2363,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* @return the number of files copied
|
||||
* @since 2.196
|
||||
*/
|
||||
public int copyRecursiveTo(final DirScanner scanner, final FilePath target, final String description, @Nonnull TarCompression compression) throws IOException, InterruptedException {
|
||||
public int copyRecursiveTo(final DirScanner scanner, final FilePath target, final String description, @NonNull TarCompression compression) throws IOException, InterruptedException {
|
||||
if(this.channel==target.channel) {
|
||||
// local to local copy.
|
||||
return act(new CopyRecursiveLocal(target, scanner));
|
||||
@@ -2490,7 +2490,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
private final String description;
|
||||
private final TarCompression compression;
|
||||
|
||||
ReadToTar(Pipe pipe, String description, @Nonnull TarCompression compression) {
|
||||
ReadToTar(Pipe pipe, String description, @NonNull TarCompression compression) {
|
||||
this.pipe = pipe;
|
||||
this.description = description;
|
||||
this.compression = compression;
|
||||
@@ -2508,7 +2508,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
private final DirScanner scanner;
|
||||
private final Pipe pipe;
|
||||
private final TarCompression compression;
|
||||
WriteToTar(DirScanner scanner, Pipe pipe, @Nonnull TarCompression compression) {
|
||||
WriteToTar(DirScanner scanner, Pipe pipe, @NonNull TarCompression compression) {
|
||||
this.scanner = scanner;
|
||||
this.pipe = pipe;
|
||||
this.compression = compression;
|
||||
@@ -2524,7 +2524,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
private final Pipe pipe;
|
||||
private final DirScanner scanner;
|
||||
private final TarCompression compression;
|
||||
CopyRecursiveRemoteToLocal(Pipe pipe, DirScanner scanner, @Nonnull TarCompression compression) {
|
||||
CopyRecursiveRemoteToLocal(Pipe pipe, DirScanner scanner, @NonNull TarCompression compression) {
|
||||
this.pipe = pipe;
|
||||
this.scanner = scanner;
|
||||
this.compression = compression;
|
||||
@@ -2629,7 +2629,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
|
||||
private static final class IsUnix extends MasterToSlaveCallable<Boolean,IOException> {
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public Boolean call() throws IOException {
|
||||
return File.pathSeparatorChar==':';
|
||||
}
|
||||
@@ -3165,10 +3165,10 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
/**
|
||||
* Channel to the current instance.
|
||||
*/
|
||||
@Nonnull
|
||||
@NonNull
|
||||
public static final LocalChannel localChannel = new LocalChannel(threadPoolForRemoting);
|
||||
|
||||
private @Nonnull SoloFilePathFilter filterNonNull() {
|
||||
private @NonNull SoloFilePathFilter filterNonNull() {
|
||||
return filter!=null ? filter : UNRESTRICTED;
|
||||
}
|
||||
|
||||
@@ -3275,7 +3275,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
* TODO un-restrict it in a weekly after the patch
|
||||
*/
|
||||
@Restricted(NoExternalUse.class)
|
||||
public boolean isDescendant(@Nonnull String potentialChildRelativePath) throws IOException, InterruptedException {
|
||||
public boolean isDescendant(@NonNull String potentialChildRelativePath) throws IOException, InterruptedException {
|
||||
return act(new IsDescendant(potentialChildRelativePath));
|
||||
}
|
||||
|
||||
@@ -3283,12 +3283,12 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String potentialChildRelativePath;
|
||||
|
||||
private IsDescendant(@Nonnull String potentialChildRelativePath){
|
||||
private IsDescendant(@NonNull String potentialChildRelativePath){
|
||||
this.potentialChildRelativePath = potentialChildRelativePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean invoke(@Nonnull File parentFile, @Nonnull VirtualChannel channel) throws IOException, InterruptedException {
|
||||
public Boolean invoke(@NonNull File parentFile, @NonNull VirtualChannel channel) throws IOException, InterruptedException {
|
||||
if (new File(potentialChildRelativePath).isAbsolute()) {
|
||||
throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath);
|
||||
}
|
||||
@@ -3363,7 +3363,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
return current;
|
||||
}
|
||||
|
||||
private @Nonnull Path windowsToRealPath(@Nonnull Path path) throws IOException {
|
||||
private @NonNull Path windowsToRealPath(@NonNull Path path) throws IOException {
|
||||
try {
|
||||
return path.toRealPath();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user