Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 10238db

Browse files
committed
Explaining why this code is the way it is.
1 parent 6229e09 commit 10238db

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

src/test/java/org/kohsuke/github/AbstractGitHubApiTestBase.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package org.kohsuke.github;
22

3-
import org.apache.commons.io.IOUtils;
43
import org.junit.Assert;
54
import org.junit.Before;
65
import org.kohsuke.randname.RandomNameGenerator;
76

8-
import java.io.FileInputStream;
9-
import java.util.Properties;
7+
import java.io.File;
108

119
/**
1210
* @author Kohsuke Kawaguchi
@@ -17,16 +15,11 @@ public abstract class AbstractGitHubApiTestBase extends Assert {
1715

1816
@Before
1917
public void setUp() throws Exception {
20-
Properties props = new Properties();
21-
java.io.File f = new java.io.File(System.getProperty("user.home"), ".github.kohsuke2");
18+
File f = new File(System.getProperty("user.home"), ".github.kohsuke2");
2219
if (f.exists()) {
23-
FileInputStream in = new FileInputStream(f);
24-
try {
25-
props.load(in);
26-
gitHub = GitHub.connect(props.getProperty("login"),props.getProperty("oauth"));
27-
} finally {
28-
IOUtils.closeQuietly(in);
29-
}
20+
// use the non-standard credential preferentially, so that developers of this library do not have
21+
// to clutter their event stream.
22+
gitHub = GitHubBuilder.fromPropertyFile(f.getPath()).build();
3023
} else {
3124
gitHub = GitHub.connect();
3225
}

0 commit comments

Comments
 (0)