Skip to content

Commit 45fe6fb

Browse files
author
MistyL
committed
format code
1 parent 998d0ec commit 45fe6fb

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,22 @@ public Response changeMime(String bucket, String key, String mime)
197197

198198
/**
199199
* 修改文件的元数据
200-
* @param bucket 空间名称
201-
* @param key 文件名称
200+
*
201+
* @param bucket 空间名称
202+
* @param key 文件名称
202203
* @param headers 需要修改的文件元数据
203204
* @throws QiniuException
204205
* @link https://developer.qiniu.com/kodo/api/1252/chgm
205206
*/
206-
public Response changeHeaders(String bucket, String key, Map<String,String> headers) throws QiniuException{
207+
public Response changeHeaders(String bucket, String key, Map<String, String> headers)
208+
throws QiniuException {
207209
String resource = encodedEntry(bucket, key);
208210
String path = String.format("/chgm/%s", resource);
209-
for (String k : headers.keySet()){
211+
for (String k : headers.keySet()) {
210212
String encodedMetaValue = UrlSafeBase64.encodeToString(headers.get(k));
211-
path = String.format("%s/%s/%s",path,k,encodedMetaValue);
213+
path = String.format("%s/%s/%s", path, k, encodedMetaValue);
212214
}
213-
return rsPost(bucket,path,null);
215+
return rsPost(bucket, path, null);
214216
}
215217

216218

src/test/java/test/com/qiniu/storage/BucketTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ public void testChangeMime() {
266266
}
267267

268268
@Test
269-
public void testChangeHeaders(){
269+
public void testChangeHeaders() {
270270
List<String[]> cases = new ArrayList<String[]>();
271271
cases.add(new String[]{TestConfig.testBucket_z0, TestConfig.testKey_z0});
272272
cases.add(new String[]{TestConfig.testBucket_na0, TestConfig.testKey_na0});
@@ -275,13 +275,13 @@ public void testChangeHeaders(){
275275
String bucket = icase[0];
276276
String key = icase[1];
277277
try {
278-
Map<String,String> headers = new HashMap<>();
278+
Map<String, String> headers = new HashMap<>();
279279
Date d = new Date();
280-
SimpleDateFormat dateFm = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'",Locale.ENGLISH);
280+
SimpleDateFormat dateFm = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.ENGLISH);
281281
System.out.println(dateFm.format(d));
282-
headers.put("x-qn-meta-!Content-Type","image/png");
283-
headers.put("x-qn-meta-!Last-Modifie",dateFm.format(d));
284-
bucketManager.changeHeaders(bucket,key,headers);
282+
headers.put("x-qn-meta-!Content-Type", "image/png");
283+
headers.put("x-qn-meta-!Last-Modifie", dateFm.format(d));
284+
bucketManager.changeHeaders(bucket, key, headers);
285285
} catch (QiniuException e) {
286286
fail(bucket + ":" + key + "==> " + e.response.toString());
287287
}

0 commit comments

Comments
 (0)