Skip to content

Commit 5709be7

Browse files
authored
Merge branch 'master' into issue_500_create_tag_method
2 parents 998bda9 + dd508e7 commit 5709be7

96 files changed

Lines changed: 3243 additions & 1099 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@
266266
<dependency>
267267
<groupId>junit</groupId>
268268
<artifactId>junit</artifactId>
269-
<version>4.12</version>
269+
<version>4.13</version>
270270
<scope>test</scope>
271271
</dependency>
272272
<dependency>
@@ -537,7 +537,7 @@
537537
<plugin>
538538
<groupId>org.apache.maven.plugins</groupId>
539539
<artifactId>maven-source-plugin</artifactId>
540-
<version>3.2.0</version>
540+
<version>3.2.1</version>
541541
</plugin>
542542
</plugins>
543543
</build>

src/main/java/org/kohsuke/github/GHBlobBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public GHBlobBuilder textContent(String content) {
3636
* @return a GHBlobBuilder
3737
*/
3838
public GHBlobBuilder binaryContent(byte[] content) {
39-
String base64Content = Base64.getMimeEncoder().encodeToString(content);
39+
String base64Content = Base64.getEncoder().encodeToString(content);
4040
req.with("content", base64Content);
4141
req.with("encoding", "base64");
4242
return this;

src/main/java/org/kohsuke/github/GHContent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessa
306306
*/
307307
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch)
308308
throws IOException {
309-
String encodedContent = Base64.getMimeEncoder().encodeToString(newContentBytes);
309+
String encodedContent = Base64.getEncoder().encodeToString(newContentBytes);
310310

311311
Requester requester = root.createRequest()
312312
.method("POST")

src/main/java/org/kohsuke/github/GHContentBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public GHContentBuilder sha(String sha) {
6868
* @return the gh content builder
6969
*/
7070
public GHContentBuilder content(byte[] content) {
71-
req.with("content", Base64.getMimeEncoder().encodeToString(content));
71+
req.with("content", Base64.getEncoder().encodeToString(content));
7272
return this;
7373
}
7474

src/main/java/org/kohsuke/github/GHTreeBuilder.java

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

3+
import com.fasterxml.jackson.annotation.JsonInclude;
4+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
35
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
46

57
import java.io.IOException;
@@ -16,8 +18,11 @@ public class GHTreeBuilder {
1618

1719
private final List<TreeEntry> treeEntries = new ArrayList<TreeEntry>();
1820

21+
// Issue #636: Create Tree no longer accepts null value in sha field
22+
@JsonInclude(Include.NON_NULL)
1923
@SuppressFBWarnings("URF_UNREAD_FIELD")
2024
private static final class TreeEntry {
25+
2126
private final String path;
2227
private final String mode;
2328
private final String type;

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,36 @@ public void testCRUDContent() throws Exception {
125125
equalTo("{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/contents/#get-contents\"}"));
126126
}
127127
}
128+
129+
@Test
130+
public void testMIMESmall() throws IOException {
131+
GHRepository ghRepository = getTempRepository();
132+
GHContentBuilder ghContentBuilder = ghRepository.createContent();
133+
ghContentBuilder.message("Some commit msg");
134+
ghContentBuilder.path("MIME-Small.md");
135+
ghContentBuilder.content("123456789012345678901234567890123456789012345678901234567");
136+
ghContentBuilder.commit();
137+
}
138+
139+
@Test
140+
public void testMIMELong() throws IOException {
141+
GHRepository ghRepository = getTempRepository();
142+
GHContentBuilder ghContentBuilder = ghRepository.createContent();
143+
ghContentBuilder.message("Some commit msg");
144+
ghContentBuilder.path("MIME-Long.md");
145+
ghContentBuilder.content("1234567890123456789012345678901234567890123456789012345678");
146+
ghContentBuilder.commit();
147+
}
148+
@Test
149+
public void testMIMELonger() throws IOException {
150+
GHRepository ghRepository = getTempRepository();
151+
GHContentBuilder ghContentBuilder = ghRepository.createContent();
152+
ghContentBuilder.message("Some commit msg");
153+
ghContentBuilder.path("MIME-Long.md");
154+
ghContentBuilder.content("123456789012345678901234567890123456789012345678901234567890"
155+
+ "123456789012345678901234567890123456789012345678901234567890"
156+
+ "123456789012345678901234567890123456789012345678901234567890"
157+
+ "123456789012345678901234567890123456789012345678901234567890");
158+
ghContentBuilder.commit();
159+
}
128160
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.util.Arrays;
1010

1111
public class GHTreeBuilderTest extends AbstractGitHubWireMockTest {
12-
private static String REPO_NAME = "sandboxx/GHTreeBuilderTest";
12+
private static String REPO_NAME = "github-api-test-org/GHTreeBuilderTest";
1313

1414
private static String PATH_SCRIPT = "app/run.sh";
1515
private static String CONTENT_SCRIPT = "#!/bin/bash\necho Hello\n";

0 commit comments

Comments
 (0)