2424import java .util .List ;
2525
2626import org .apache .hadoop .hdfs .client .HdfsClientConfigKeys ;
27- import org .apache .hadoop .thirdparty .com .google .common .base .Charsets ;
2827import org .apache .hadoop .classification .InterfaceAudience ;
2928import org .apache .hadoop .conf .Configuration ;
3029import org .apache .hadoop .fs .CommonPathCapabilities ;
6665import org .apache .hadoop .util .Progressable ;
6766import org .apache .hadoop .util .ReflectionUtils ;
6867import org .apache .hadoop .util .StringUtils ;
68+ import org .apache .ratis .thirdparty .com .google .common .base .Preconditions ;
6969import org .json .simple .JSONArray ;
7070import org .json .simple .JSONObject ;
7171import org .json .simple .parser .JSONParser ;
7272import org .json .simple .parser .ParseException ;
7373
74- import org .apache .hadoop .thirdparty .com .google .common .base .Preconditions ;
75- import org .apache .hadoop .thirdparty .com .google .common .collect .Lists ;
76- import org .apache .hadoop .thirdparty .com .google .common .collect .Maps ;
77-
7874import java .io .BufferedInputStream ;
7975import java .io .BufferedOutputStream ;
8076import java .io .DataInput ;
8884import java .net .URI ;
8985import java .net .URISyntaxException ;
9086import java .net .URL ;
87+ import java .nio .charset .StandardCharsets ;
9188import java .security .PrivilegedExceptionAction ;
9289import java .text .MessageFormat ;
9390import java .util .HashMap ;
@@ -802,7 +799,7 @@ public DirectoryEntries listStatusBatch(Path f, byte[] token) throws
802799 Map <String , String > params = new HashMap <String , String >();
803800 params .put (OP_PARAM , Operation .LISTSTATUS_BATCH .toString ());
804801 if (token != null ) {
805- params .put (START_AFTER_PARAM , new String (token , Charsets .UTF_8 ));
802+ params .put (START_AFTER_PARAM , new String (token , StandardCharsets .UTF_8 ));
806803 }
807804 HttpURLConnection conn = getConnection (
808805 Operation .LISTSTATUS_BATCH .getMethod (),
@@ -817,7 +814,7 @@ public DirectoryEntries listStatusBatch(Path f, byte[] token) throws
817814 byte [] newToken = null ;
818815 if (statuses .length > 0 ) {
819816 newToken = statuses [statuses .length - 1 ].getPath ().getName ().toString ()
820- .getBytes (Charsets .UTF_8 );
817+ .getBytes (StandardCharsets .UTF_8 );
821818 }
822819 // Parse the remainingEntries boolean into hasMore
823820 final long remainingEntries = (Long ) listing .get (REMAINING_ENTRIES_JSON );
@@ -1402,13 +1399,13 @@ public byte[] getXAttr(Path f, String name) throws IOException {
14021399 JSONObject json = (JSONObject ) HttpFSUtils .jsonParse (conn );
14031400 Map <String , byte []> xAttrs = createXAttrMap (
14041401 (JSONArray ) json .get (XATTRS_JSON ));
1405- return xAttrs != null ? xAttrs .get (name ) : null ;
1402+ return xAttrs .get (name );
14061403 }
14071404
14081405 /** Convert xAttrs json to xAttrs map. */
14091406 private Map <String , byte []> createXAttrMap (JSONArray jsonArray )
14101407 throws IOException {
1411- Map <String , byte []> xAttrs = Maps . newHashMap ();
1408+ Map <String , byte []> xAttrs = new HashMap <> ();
14121409 for (Object obj : jsonArray ) {
14131410 JSONObject jsonObj = (JSONObject ) obj ;
14141411 final String name = (String )jsonObj .get (XATTR_NAME_JSON );
@@ -1427,7 +1424,7 @@ private List<String> createXAttrNames(String xattrNamesStr)
14271424 JSONArray jsonArray ;
14281425 try {
14291426 jsonArray = (JSONArray )parser .parse (xattrNamesStr );
1430- List <String > names = Lists . newArrayListWithCapacity (jsonArray .size ());
1427+ List <String > names = new ArrayList <> (jsonArray .size ());
14311428 for (Object name : jsonArray ) {
14321429 names .add ((String ) name );
14331430 }
@@ -1455,7 +1452,7 @@ public Map<String, byte[]> getXAttrs(Path f, List<String> names)
14551452 "XAttr names cannot be null or empty." );
14561453 Map <String , String > params = new HashMap <String , String >();
14571454 params .put (OP_PARAM , Operation .GETXATTRS .toString ());
1458- Map <String , List <String >> multiValuedParams = Maps . newHashMap ();
1455+ Map <String , List <String >> multiValuedParams = new HashMap <> ();
14591456 multiValuedParams .put (XATTR_NAME_PARAM , names );
14601457 HttpURLConnection conn = getConnection (Operation .GETXATTRS .getMethod (),
14611458 params , multiValuedParams , f , true );
0 commit comments