InfoRefsServlet: Refactor to not use deprecated methods

- Replace RefDatabase#getRefs(String) with #getRefsByPrefix(String)
- Replace RefAdvertiser#send(Map<String, Ref>) with #send(Collection<Ref>)

Bug: 534731
Change-Id: I25b617c3b0c54793cf4ab5b62f002e17745a5377
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
This commit is contained in:
David Pursehouse 2018-05-16 12:07:34 +09:00
parent 04560921c3
commit a2b10e56bd
1 changed files with 1 additions and 7 deletions

View File

@ -44,18 +44,15 @@
package org.eclipse.jgit.http.server;
import static org.eclipse.jgit.http.server.ServletUtils.getRepository;
import static org.eclipse.jgit.lib.RefDatabase.ALL;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.RefAdvertiser;
import org.eclipse.jgit.util.HttpSupport;
@ -94,10 +91,7 @@ protected void end() {
};
adv.init(db);
adv.setDerefTags(true);
Map<String, Ref> refs = db.getRefDatabase().getRefs(ALL);
refs.remove(Constants.HEAD);
adv.send(refs);
adv.send(db.getRefDatabase().getRefsByPrefix(Constants.R_REFS));
}
}
}