|
@@ -64,7 +64,7 @@ import java.io.IOException;
|
|
|
import java.io.Writer;
|
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.URL;
|
|
|
-import java.nio.charset.Charset;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.security.Principal;
|
|
|
import java.security.PrivilegedActionException;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
@@ -555,8 +555,7 @@ public class TestWebDelegationToken {
|
|
|
HttpURLConnection conn = aUrl.openConnection(url, token);
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
- List<String> ret = IOUtils.readLines(conn.getInputStream(),
|
|
|
- Charset.defaultCharset());
|
|
|
+ List<String> ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(FOO_USER, ret.get(0));
|
|
|
|
|
@@ -626,8 +625,7 @@ public class TestWebDelegationToken {
|
|
|
HttpURLConnection conn = aUrl.openConnection(url, token);
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
- List<String> ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ List<String> ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(FOO_USER, ret.get(0));
|
|
|
|
|
@@ -851,15 +849,14 @@ public class TestWebDelegationToken {
|
|
|
HttpURLConnection conn =
|
|
|
(HttpURLConnection) new URL(strUrl).openConnection();
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
|
|
|
- List<String> ret =
|
|
|
- IOUtils.readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ List<String> ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(OK_USER, ret.get(0));
|
|
|
strUrl = String.format("%s?user.name=%s&DOAS=%s", url.toExternalForm(),
|
|
|
FOO_USER, OK_USER);
|
|
|
conn = (HttpURLConnection) new URL(strUrl).openConnection();
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK, conn.getResponseCode());
|
|
|
- ret = IOUtils.readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(OK_USER, ret.get(0));
|
|
|
|
|
@@ -877,7 +874,7 @@ public class TestWebDelegationToken {
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
List<String> ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ .readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(OK_USER, ret.get(0));
|
|
|
|
|
@@ -898,7 +895,7 @@ public class TestWebDelegationToken {
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ .readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals(FOO_USER, ret.get(0));
|
|
|
|
|
@@ -960,7 +957,7 @@ public class TestWebDelegationToken {
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
List<String> ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ .readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals("remoteuser=" + FOO_USER+ ":ugi=" + FOO_USER,
|
|
|
ret.get(0));
|
|
@@ -969,8 +966,7 @@ public class TestWebDelegationToken {
|
|
|
conn = aUrl.openConnection(url, token, OK_USER);
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
- ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals("realugi=" + FOO_USER +":remoteuser=" + OK_USER +
|
|
|
":ugi=" + OK_USER, ret.get(0));
|
|
@@ -1022,8 +1018,7 @@ public class TestWebDelegationToken {
|
|
|
HttpURLConnection conn = aUrl.openConnection(url, token, OK_USER);
|
|
|
Assert.assertEquals(HttpURLConnection.HTTP_OK,
|
|
|
conn.getResponseCode());
|
|
|
- List<String> ret = IOUtils
|
|
|
- .readLines(conn.getInputStream(), Charset.defaultCharset());
|
|
|
+ List<String> ret = IOUtils.readLines(conn.getInputStream(), StandardCharsets.UTF_8);
|
|
|
Assert.assertEquals(1, ret.size());
|
|
|
Assert.assertEquals("realugi=" + FOO_USER +":remoteuser=" + OK_USER +
|
|
|
":ugi=" + OK_USER, ret.get(0));
|