Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2017-01-16 05:39:32 +0000
committerDavid Pursehouse2017-02-20 00:05:08 +0000
commit7ac182f4e427e0d5a986b8ca67a56fc22828b1a0 (patch)
tree7a63f64443cd919e361d7de747ef31ffa5bd6279 /org.eclipse.jgit.http.apache
parent5e8e2179b218ede7d14b69dc5149b0691b5859cf (diff)
downloadjgit-7ac182f4e427e0d5a986b8ca67a56fc22828b1a0.tar.gz
jgit-7ac182f4e427e0d5a986b8ca67a56fc22828b1a0.tar.xz
jgit-7ac182f4e427e0d5a986b8ca67a56fc22828b1a0.zip
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>
Diffstat (limited to 'org.eclipse.jgit.http.apache')
-rw-r--r--org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java27
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java2
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java5
4 files changed, 35 insertions, 1 deletions
diff --git a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
index 80cfbbbd3b..adfb7aa3b5 100644
--- a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
+++ b/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
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
index 281154fb1a..9285d17662 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
+++ b/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);
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java
index fe1eef484a..f97d284b46 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnectionFactory.java
+++ b/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);
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java
index 93328c96ca..3efff49d08 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/TemporaryBufferEntity.java
+++ b/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;
}

Back to the top