Browse Source

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>
stable-4.5
Matthias Sohn 9 years ago
parent
commit
9a4e8de467
  1. 21
      org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java

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

@ -168,10 +168,13 @@ public class AppServer {
return ctx; return ctx;
} }
private void auth(ServletContextHandler ctx, Authenticator authType) { static class TestMappedLoginService extends MappedLoginService {
final String role = "can-access"; private String role;
TestMappedLoginService(String role) {
this.role = role;
}
MappedLoginService users = new MappedLoginService() {
@Override @Override
protected UserIdentity loadUser(String who) { protected UserIdentity loadUser(String who) {
return null; return null;
@ -182,15 +185,21 @@ public class AppServer {
putUser(username, new Password(password), new String[] { role }); putUser(username, new Password(password), new String[] { role });
} }
protected String[] loadRoleInfo(KnownUser user) { protected String[] loadRoleInfo(
@SuppressWarnings("unused") KnownUser user) {
return null; return null;
} }
protected KnownUser loadUserInfo(String usrname) { protected KnownUser loadUserInfo(
@SuppressWarnings("unused") String usrname) {
return null; return null;
} }
}; }
private void auth(ServletContextHandler ctx, Authenticator authType) {
final String role = "can-access";
MappedLoginService users = new TestMappedLoginService(role);
ConstraintMapping cm = new ConstraintMapping(); ConstraintMapping cm = new ConstraintMapping();
cm.setConstraint(new Constraint()); cm.setConstraint(new Constraint());
cm.getConstraint().setAuthenticate(true); cm.getConstraint().setAuthenticate(true);

Loading…
Cancel
Save