|
23 | 23 | */ |
24 | 24 | package org.kohsuke.github; |
25 | 25 |
|
26 | | -import com.gargoylesoftware.htmlunit.WebClient; |
27 | | -import com.gargoylesoftware.htmlunit.html.HtmlForm; |
28 | | -import com.gargoylesoftware.htmlunit.html.HtmlPage; |
29 | 26 | import com.infradna.tool.bridge_method_injector.WithBridgeMethods; |
| 27 | +import org.apache.commons.codec.binary.Base64; |
30 | 28 | import org.apache.commons.io.IOUtils; |
31 | 29 | import org.codehaus.jackson.map.DeserializationConfig.Feature; |
32 | 30 | import org.codehaus.jackson.map.ObjectMapper; |
33 | 31 | import org.codehaus.jackson.map.introspect.VisibilityChecker.Std; |
34 | | -import sun.misc.BASE64Encoder; |
35 | 32 |
|
36 | 33 | import java.io.File; |
37 | 34 | import java.io.FileInputStream; |
@@ -86,10 +83,9 @@ private GitHub(String apiUrl, String login, String apiToken, String password) { |
86 | 83 | this.apiToken = apiToken; |
87 | 84 | this.password = password; |
88 | 85 |
|
89 | | - BASE64Encoder enc = new sun.misc.BASE64Encoder(); |
90 | 86 | if (apiToken!=null || password!=null) { |
91 | 87 | String userpassword = password==null ? (login + "/token" + ":" + apiToken) : (login + ':'+password); |
92 | | - encodedAuthorization = enc.encode(userpassword.getBytes()); |
| 88 | + encodedAuthorization = Base64.encodeBase64String(userpassword.getBytes()); |
93 | 89 | } else |
94 | 90 | encodedAuthorization = null; |
95 | 91 | } |
@@ -273,7 +269,7 @@ public Map<String, GHOrganization> getMyOrganizations() throws IOException { |
273 | 269 | * Public events visible to you. Equivalent of what's displayed on https://github.com/ |
274 | 270 | */ |
275 | 271 | public List<GHEventInfo> getEvents() throws IOException { |
276 | | - // TODO: pagenation |
| 272 | + // TODO: pagination |
277 | 273 | GHEventInfo[] events = retrieve().to("/events", GHEventInfo[].class); |
278 | 274 | for (GHEventInfo e : events) |
279 | 275 | e.wrapUp(this); |
@@ -318,18 +314,6 @@ public boolean isCredentialValid() throws IOException { |
318 | 314 | } |
319 | 315 | } |
320 | 316 |
|
321 | | - WebClient createWebClient() throws IOException { |
322 | | - WebClient wc = new WebClient(); |
323 | | - wc.setJavaScriptEnabled(false); |
324 | | - wc.setCssEnabled(false); |
325 | | - HtmlPage pg = (HtmlPage)wc.getPage("https://github.com/login"); |
326 | | - HtmlForm f = pg.getForms().get(0); |
327 | | - f.getInputByName("login").setValueAttribute(login); |
328 | | - f.getInputByName("password").setValueAttribute(password); |
329 | | - f.submit(); |
330 | | - return wc; |
331 | | - } |
332 | | - |
333 | 317 | /*package*/ static URL parseURL(String s) { |
334 | 318 | try { |
335 | 319 | return s==null ? null : new URL(s); |
|
0 commit comments