diff options
18 files changed, 24 insertions, 26 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java index f9c623d8b7..08fec341a8 100644 --- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java +++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java @@ -13,6 +13,7 @@ import static org.eclipse.jgit.util.HttpSupport.ENCODING_GZIP; import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT; import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT_ENCODING; import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE; +import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME; import java.io.IOException; import java.net.ProxySelector; @@ -128,8 +129,7 @@ public class LfsConnectionFactory { // This could be done better (more precise logic), but according // to https://github.com/git-lfs/git-lfs/issues/1759 git-lfs // generally only supports 'origin' in an integrated workflow. - if (lfsUrl == null && (remote.equals( - org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME))) { + if (lfsUrl == null && remote.equals(DEFAULT_REMOTE_NAME)) { remoteUrl = config.getString( ConfigConstants.CONFIG_KEY_REMOTE, remote, ConfigConstants.CONFIG_KEY_URL); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index d059eff5d7..8df9bad740 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -355,8 +355,7 @@ public class Main { continue; } - final URL u = new URL( - (!s.contains("://")) ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ + URL u = new URL(!s.contains("://") ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$ if (!u.getProtocol().startsWith("http")) //$NON-NLS-1$ throw new MalformedURLException(MessageFormat.format( CLIText.get().invalidHttpProxyOnlyHttpSupported, s)); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index 1ef39a1a7d..c96e475613 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -226,7 +226,7 @@ class Status extends TextBuiltin { firstHeader = false; } int nbUntracked = untracked.size(); - if (nbUntracked > 0 && ("all".equals(untrackedFilesMode))) { //$NON-NLS-1$ + if (nbUntracked > 0 && "all".equals(untrackedFilesMode)) { //$NON-NLS-1$ if (!firstHeader) printSectionHeader(""); //$NON-NLS-1$ printSectionHeader(CLIText.get().untrackedFiles); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index 3b3baf5a12..483b9602da 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -614,7 +614,7 @@ public class CommitCommand extends GitCommand<RevCommit> { // specified the commit should not be empty. This behaviour differs // from native git but can only be adapted in the next release. // TODO(ch) align the defaults with native git - allowEmpty = (only.isEmpty()) ? Boolean.TRUE : Boolean.FALSE; + allowEmpty = only.isEmpty() ? Boolean.TRUE : Boolean.FALSE; // when doing a merge commit parse MERGE_HEAD and MERGE_MSG files if (state == RepositoryState.MERGING_RESOLVED diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java index f63cc6d644..3ce97a4ff7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/BareSuperprojectWriter.java @@ -107,7 +107,7 @@ class BareSuperprojectWriter { PersonIdent author, RemoteReader callback, BareWriterConfig config, List<ExtraContent> extraContents) { - assert (repo.isBare()); + assert repo.isBare(); this.repo = repo; this.targetUri = targetUri; this.targetBranch = targetBranch; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RegularSuperprojectWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RegularSuperprojectWriter.java index afab9943a7..7632b367c1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RegularSuperprojectWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RegularSuperprojectWriter.java @@ -64,8 +64,8 @@ class RegularSuperprojectWriter { private void addSubmodule(String name, String url, String path, String revision, List<CopyFile> copyfiles, List<LinkFile> linkfiles, Git git) throws GitAPIException, IOException { - assert (!repo.isBare()); - assert (git != null); + assert !repo.isBare(); + assert git != null; if (!linkfiles.isEmpty()) { throw new UnsupportedOperationException( JGitText.get().nonBareLinkFilesNotSupported); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java index 28f6250a22..b1da1cb159 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackDirectory.java @@ -359,7 +359,7 @@ class PackDirectory { } boolean searchPacksAgain(PackList old) { - return ((!trustFolderStat) || old.snapshot.isModified(directory)) + return (!trustFolderStat || old.snapshot.isModified(directory)) && old != scanPacks(old); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java index 860ebaefc2..4563c9039c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV1.java @@ -138,7 +138,7 @@ class PackIndexV1 extends PackIndex { int b1 = data[pos - 3] & 0xff; int b2 = data[pos - 2] & 0xff; int b3 = data[pos - 1] & 0xff; - return (((long) b0) << 24) | (b1 << 16) | (b2 << 8) | (b3); + return (((long) b0) << 24) | (b1 << 16) | (b2 << 8) | b3; } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java index e3c0fc94aa..c70f2e4914 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/BlockWriter.java @@ -92,7 +92,7 @@ class BlockWriter { } } - int cnt = (int) (Math.ceil(blockLimitBytes / avgBytesPerEntry)); + int cnt = (int) Math.ceil(blockLimitBytes / avgBytesPerEntry); return Math.min(cnt, 4096); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/PatchApplier.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/PatchApplier.java index 7cfc162d77..6c61cdf2bb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/PatchApplier.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/PatchApplier.java @@ -349,7 +349,7 @@ public class PatchApplier { } private File getFile(String path) { - return (inCore()) ? null : new File(repo.getWorkTree(), path); + return inCore() ? null : new File(repo.getWorkTree(), path); } /* returns null if the path is not found. */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java index 7d5836ece2..becc8082ba 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/submodule/SubmoduleWalk.java @@ -540,7 +540,7 @@ public class SubmoduleWalk implements AutoCloseable { } File modulesFile = new File(repository.getWorkTree(), Constants.DOT_GIT_MODULES); - return (modulesFile.exists()); + return modulesFile.exists(); } private void lazyLoadModulesConfig() throws IOException, ConfigInvalidException { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index 3db0421d69..c2d8c1b73f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -140,7 +140,7 @@ abstract class HttpAuthMethod { valuePart[0].toUpperCase(Locale.ROOT)); if ((ignoreTypes != null) - && (ignoreTypes.contains(methodType))) { + && ignoreTypes.contains(methodType)) { continue; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java index dc82f46197..73eddb8e21 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpConfig.java @@ -101,7 +101,7 @@ public class HttpConfig { private static final int DEFAULT_MAX_REDIRECTS = 5; - private static final int MAX_REDIRECTS = (new Supplier<Integer>() { + private static final int MAX_REDIRECTS = new Supplier<Integer>() { @Override public Integer get() { @@ -119,7 +119,7 @@ public class HttpConfig { } return value; } - }).get().intValue(); + }.get().intValue(); private static final String ENV_HTTP_USER_AGENT = "GIT_HTTP_USER_AGENT"; //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index a2273b21be..0fc9710ecb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -160,7 +160,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport { String commandFor(String exe) { String path = uri.getPath(); if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$ - path = (uri.getPath().substring(1)); + path = uri.getPath().substring(1); final StringBuilder cmd = new StringBuilder(); cmd.append(exe); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java index e0a8af1800..1cad8cde66 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java @@ -1514,7 +1514,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { } return filterCommand.replaceAll("%f", //$NON-NLS-1$ Matcher.quoteReplacement( - QuotedString.BOURNE.quote((getPathString())))); + QuotedString.BOURNE.quote(getPathString()))); } /** @@ -1564,7 +1564,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { } return filterCommand.replaceAll("%f", //$NON-NLS-1$ Matcher.quoteReplacement( - QuotedString.BOURNE.quote((getPathString())))); + QuotedString.BOURNE.quote(getPathString()))); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java index 6f31847996..d91f37b51a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java @@ -374,8 +374,8 @@ public class FS_POSIX extends FS { link = Files.createLink( Paths.get(lock.getAbsolutePath() + ".lnk"), //$NON-NLS-1$ lockPath); - Integer nlink = (Integer) (Files.getAttribute(lockPath, - "unix:nlink")); //$NON-NLS-1$ + Integer nlink = (Integer) Files.getAttribute(lockPath, + "unix:nlink"); //$NON-NLS-1$ if (nlink > 2) { LOG.warn(MessageFormat.format( JGitText.get().failedAtomicFileCreation, lockPath, @@ -447,8 +447,7 @@ public class FS_POSIX extends FS { return token(true, null); } link = Files.createLink(Paths.get(uniqueLinkPath(file)), path); - Integer nlink = (Integer) (Files.getAttribute(path, - "unix:nlink")); //$NON-NLS-1$ + Integer nlink = (Integer) Files.getAttribute(path, "unix:nlink"); //$NON-NLS-1$ if (nlink.intValue() > 2) { LOG.warn(MessageFormat.format( JGitText.get().failedAtomicFileCreation, path, nlink)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GSSManagerFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GSSManagerFactory.java index be56e5ecf5..ba0df932ce 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GSSManagerFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GSSManagerFactory.java @@ -28,7 +28,7 @@ public abstract class GSSManagerFactory { * @return detected GSSManager factory */ public static GSSManagerFactory detect() { - return (SunGSSManagerFactory.isSupported()) ? new SunGSSManagerFactory() + return SunGSSManagerFactory.isSupported() ? new SunGSSManagerFactory() : new DefaultGSSManagerFactory(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1Java.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1Java.java index 213ee97531..33e6875883 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1Java.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1Java.java @@ -407,7 +407,7 @@ class SHA1Java extends SHA1 { private static int s1(int a, int b, int c, int d, int w_t) { return rotateLeft(a, 5) // f: 0 <= t <= 19 - + ((b & c) | ((~b) & d)) + + ((b & c) | (~b & d)) + 0x5A827999 + w_t; } |