hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x...@apache.org
Subject [hadoop] branch trunk updated: HDDS-1075. Fix CertificateUtil#parseRSAPublicKey charsetName. Contributed by Siddharth Wagle.
Date Mon, 11 Feb 2019 20:10:05 GMT
This is an automated email from the ASF dual-hosted git repository.

xyao pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ca4e46a  HDDS-1075. Fix CertificateUtil#parseRSAPublicKey charsetName. Contributed
by Siddharth Wagle.
ca4e46a is described below

commit ca4e46a05eb20106d69db481d6ac1988696a9f01
Author: Xiaoyu Yao <xyao@apache.org>
AuthorDate: Mon Feb 11 12:00:36 2019 -0800

    HDDS-1075. Fix CertificateUtil#parseRSAPublicKey charsetName. Contributed by Siddharth
Wagle.
---
 .../apache/hadoop/security/authentication/util/CertificateUtil.java  | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
index 1ca59ae..cf17aca 100644
--- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
+++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/CertificateUtil.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.security.authentication.util;
 
 import java.io.ByteArrayInputStream;
 import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.security.PublicKey;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
@@ -45,7 +46,7 @@ public class CertificateUtil {
     try {
       CertificateFactory fact = CertificateFactory.getInstance("X.509");
       ByteArrayInputStream is = new ByteArrayInputStream(
-          fullPem.getBytes("UTF8"));
+          fullPem.getBytes(StandardCharsets.UTF_8));
 
       X509Certificate cer = (X509Certificate) fact.generateCertificate(is);
       key = cer.getPublicKey();
@@ -58,8 +59,6 @@ public class CertificateUtil {
         message = "CertificateException - PEM may be corrupt";
       }
       throw new ServletException(message, ce);
-    } catch (UnsupportedEncodingException uee) {
-      throw new ServletException(uee);
     }
     return (RSAPublicKey) key;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message