Browse Source

Enable and fix 'Should be tagged with @Override' warning

Set missingOverrideAnnotation=warning in Eclipse compiler preferences
which enables the warning:

  The method <method> of type <type> should be tagged with @Override
  since it actually overrides a superclass method

Justification for this warning is described in:

  http://stackoverflow.com/a/94411/381622

Enabling this causes in excess of 1000 warnings across the entire
code-base. They are very easy to fix automatically with Eclipse's
"Quick Fix" tool.

Fix all of them except 2 which cause compilation failure when the
project is built with mvn; add TODO comments on those for further
investigation.

Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.7
David Pursehouse 8 years ago
parent
commit
7ac182f4e4
  1. 2
      org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
  2. 2
      org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
  3. 2
      org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
  4. 2
      org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
  5. 27
      org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
  6. 2
      org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java
  7. 5
      org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java
  8. 2
      org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
  9. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java
  10. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java
  11. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java
  12. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
  13. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java
  14. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java
  15. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
  16. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java
  17. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java
  18. 4
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java
  19. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java
  20. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
  21. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java
  22. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java
  23. 6
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java
  24. 3
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java
  25. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java
  26. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
  27. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java
  28. 7
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java
  29. 1
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java
  30. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java
  31. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
  32. 2
      org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
  33. 3
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
  34. 1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
  35. 1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
  36. 1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
  37. 1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java
  38. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java
  39. 4
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java
  40. 4
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
  41. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
  42. 4
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/MeasurePackSizeTest.java
  43. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java
  44. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java
  45. 1
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java
  46. 5
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
  47. 2
      org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
  48. 1
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java
  49. 1
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
  50. 2
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java
  51. 6
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java
  52. 14
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java
  53. 1
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java
  54. 2
      org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
  55. 2
      org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
  56. 2
      org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
  57. 2
      org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
  58. 2
      org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
  59. 1
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
  60. 3
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
  61. 2
      org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
  62. 1
      org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java
  63. 1
      org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java
  64. 1
      org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java
  65. 2
      org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
  66. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
  67. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  68. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java
  69. 4
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
  70. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java
  71. 3
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
  72. 2
      org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
  73. 7
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
  74. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
  75. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
  76. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
  77. 14
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
  78. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
  79. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java
  80. 9
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java
  81. 40
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
  82. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java
  83. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java
  84. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java
  85. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java
  86. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java
  87. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
  88. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/events/ConfigChangeEventTest.java
  89. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
  90. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java
  91. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java
  92. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java
  93. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
  94. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java
  95. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
  96. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java
  97. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackIndexTestCase.java
  98. 1
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexTest.java
  99. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
  100. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java
  101. Some files were not shown because too many files have changed in this diff Show More

2
org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

27
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java

