Skip to content

Commit 3096342

Browse files
author
yangsen
committed
Merge branch 'master' of YangSen-qn:qiniu/java-sdk into multi-region
2 parents 6cb74c4 + 0d6b795 commit 3096342

File tree

8 files changed

+75
-13
lines changed

8 files changed

+75
-13
lines changed

.github/workflows/ci-test.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
name: Java CI with Gradle
2-
on:
3-
push:
4-
paths-ignore:
5-
- '**.md'
6-
pull_request:
7-
paths-ignore:
8-
- '**.md'
2+
on: [push, pull_request]
93
jobs:
104
build:
115
runs-on: ubuntu-latest
@@ -22,8 +16,9 @@ jobs:
2216
- name: checkout
2317
uses: actions/checkout@v2
2418
- name: Set up JDK
25-
uses: actions/setup-java@v1
19+
uses: actions/setup-java@v2
2620
with:
21+
distribution: 'zulu'
2722
java-version: ${{ matrix.java_version }}
2823
- name: Grant execute permission for gradlew
2924
run: chmod +x gradlew

.github/workflows/generate-docs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy static content to Pages
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow one concurrent deployment
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
21+
22+
jobs:
23+
# Single deploy job since we're just deploying
24+
deploy:
25+
environment:
26+
name: github-pages
27+
url: ${{ steps.deployment.outputs.page_url }}
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
32+
with:
33+
submodules: 'recursive'
34+
- name: Set up JDK
35+
uses: actions/setup-java@v2
36+
with:
37+
distribution: 'zulu'
38+
java-version: '11'
39+
- name: Grant execute permission for gradlew
40+
run: chmod +x gradlew
41+
- name: Generate Docs
42+
run: |
43+
rm -rf build/docs
44+
mkdir -p build/docs
45+
./gradlew apiJavadocs -d
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v2
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v1
50+
with:
51+
path: build/docs/javadoc
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v1

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)
44
[![Build Status](https://travis-ci.org/qiniu/java-sdk.svg)](https://travis-ci.org/qiniu/java-sdk)
55
[![GitHub release](https://img.shields.io/github/v/tag/qiniu/java-sdk.svg?label=release)](https://github.com/qiniu/java-sdk/releases)
6+
[![Docs](https://img.shields.io/github/v/tag/qiniu/java-sdk.svg?label=docs&color=yellow)](https://qiniu.github.io/java-sdk/)
67
[![Coverage Status](https://codecov.io/gh/qiniu/java-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/java-sdk)
78
[![Latest Stable Version](https://img.shields.io/maven-central/v/com.qiniu/qiniu-java-sdk.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.qiniu%22%20AND%20a%3A%22qiniu-java-sdk%22)
89
## 安装
@@ -43,7 +44,7 @@ Auth auth = Auth.create(accessKey, secretKey);
4344
String token = auth.uploadToken(bucketName);
4445
String key = "file save key";
4546
Response r = uploadManager.put("hello world".getBytes(), key, token);
46-
47+
4748
// 分片上传 v2
4849
import com.qiniu.storage.UploadManager;
4950
import com.qiniu.util.Auth;

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ task getHomeDir {
5050

5151
apply plugin: 'checkstyle'
5252

53+
task apiJavadocs(type: Javadoc) {
54+
source = sourceSets.main.allJava
55+
classpath = sourceSets.main.runtimeClasspath
56+
title = "七牛 Java SDK API 文档"
57+
options {
58+
memberLevel = JavadocMemberLevel.PUBLIC
59+
setEncoding 'UTF-8'
60+
setWindowTitle "七牛 Java SDK API 文档"
61+
}
62+
}
5363

5464
def versionName() {
5565
String config = getProjectDir().getPath() + '/src/main/java/com/qiniu/common/Constants.java'

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip

src/main/java/com/qiniu/storage/AutoRegion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AutoRegion extends Region {
2626
*/
2727
private Client client;
2828

29-
private AutoRegion(){
29+
private AutoRegion() {
3030
}
3131

3232
AutoRegion(String ucServer) {

src/main/java/com/qiniu/storage/BaseUploader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ private Response uploadWithRegionRetry() throws QiniuException {
5050
}
5151

5252
// context 过期,不需要切换 region
53-
if (response != null && response.isContextExpiredError() ||
54-
exception != null && exception.response != null && exception.response.isContextExpiredError()) {
53+
if (response != null && response.isContextExpiredError()
54+
|| exception != null && exception.response != null && exception.response.isContextExpiredError()) {
5555
continue;
5656
}
5757

src/main/java/com/qiniu/storage/Retry.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import com.qiniu.http.Response;
66

77
class Retry {
8+
private Retry() {
9+
}
810

911
static boolean shouldUploadAgain(Response response, QiniuException exception) {
1012
Response checkResponse = response;

0 commit comments

Comments
 (0)