11package com .qiniu .storage ;
22
33import com .google .gson .Gson ;
4+ import com .qiniu .common .Constants ;
45import com .qiniu .common .QiniuException ;
56import com .qiniu .http .Client ;
67import com .qiniu .http .Response ;
@@ -443,7 +444,7 @@ Response makeFile(String bucket, String base64Key, Token token, String uploadId,
443444 final StringMap headers = new StringMap ().put ("Authorization" , "UpToken " + token .getUpToken ());
444445 sortAsc (etags );
445446 byte [] data = new MakefileBody (etags , fileName , params )
446- .json ().getBytes (Charset . forName ( "UTF-8" ) );
447+ .json ().getBytes (Constants . UTF_8 );
447448
448449 // 1
449450 Response res = makeFile1 (url , data , headers , true );
@@ -494,7 +495,7 @@ private String parseBucket(String upToken) throws QiniuException {
494495 try {
495496 String part3 = upToken .split (":" )[2 ];
496497 byte [] b = UrlSafeBase64 .decode (part3 );
497- StringMap m = Json .decode (new String (b , Charset . forName ( "UTF-8" ) ));
498+ StringMap m = Json .decode (new String (b , Constants . UTF_8 ));
498499 String scope = m .get ("scope" ).toString ();
499500 return scope .split (":" )[0 ];
500501 } catch (Exception e ) {
@@ -909,7 +910,7 @@ public Record reloadRecord() {
909910 if (recorder != null ) {
910911 try {
911912 byte [] data = recorder .get (recordFileKey );
912- record = new Gson ().fromJson (new String (data , Charset . forName ( "UTF-8" ) ), Record .class );
913+ record = new Gson ().fromJson (new String (data , Constants . UTF_8 ), Record .class );
913914 if (!record .isValid ()) {
914915 record = null ;
915916 }
@@ -930,7 +931,7 @@ public void delRecord() {
930931 public void syncRecord (Record record ) {
931932 if (needRecord && recorder != null && record .etagIdxes .size () > 0 ) {
932933 sortAsc (record .etagIdxes );
933- recorder .set (recordFileKey , new Gson ().toJson (record ).getBytes (Charset . forName ( "UTF-8" ) ));
934+ recorder .set (recordFileKey , new Gson ().toJson (record ).getBytes (Constants . UTF_8 ));
934935 }
935936 }
936937
0 commit comments