@ -223,15 +223,18 @@ public class HttpClientConnection implements HttpConnection {
this.proxy = proxy;
}
@Override
public int getResponseCode() throws IOException {
execute();
return resp.getStatusLine().getStatusCode();
}
@Override
public URL getURL() {
return url;
}
@Override
public String getResponseMessage() throws IOException {
execute();
return resp.getStatusLine().getReasonPhrase();
@ -259,6 +262,7 @@ public class HttpClientConnection implements HttpConnection {
}
}
@Override
public Map<String, List<String>> getHeaderFields() {
Map<String, List<String>> ret = new HashMap<String, List<String>>();
for (Header hdr : resp.getAllHeaders()) {
@ -270,10 +274,12 @@ public class HttpClientConnection implements HttpConnection {
return ret;
}
@Override
public void setRequestProperty(String name, String value) {
req.addHeader(name, value);
}
@Override
public void setRequestMethod(String method) throws ProtocolException {
this.method = method;
if (METHOD_GET.equalsIgnoreCase(method)) {
@ -290,18 +296,22 @@ public class HttpClientConnection implements HttpConnection {
}
}
@Override
public void setUseCaches(boolean usecaches) {
// not needed
}
@Override
public void setConnectTimeout(int timeout) {
this.timeout = Integer.valueOf(timeout);
}
@Override
public void setReadTimeout(int readTimeout) {
this.readTimeout = Integer.valueOf(readTimeout);
}
@Override
public String getContentType() {
HttpEntity responseEntity = resp.getEntity();
if (responseEntity != null) {
@ -312,16 +322,19 @@ public class HttpClientConnection implements HttpConnection {
return null;
}
@Override
public InputStream getInputStream() throws IOException {
return resp.getEntity().getContent();
}
// will return only the first field
@Override
public String getHeaderField(String name) {
Header header = resp.getFirstHeader(name);
return (header == null) ? null : header.getValue();
}
@Override
public int getContentLength() {
Header contentLength = resp.getFirstHeader("content-length"); //$NON-NLS-1$
if (contentLength == null) {
@ -336,14 +349,17 @@ public class HttpClientConnection implements HttpConnection {
}
}
@Override
public void setInstanceFollowRedirects(boolean followRedirects) {
this.followRedirects = Boolean.valueOf(followRedirects);
}
@Override
public void setDoOutput(boolean dooutput) {
// TODO: check whether we can really ignore this.
}
@Override
public void setFixedLengthStreamingMode(int contentLength) {
if (entity != null)
throw new IllegalArgumentException();
@ -351,52 +367,63 @@ public class HttpClientConnection implements HttpConnection {
entity.setContentLength(contentLength);
}
@Override
public OutputStream getOutputStream() throws IOException {
if (entity == null)
entity = new TemporaryBufferEntity(new LocalFile(null));
return entity.getBuffer();
}
@Override
public void setChunkedStreamingMode(int chunklen) {
if (entity == null)
entity = new TemporaryBufferEntity(new LocalFile(null));
entity.setChunked(true);
}
@Override
public String getRequestMethod() {
return method;
}
@Override
public boolean usingProxy() {
return isUsingProxy;
}
@Override
public void connect() throws IOException {
execute();
}
@Override
public void setHostnameVerifier(final HostnameVerifier hostnameverifier) {
this.hostnameverifier = new X509HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return hostnameverifier.verify(hostname, session);
}
@Override
public void verify(String host, String[] cns, String[] subjectAlts)
throws SSLException {
throw new UnsupportedOperationException(); // TODO message
}
@Override
public void verify(String host, X509Certificate cert)
throws SSLException {
throw new UnsupportedOperationException(); // TODO message
}
@Override
public void verify(String host, SSLSocket ssl) throws IOException {
hostnameverifier.verify(host, ssl.getSession());
}
};
}
@Override
public void configure(KeyManager[] km, TrustManager[] tm,
SecureRandom random) throws KeyManagementException {
getSSLContext().init(km, tm, random);

2
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java

@ -55,10 +55,12 @@ import org.eclipse.jgit.transport.http.HttpConnectionFactory;
* @since 3.3
*/
public class HttpClientConnectionFactory implements HttpConnectionFactory {
@Override
public HttpConnection create(URL url) throws IOException {
return new HttpClientConnection(url.toString());
}
@Override
public HttpConnection create(URL url, Proxy proxy)
throws IOException {
return new HttpClientConnection(url.toString(), proxy);

5
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java

@ -78,25 +78,30 @@ public class TemporaryBufferEntity extends AbstractHttpEntity
return buffer;
}
@Override
public boolean isRepeatable() {
return true;
}
@Override
public long getContentLength() {
if (contentLength != null)
return contentLength.intValue();
return buffer.length();
}
@Override
public InputStream getContent() throws IOException, IllegalStateException {
return buffer.openInputStream();
}
@Override
public void writeTo(OutputStream outstream) throws IOException {
// TODO: dont we need a progressmonitor
buffer.writeTo(outstream, null);
}
@Override
public boolean isStreaming() {
return false;
}

2
org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/AsIsFileFilter.java

@ -70,14 +70,17 @@ class AsIsFileFilter implements Filter {
this.asIs = getAnyFile;
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java

@ -174,18 +174,22 @@ public class GitServlet extends MetaServlet {
@Override
public void init(final ServletConfig config) throws ServletException {
gitFilter.init(new FilterConfig() {
@Override
public String getFilterName() {
return gitFilter.getClass().getName();
}
@Override
public String getInitParameter(String name) {
return config.getInitParameter(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
return config.getInitParameterNames();
}
@Override
public ServletContext getServletContext() {
return config.getServletContext();
}

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java

@ -60,6 +60,7 @@ import org.eclipse.jgit.lib.ObjectDatabase;
class InfoPacksServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
sendPlainText(packList(req), req, rsp);

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java

@ -64,6 +64,7 @@ import org.eclipse.jgit.util.HttpSupport;
class InfoRefsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
// Assume a dumb client and send back the dumb client

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java

@ -66,14 +66,17 @@ import org.eclipse.jgit.lib.Repository;
* downstream servlet can directly access its contents on disk.
*/
class IsLocalFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
if (isLocal(getRepository(request)))

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/NoCacheFilter.java

@ -59,14 +59,17 @@ import javax.servlet.http.HttpServletResponse;
/** Adds HTTP response headers to prevent caching by proxies/browsers. */
class NoCacheFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse rsp = (HttpServletResponse) response;

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java

@ -130,6 +130,7 @@ class ReceivePackServlet extends HttpServlet {
this.receivePackFactory = receivePackFactory;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
@ -153,10 +154,12 @@ class ReceivePackServlet extends HttpServlet {
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// Nothing.
}
@Override
public void destroy() {
// Nothing.
}

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/RepositoryFilter.java

@ -100,14 +100,17 @@ public class RepositoryFilter implements Filter {
this.resolver = resolver;
}
@Override
public void init(final FilterConfig config) throws ServletException {
context = config.getServletContext();
}
@Override
public void destroy() {
context = null;
}
@Override
public void doFilter(final ServletRequest request,
final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartOutputStream.java

@ -95,6 +95,7 @@ class SmartOutputStream extends TemporaryBuffer {
return out;
}
@Override
public void close() throws IOException {
super.close();

4
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/SmartServiceInfoRefs.java

@ -80,14 +80,17 @@ abstract class SmartServiceInfoRefs implements Filter {
this.filters = filters.toArray(new Filter[filters.size()]);
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
@ -154,6 +157,7 @@ abstract class SmartServiceInfoRefs implements Filter {
private class Chain implements FilterChain {
private int filterIdx;
@Override
public void doFilter(ServletRequest req, ServletResponse rsp)
throws IOException, ServletException {
if (filterIdx < filters.length)

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java

@ -68,6 +68,7 @@ class TextFileServlet extends HttpServlet {
this.fileName = name;
}
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse rsp) throws IOException {
try {

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java

@ -129,6 +129,7 @@ class UploadPackServlet extends HttpServlet {
this.uploadPackFactory = uploadPackFactory;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;
@ -152,10 +153,12 @@ class UploadPackServlet extends HttpServlet {
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// Nothing.
}
@Override
public void destroy() {
// Nothing.
}

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java

@ -128,10 +128,12 @@ public class MetaFilter implements Filter {
return register(new RegexPipeline.Binder(pattern));
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
servletContext = filterConfig.getServletContext();
}
@Override
public void destroy() {
if (pipelines != null) {
Set<Object> destroyed = newIdentitySet();
@ -166,6 +168,7 @@ public class MetaFilter implements Filter {
};
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) request;

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaServlet.java

@ -123,6 +123,7 @@ public class MetaServlet extends HttpServlet {
filter.init(new NoParameterFilterConfig(name, ctx));
}
@Override
public void destroy() {
filter.destroy();
}
@ -131,6 +132,7 @@ public class MetaServlet extends HttpServlet {
protected void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
filter.doFilter(req, res, new FilterChain() {
@Override
public void doFilter(ServletRequest request,
ServletResponse response) throws IOException,
ServletException {

6
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/NoParameterFilterConfig.java

@ -59,26 +59,32 @@ final class NoParameterFilterConfig implements FilterConfig {
this.context = context;
}
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return false;
}
@Override
public String nextElement() {
throw new NoSuchElementException();
}
};
}
@Override
public ServletContext getServletContext() {
return context;
}
@Override
public String getFilterName() {
return filterName;
}

3
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexGroupFilter.java

@ -79,14 +79,17 @@ public class RegexGroupFilter implements Filter {
this.groupIdx = groupIdx - 1;
}
@Override
public void init(FilterConfig config) throws ServletException {
// Do nothing.
}
@Override
public void destroy() {
// Do nothing.
}
@Override
public void doFilter(final ServletRequest request,
final ServletResponse rsp, final FilterChain chain)
throws IOException, ServletException {

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/RegexPipeline.java

@ -95,6 +95,7 @@ class RegexPipeline extends UrlPipeline {
pattern = p;
}
@Override
UrlPipeline create() {
return new RegexPipeline(pattern, getFilters(), getServlet());
}
@ -108,6 +109,7 @@ class RegexPipeline extends UrlPipeline {
this.pattern = pattern;
}
@Override
boolean match(final HttpServletRequest req) {
final String pathInfo = req.getPathInfo();
return pathInfo != null && pattern.matcher(pathInfo).matches();

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java

@ -61,6 +61,7 @@ abstract class ServletBinderImpl implements ServletBinder {
this.filters = new ArrayList<Filter>();
}
@Override
public ServletBinder through(Filter filter) {
if (filter == null)
throw new NullPointerException(HttpServerText.get().filterMustNotBeNull);
@ -68,6 +69,7 @@ abstract class ServletBinderImpl implements ServletBinder {
return this;
}
@Override
public void with(HttpServlet servlet) {
if (servlet == null)
throw new NullPointerException(HttpServerText.get().servletMustNotBeNull);

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/SuffixPipeline.java

@ -71,6 +71,7 @@ class SuffixPipeline extends UrlPipeline {
this.suffix = suffix;
}
@Override
UrlPipeline create() {
return new SuffixPipeline(suffix, getFilters(), getServlet());
}
@ -87,6 +88,7 @@ class SuffixPipeline extends UrlPipeline {
this.suffixLen = suffix.length();
}
@Override
boolean match(final HttpServletRequest req) {
final String pathInfo = req.getPathInfo();
return pathInfo != null && pathInfo.endsWith(suffix);

7
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/UrlPipeline.java

@ -121,26 +121,32 @@ abstract class UrlPipeline {
throws ServletException {
if (!inited.contains(ref)) {
ref.init(new ServletConfig() {
@Override
public String getInitParameter(String name) {
return null;
}
@Override
public Enumeration<String> getInitParameterNames() {
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return false;
}
@Override
public String nextElement() {
throw new NoSuchElementException();
}
};
}
@Override
public ServletContext getServletContext() {
return context;
}
@Override
public String getServletName() {
return ref.getClass().getName();
}
@ -229,6 +235,7 @@ abstract class UrlPipeline {
this.servlet = servlet;
}
@Override
public void doFilter(ServletRequest req, ServletResponse rsp)
throws IOException, ServletException {
if (filterIdx < filters.length)

1
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/AsIsFileService.java

@ -72,6 +72,7 @@ public class AsIsFileService {
};
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java

@ -69,6 +69,7 @@ import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
public class DefaultReceivePackFactory implements
ReceivePackFactory<HttpServletRequest> {
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}
@ -85,6 +86,7 @@ public class DefaultReceivePackFactory implements
}
}
@Override
public ReceivePack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
final ServiceConfig cfg = db.getConfig().get(CONFIG);

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java

@ -62,6 +62,7 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory;
public class DefaultUploadPackFactory implements
UploadPackFactory<HttpServletRequest> {
private static final SectionParser<ServiceConfig> CONFIG = new SectionParser<ServiceConfig>() {
@Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(cfg);
}
@ -75,6 +76,7 @@ public class DefaultUploadPackFactory implements
}
}
@Override
public UploadPack create(final HttpServletRequest req, final Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
if (db.getConfig().get(CONFIG).enabled)

2
org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

3
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java

@ -80,6 +80,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
private URIish remoteURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -90,6 +91,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -102,6 +104,7 @@ public class AdvertiseErrorTest extends HttpTestCase {
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {

1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java

@ -64,6 +64,7 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
private AsIsFileService service;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java

@ -71,6 +71,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
private ReceivePackFactory<HttpServletRequest> factory;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java

@ -69,6 +69,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
private UploadPackFactory<HttpServletRequest> factory;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java

@ -109,6 +109,7 @@ public class DumbClientDumbServerTest extends HttpTestCase {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java

@ -114,6 +114,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -124,6 +125,7 @@ public class DumbClientSmartServerTest extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

4
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java

@ -107,6 +107,7 @@ public class GitServletResponseTests extends HttpTestCase {
* configure the maximum pack file size, the object checker and custom hooks
* just before they talk to the server.
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -117,6 +118,7 @@ public class GitServletResponseTests extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -129,6 +131,7 @@ public class GitServletResponseTests extends HttpTestCase {
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
@ -270,6 +273,7 @@ public class GitServletResponseTests extends HttpTestCase {
// this PostReceiveHook when called after an unsuccesfull unpack will
// lead to an IllegalStateException
postHook = new PostReceiveHook() {
@Override
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
// the maxPackSize setting caused that the packfile couldn't be

4
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java

@ -88,6 +88,7 @@ public class HookMessageTest extends HttpTestCase {
private URIish remoteURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -98,6 +99,7 @@ public class HookMessageTest extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -110,11 +112,13 @@ public class HookMessageTest extends HttpTestCase {
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db);
recv.setPreReceiveHook(new PreReceiveHook() {
@Override
public void onPreReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
rp.sendMessage("message line 1");

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

@ -94,6 +94,7 @@ public class HttpClientTests extends HttpTestCase {
private URIish smartAuthBasicURI;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -132,6 +133,7 @@ public class HttpClientTests extends HttpTestCase {
private ServletContextHandler smart(final String path) {
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

4
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/MeasurePackSizeTest.java

@ -83,6 +83,7 @@ public class MeasurePackSizeTest extends HttpTestCase {
long packSize = -1;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -93,6 +94,7 @@ public class MeasurePackSizeTest extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
@ -105,12 +107,14 @@ public class MeasurePackSizeTest extends HttpTestCase {
}
});
gs.setReceivePackFactory(new DefaultReceivePackFactory() {
@Override
public ReceivePack create(HttpServletRequest req, Repository db)
throws ServiceNotEnabledException,
ServiceNotAuthorizedException {
ReceivePack recv = super.create(req, db);
recv.setPostReceiveHook(new PostReceiveHook() {
@Override
public void onPostReceive(ReceivePack rp,
Collection<ReceiveCommand> commands) {
packSize = rp.getPackSize();

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java

@ -84,6 +84,7 @@ public class ProtocolErrorTest extends HttpTestCase {
private RevBlob a_blob;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -94,6 +95,7 @@ public class ProtocolErrorTest extends HttpTestCase {
ServletContextHandler app = server.addContext("/git");
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/RegexPipelineTest.java

@ -93,12 +93,14 @@ public class RegexPipelineTest extends HttpTestCase {
}
}
@Override
@Before
public void setUp() throws Exception {
server = new AppServer();
ctx = server.addContext("/");
}
@Override
@After
public void tearDown() throws Exception {
server.tearDown();

1
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java

@ -77,6 +77,7 @@ public class SetAdditionalHeadersTest extends HttpTestCase {
private RevCommit A, B;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

5
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java

@ -147,6 +147,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
HttpTransport.setConnectionFactory(cf);
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -193,6 +194,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
ServletContextHandler broken = server.addContext("/bad");
broken.addFilter(new FilterHolder(new Filter() {
@Override
public void doFilter(ServletRequest request,
ServletResponse response, FilterChain chain)
throws IOException, ServletException {
@ -204,11 +206,13 @@ public class SmartClientSmartServerTest extends HttpTestCase {
w.close();
}
@Override
public void init(FilterConfig filterConfig)
throws ServletException {
// empty
}
@Override
public void destroy() {
// empty
}
@ -831,6 +835,7 @@ public class SmartClientSmartServerTest extends HttpTestCase {
this.repoName = repoName;
}
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException, ServiceNotEnabledException {
if (!name.equals(repoName))

2
org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

1
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java

@ -153,6 +153,7 @@ public class AccessEvent {
return responseHeaders.get(name);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append(method);

1
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java

@ -184,7 +184,6 @@ public class AppServer {
return new UserPrincipal(username,
Credential.getCredential(Crypt.crypt(username, password)));
}
}
private void auth(ServletContextHandler ctx, Authenticator authType) {

2
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java

@ -74,11 +74,13 @@ public abstract class HttpTestCase extends LocalDiskRepositoryTestCase {
/** In-memory application server; subclass must start. */
protected AppServer server;
@Override
public void setUp() throws Exception {
super.setUp();
server = new AppServer();
}
@Override
public void tearDown() throws Exception {
server.tearDown();
super.tearDown();

6
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java

@ -58,27 +58,33 @@ public class MockServletConfig implements ServletConfig {
parameters.put(name, value);
}
@Override
public String getInitParameter(String name) {
return parameters.get(name);
}
@Override
public Enumeration<String> getInitParameterNames() {
final Iterator<String> i = parameters.keySet().iterator();
return new Enumeration<String>() {
@Override
public boolean hasMoreElements() {
return i.hasNext();
}
@Override
public String nextElement() {
return i.next();
}
};
}
@Override
public String getServletName() {
return "MOCK_SERVLET";
}
@Override
public ServletContext getServletContext() {
return null;
}

14
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java

@ -95,10 +95,12 @@ public class RecordingLogger implements Logger {
this.name = name;
}
@Override
public Logger getLogger(@SuppressWarnings("hiding") String name) {
return new RecordingLogger(name);
}
@Override
public String getName() {
return name;
}
@ -109,6 +111,7 @@ public class RecordingLogger implements Logger {
}
}
@Override
public void warn(String msg, Throwable th) {
synchronized (warnings) {
warnings.add(new Warning(msg, th));
@ -127,6 +130,7 @@ public class RecordingLogger implements Logger {
// Ignore (not relevant to test failures)
}
@Override
public void debug(String msg, Throwable th) {
// Ignore (not relevant to test failures)
}
@ -145,14 +149,17 @@ public class RecordingLogger implements Logger {
// Ignore (not relevant to test failures)
}
@Override
public boolean isDebugEnabled() {
return false;
}
@Override
public void setDebugEnabled(boolean enabled) {
// Ignore (not relevant to test failures)
}
@Override
public void warn(String msg, Object... args) {
synchronized (warnings) {
warnings.add(new Warning(
@ -160,32 +167,39 @@ public class RecordingLogger implements Logger {
}
}
@Override
public void warn(Throwable thrown) {
synchronized (warnings) {
warnings.add(new Warning(thrown));
}
}
@Override
public void info(String msg, Object... args) {
// Ignore (not relevant to test failures)
}
@Override
public void info(Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void info(String msg, Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void debug(String msg, Object... args) {
// Ignore (not relevant to test failures)
}
@Override
public void debug(Throwable thrown) {
// Ignore (not relevant to test failures)
}
@Override
public void ignore(Throwable arg0) {
// Ignore (not relevant to test failures)
}

1
org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/SimpleHttpServer.java

@ -92,6 +92,7 @@ public class SimpleHttpServer {
private ServletContextHandler smart(final String path) {
GitServlet gs = new GitServlet();
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
@Override
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {

2
org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

2
org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

1
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java

@ -130,6 +130,7 @@ public class CleanFilter extends FilterCommand {
this.aOut = new AtomicObjectOutputStream(tmpFile.toAbsolutePath());
}
@Override
public int run() throws IOException {
try {
byte[] buf = new byte[8192];

3
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java

@ -171,6 +171,7 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
* @return &lt; 0 if this id comes before other; 0 if this id is equal to
* other; &gt; 0 if this id comes after other.
*/
@Override
public final int compareTo(final AnyLongObjectId other) {
if (this == other)
return 0;
@ -262,6 +263,7 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
return abbr.prefixCompare(this) == 0;
}
@Override
public final int hashCode() {
return (int) (w1 >> 32);
}
@ -277,6 +279,7 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
return other != null ? equals(this, other) : false;
}
@Override
public final boolean equals(final Object o) {
if (o instanceof AnyLongObjectId)
return equals((AnyLongObjectId) o);

2
org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

1
org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java

@ -127,6 +127,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase {
return JGitTestUtil.writeTrashFile(db, name, data);
}
@Override
protected String read(final File file) throws IOException {
return JGitTestUtil.read(file);
}

1
org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java

@ -156,6 +156,7 @@ public class CLIGitCommand extends Main {
return new PrintWriter(result.err);
}
@Override
void init(final TextBuiltin cmd) throws IOException {
cmd.outs = result.out;
cmd.errs = result.err;

1
org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java

@ -706,6 +706,7 @@ public class ArchiveTest extends CLIRepositoryTestCase {
ExecutorService executor = Executors.newSingleThreadExecutor();
return executor.submit(new Callable<Object>() {
@Override
public Object call() throws IOException {
try {
stream.write(data);

2
org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java

@ -110,6 +110,7 @@ public class CommandCatalog {
private static CommandRef[] toSortedArray(final Collection<CommandRef> c) {
final CommandRef[] r = c.toArray(new CommandRef[c.size()]);
Arrays.sort(r, new Comparator<CommandRef>() {
@Override
public int compare(final CommandRef o1, final CommandRef o2) {
return o1.getName().compareTo(o2.getName());
}

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java

@ -88,6 +88,7 @@ class Glog extends RevWalkTextBuiltin {
final JButton repaint = new JButton();
repaint.setText(CLIText.get().repaint);
repaint.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graphPane.repaint();
}

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java

@ -76,6 +76,7 @@ class LsRemote extends TextBuiltin {
.setTimeout(timeout).setHeads(heads).setTags(tags);
TreeSet<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() {
@Override
public int compare(Ref r1, Ref r2) {
return r1.getName().compareTo(r2.getName());
}

4
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java

@ -84,12 +84,14 @@ import org.kohsuke.args4j.Option;
class DiffAlgorithms extends TextBuiltin {
final Algorithm myers = new Algorithm() {
@Override
DiffAlgorithm create() {
return MyersDiff.INSTANCE;
}
};
final Algorithm histogram = new Algorithm() {
@Override
DiffAlgorithm create() {
HistogramDiff d = new HistogramDiff();
d.setFallbackAlgorithm(null);
@ -98,6 +100,7 @@ class DiffAlgorithms extends TextBuiltin {
};
final Algorithm histogram_myers = new Algorithm() {
@Override
DiffAlgorithm create() {
HistogramDiff d = new HistogramDiff();
d.setFallbackAlgorithm(MyersDiff.INSTANCE);
@ -234,6 +237,7 @@ class DiffAlgorithms extends TextBuiltin {
}
Collections.sort(all, new Comparator<Test>() {
@Override
public int compare(Test a, Test b) {
int result = Long.signum(a.runningTimeNanos - b.runningTimeNanos);
if (result == 0) {

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/LfsStore.java

@ -219,6 +219,7 @@ class LfsStore extends TextBuiltin {
return false;
}
@Override
protected void run() throws Exception {
AppServer server = new AppServer(port);
URI baseURI = server.getURI();

3
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java

@ -85,6 +85,7 @@ class ShowCommands extends TextBuiltin {
static enum Format {
/** */
USAGE {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
String usage = c.getUsage();
if (usage != null && usage.length() > 0)
@ -94,6 +95,7 @@ class ShowCommands extends TextBuiltin {
/** */
CLASSES {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
err.print(c.getImplementationClassName());
}
@ -101,6 +103,7 @@ class ShowCommands extends TextBuiltin {
/** */
URLS {
@Override
void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
final ClassLoader ldr = c.getImplementationClassLoader();

2
org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs

@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore

7
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java

@ -1074,30 +1074,37 @@ public class AddCommandTest extends RepositoryTestCase {
FS executableFs = new FS() {
@Override
public boolean supportsExecute() {
return true;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return true;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
try {
return read(f).startsWith("binary:");

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java

@ -79,6 +79,7 @@ public class ArchiveCommandTest extends RepositoryTestCase {
ArchiveCommand.registerFormat(format.SUFFIXES.get(0), format);
}
@Override
@After
public void tearDown() {
ArchiveCommand.unregisterFormat(format.SUFFIXES.get(0));

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java

@ -64,6 +64,7 @@ import org.junit.Test;
public class CleanCommandTest extends RepositoryTestCase {
private Git git;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java

@ -85,6 +85,7 @@ public class CloneCommandTest extends RepositoryTestCase {
private TestRepository<Repository> tr;
@Override
public void setUp() throws Exception {
super.setUp();
tr = new TestRepository<Repository>(db);

14
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java

@ -92,30 +92,37 @@ public class CommitCommandTest extends RepositoryTestCase {
FS executableFs = new FS() {
@Override
public boolean supportsExecute() {
return true;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return true;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
return true;
}
@ -137,30 +144,37 @@ public class CommitCommandTest extends RepositoryTestCase {
FS nonExecutableFs = new FS() {
@Override
public boolean supportsExecute() {
return false;
}
@Override
public boolean setExecute(File f, boolean canExec) {
return false;
}
@Override
public ProcessBuilder runInShell(String cmd, String[] args) {
return null;
}
@Override
public boolean retryFailedLockFileCommit() {
return false;
}
@Override
public FS newInstance() {
return this;
}
@Override
protected File discoverGitExe() {
return null;
}
@Override
public boolean canExecute(File f) {
return false;
}

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java

@ -623,6 +623,7 @@ public class EolRepositoryTest extends RepositoryTestCase {
for (int i = 0; i < dc.getEntryCount(); i++) {
editor.add(new DirCacheEditor.PathEdit(
dc.getEntry(i).getPathString()) {
@Override
public void apply(DirCacheEntry ent) {
ent.smudgeRacilyClean();
}

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LsRemoteCommandTest.java

@ -58,6 +58,7 @@ public class LsRemoteCommandTest extends RepositoryTestCase {
private Git git;
@Override
public void setUp() throws Exception {
super.setUp();
git = new Git(db);

9
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java

@ -346,6 +346,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** global rebase config should be respected */
public void testPullWithRebasePreserve1Config() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "preserve");
@ -360,6 +361,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch-local config should win over the global config */
public void testPullWithRebasePreserveConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "false");
@ -375,6 +377,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch-local config should be respected */
public void testPullWithRebasePreserveConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("branch", "master", "rebase", "preserve");
@ -389,6 +392,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** global rebase config should be respected */
public void testPullWithRebaseConfig1() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "true");
@ -403,6 +407,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch-local config should win over the global config */
public void testPullWithRebaseConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "preserve");
@ -418,6 +423,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch-local config should be respected */
public void testPullWithRebaseConfig3() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("branch", "master", "rebase", "true");
@ -432,6 +438,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** without config it should merge */
public void testPullWithoutConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
return target.pull().call();
}
@ -443,6 +450,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch local config should win over the global config */
public void testPullWithMergeConfig() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "true");
@ -458,6 +466,7 @@ public class PullCommandTest extends RepositoryTestCase {
/** the branch local config should win over the global config */
public void testPullWithMergeConfig2() throws Exception {
Callable<PullResult> setup = new Callable<PullResult>() {
@Override
public PullResult call() throws Exception {
StoredConfig config = dbTarget.getConfig();
config.setString("pull", null, "rebase", "false");

40
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java

@ -2269,11 +2269,13 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.add(0, new RebaseTodoLine(
"# Comment that should not be processed"));
}
@Override
public String modifyCommitMessage(String commit) {
fail("modifyCommitMessage() was not expected to be called");
return commit;
@ -2284,6 +2286,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult res2 = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
// delete RevCommit c4
@ -2293,6 +2296,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("modifyCommitMessage() was not expected to be called");
return commit;
@ -2514,6 +2518,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.REWORD);
@ -2522,6 +2527,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -2560,6 +2566,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult res = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -2568,6 +2575,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return ""; // not used
}
@ -2624,6 +2632,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.SQUASH);
@ -2632,6 +2641,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db
.getDirectory(), "rebase-merge/message-squash");
@ -2704,6 +2714,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~4")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.SQUASH);
@ -2713,6 +2724,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db.getDirectory(),
"rebase-merge/message-squash");
@ -2786,6 +2798,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~4")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2795,6 +2808,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
final File messageSquashFile = new File(db
.getDirectory(), "rebase-merge/message-squash");
@ -2861,6 +2875,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2869,6 +2884,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("No callback to modify commit message expected for single fixup");
return commit;
@ -2910,6 +2926,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(1).setAction(Action.FIXUP);
@ -2918,6 +2935,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
fail("No callback to modify commit message expected for single fixup");
return commit;
@ -2950,6 +2968,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.FIXUP);
@ -2958,6 +2977,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -2982,6 +3002,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.SQUASH);
@ -2990,6 +3011,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3013,6 +3035,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.rebase().setUpstream("HEAD~1")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -3021,6 +3044,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3055,6 +3079,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3064,6 +3089,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3097,6 +3123,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3106,6 +3133,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -3114,6 +3142,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
steps.remove(0);
try {
@ -3123,6 +3152,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "rewritten commit message";
}
@ -3160,6 +3190,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult result = git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3170,6 +3201,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "squashed message";
}
@ -3178,6 +3210,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3188,6 +3221,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "squashed message";
}
@ -3226,6 +3260,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult result = git.rebase().setUpstream("HEAD~3")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3236,6 +3271,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}
@ -3244,6 +3280,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
git.add().addFilepattern(FILE1).call();
result = git.rebase().runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.PICK);
@ -3254,6 +3291,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return "commit";
}
@ -3297,6 +3335,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
RebaseResult result = git.rebase().setUpstream("HEAD~2")
.runInteractively(new InteractiveHandler() {
@Override
public void prepareSteps(List<RebaseTodoLine> steps) {
try {
steps.get(0).setAction(Action.EDIT);
@ -3306,6 +3345,7 @@ public class RebaseCommandTest extends RepositoryTestCase {
}
}
@Override
public String modifyCommitMessage(String commit) {
return commit;
}

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RenameBranchCommandTest.java

@ -69,6 +69,7 @@ public class RenameBranchCommandTest extends RepositoryTestCase {
private Git git;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java

@ -77,6 +77,7 @@ public class StashApplyCommandTest extends RepositoryTestCase {
private File committedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java

@ -82,6 +82,7 @@ public class StashCreateCommandTest extends RepositoryTestCase {
private File untrackedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashDropCommandTest.java

@ -73,6 +73,7 @@ public class StashDropCommandTest extends RepositoryTestCase {
private File committedFile;
@Override
@Before
public void setUp() throws Exception {
super.setUp();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffEntryTest.java

@ -395,6 +395,7 @@ public class DiffEntryTest extends RepositoryTestCase {
assertTrue(walk.next());
editor.add(new PathEdit("a.txt") {
@Override
public void apply(DirCacheEntry ent) {
ent.setFileMode(FileMode.EXECUTABLE_FILE);
ent.setObjectId(walk.getObjectId(0));

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java vendored

@ -211,6 +211,7 @@ public class DirCacheBuilderTest extends RepositoryTestCase {
DirCache dc = db.lockDirCache();
IndexChangedListener listener = new IndexChangedListener() {
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}
@ -238,6 +239,7 @@ public class DirCacheBuilderTest extends RepositoryTestCase {
dc = db.lockDirCache();
listener = new IndexChangedListener() {
@Override
public void onIndexChanged(IndexChangedEvent event) {
throw new ReceivedEventMarkerException();
}

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/events/ConfigChangeEventTest.java

@ -56,6 +56,7 @@ public class ConfigChangeEventTest extends RepositoryTestCase {
final ConfigChangedEvent[] events = new ConfigChangedEvent[1];
db.getListenerList().addConfigChangedListener(
new ConfigChangedListener() {
@Override
public void onConfigChanged(ConfigChangedEvent event) {
events[0] = event;
}

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java

@ -79,6 +79,7 @@ public class RepoCommandTest extends RepositoryTestCase {
private ObjectId oldCommitId;
@Override
public void setUp() throws Exception {
super.setUp();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java

@ -81,6 +81,7 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
private TestRepository<Repository> test;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -89,6 +90,7 @@ public class AbbreviationTest extends LocalDiskRepositoryTestCase {
test = new TestRepository<Repository>(db);
}
@Override
@After
public void tearDown() throws Exception {
if (reader != null) {

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java

@ -77,6 +77,7 @@ import org.junit.Before;
import org.junit.Test;
public class ConcurrentRepackTest extends RepositoryTestCase {
@Override
@Before
public void setUp() throws Exception {
WindowCacheConfig windowCacheConfig = new WindowCacheConfig();
@ -85,6 +86,7 @@ public class ConcurrentRepackTest extends RepositoryTestCase {
super.setUp();
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java

@ -68,6 +68,7 @@ public class GcConcurrentTest extends GcTestCase {
class DoRepack extends EmptyProgressMonitor implements
Callable<Integer> {
@Override
public void beginTask(String title, int totalWork) {
if (title.equals(JGitText.get().writingObjects)) {
try {
@ -81,6 +82,7 @@ public class GcConcurrentTest extends GcTestCase {
}
/** @return 0 for success, 1 in case of error when writing pack */
@Override
public Integer call() throws Exception {
try {
gc.setProgressMonitor(this);

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java

@ -105,6 +105,7 @@ public class GcPackRefsTest extends GcTestCase {
Callable<Integer> packRefs = new Callable<Integer>() {
/** @return 0 for success, 1 in case of error when writing pack */
@Override
public Integer call() throws Exception {
syncPoint.await();
try {
@ -158,6 +159,7 @@ public class GcPackRefsTest extends GcTestCase {
try {
Future<Result> result = pool.submit(new Callable<Result>() {
@Override
public Result call() throws Exception {
RefUpdate update = new RefDirectoryUpdate(
(RefDirectory) repo.getRefDatabase(),
@ -182,6 +184,7 @@ public class GcPackRefsTest extends GcTestCase {
});
pool.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
refUpdateLockedRef.await();
gc.packRefs();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java

@ -62,6 +62,7 @@ public abstract class GcTestCase extends LocalDiskRepositoryTestCase {
protected GC gc;
protected RepoStatistics stats;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -71,6 +72,7 @@ public abstract class GcTestCase extends LocalDiskRepositoryTestCase {
gc = new GC(repo);
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java

@ -218,6 +218,7 @@ public class ObjectDirectoryTest extends RepositoryTestCase {
private Collection<Callable<ObjectId>> blobInsertersForTheSameFanOutDir(
final ObjectDirectory dir) {
Callable<ObjectId> callable = new Callable<ObjectId>() {
@Override
public ObjectId call() throws Exception {
return dir.newInserter().insert(Constants.OBJ_BLOB, new byte[0]);
}

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java

@ -107,6 +107,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
return rng;
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -120,6 +121,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase {
wc = (WindowCursor) repo.newObjectReader();
}
@Override
@After
public void tearDown() throws Exception {
if (wc != null)

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackIndexTestCase.java

@ -62,6 +62,7 @@ public abstract class PackIndexTestCase extends RepositoryTestCase {
PackIndex denseIdx;
@Override
public void setUp() throws Exception {
super.setUp();
smallIdx = PackIndex.open(getFileForPack34be9032());

1
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexTest.java

@ -65,6 +65,7 @@ public class PackReverseIndexTest extends RepositoryTestCase {
/**
* Set up tested class instance, test constructor by the way.
*/
@Override
@Before
public void setUp() throws Exception {
super.setUp();

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java

@ -131,6 +131,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private RevCommit c5;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -143,6 +144,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
write(alt, db.getObjectDatabase().getDirectory().getAbsolutePath() + "\n");
}
@Override
@After
public void tearDown() throws Exception {
if (writer != null) {
@ -882,6 +884,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
entries.add(me.cloneEntry());
}
Collections.sort(entries, new Comparator<PackIndex.MutableEntry>() {
@Override
public int compare(MutableEntry o1, MutableEntry o2) {
return Long.signum(o1.getOffset() - o2.getOffset());
}

8
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java

@ -100,6 +100,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
private RevTag v1_0;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
@ -547,6 +548,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
ListenerHandle listener = Repository.getGlobalListenerList()
.addRefsChangedListener(new RefsChangedListener() {
@Override
public void onRefsChanged(RefsChangedEvent event) {
count[0]++;
}
@ -1271,6 +1273,7 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
newRepo.getListenerList().addRefsChangedListener(
new RefsChangedListener() {
@Override
public void onRefsChanged(RefsChangedEvent event) {
try {
refDb.getRefs("ref");
@ -1440,23 +1443,28 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
private static final class StrictWorkMonitor implements ProgressMonitor {
private int lastWork, totalWork;
@Override
public void start(int totalTasks) {
// empty
}
@Override
public void beginTask(String title, int total) {
this.totalWork = total;
lastWork = 0;
}
@Override
public void update(int completed) {
lastWork += completed;
}
@Override
public void endTask() {
assertEquals("Units of work recorded", totalWork, lastWork);
}
@Override
public boolean isCancelled() {
return false;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save