summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit.http
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2016-07-14 22:59:14 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2016-07-14 22:59:14 +0200
commit9a4e8de467cdbe71ec995b43c7262fd68224ea7f (patch)
treed19cc979305e651b241b21409b2a160627249b53 /org.eclipse.jgit.junit.http
parentffddf8d437b5b56706871fc53dbe4e5770f20ea3 (diff)
downloadjgit-9a4e8de467cdbe71ec995b43c7262fd68224ea7f.tar.gz
jgit-9a4e8de467cdbe71ec995b43c7262fd68224ea7f.zip
Fix AppServer build errors in Eclipse with <4.6 target platforms
9aa3748 added dummy implementations for loadRoleInfo() and loadUserInfo() to class MappedLoginService to fix compile errors in Eclipse when using 4.6 target platform which brings Jetty 9.3 adding these two methods. Unfortunately this causes errors when using non 4.6 target platform coming with an older Jetty version. Fix this by extracting the anonymous subclass of MappedLoginService which allows to suppress the unused private method errors in Eclipse. Change-Id: I75baeea7ff4502ce9ef2b541b3c0555da5535d79 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.junit.http')
-rw-r--r--org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java45
1 files changed, 27 insertions, 18 deletions
diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
index c8857409cf..cca4f43dbd 100644
--- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
+++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
@@ -168,29 +168,38 @@ public class AppServer {
return ctx;
}
- private void auth(ServletContextHandler ctx, Authenticator authType) {
- final String role = "can-access";
+ static class TestMappedLoginService extends MappedLoginService {
+ private String role;
- MappedLoginService users = new MappedLoginService() {
- @Override
- protected UserIdentity loadUser(String who) {
- return null;
- }
+ TestMappedLoginService(String role) {
+ this.role = role;
+ }
- @Override
- protected void loadUsers() throws IOException {
- putUser(username, new Password(password), new String[] { role });
- }
+ @Override
+ protected UserIdentity loadUser(String who) {
+ return null;
+ }
- protected String[] loadRoleInfo(KnownUser user) {
- return null;
- }
+ @Override
+ protected void loadUsers() throws IOException {
+ putUser(username, new Password(password), new String[] { role });
+ }
- protected KnownUser loadUserInfo(String usrname) {
- return null;
- }
- };
+ protected String[] loadRoleInfo(
+ @SuppressWarnings("unused") KnownUser user) {
+ return null;
+ }
+
+ protected KnownUser loadUserInfo(
+ @SuppressWarnings("unused") String usrname) {
+ return null;
+ }
+ }
+
+ private void auth(ServletContextHandler ctx, Authenticator authType) {
+ final String role = "can-access";
+ MappedLoginService users = new TestMappedLoginService(role);
ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(new Constraint());
cm.getConstraint().setAuthenticate(true);