From 35a59047867db4066a876b20860608d81c2f7540 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 23 Sep 2011 16:55:21 +0000 Subject: [PATCH] Use the StringManager for i18n git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1174882 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/tomcat/util/net/jsse/JSSESupport.java | 15 ++++++++++----- .../tomcat/util/net/jsse/res/LocalStrings.properties | 7 ++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java index c1739c168..6d9edbdad 100644 --- a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java +++ b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java @@ -35,6 +35,7 @@ import javax.security.cert.X509Certificate; import org.apache.tomcat.util.net.SSLSessionManager; import org.apache.tomcat.util.net.SSLSupport; +import org.apache.tomcat.util.res.StringManager; /** JSSESupport @@ -56,6 +57,9 @@ class JSSESupport implements SSLSupport, SSLSessionManager { private static final org.apache.juli.logging.Log log = org.apache.juli.logging.LogFactory.getLog(JSSESupport.class); + private static final StringManager sm = + StringManager.getManager("org.apache.tomcat.util.net.jsse.res"); + private static final Map keySizeCache = new WeakHashMap(); @@ -94,7 +98,7 @@ class JSSESupport implements SSLSupport, SSLSessionManager { try { certs = session.getPeerCertificates(); } catch( Throwable t ) { - log.debug("Error getting client certs",t); + log.debug(sm.getString("jsseSupport.clientCertError"), t); return null; } if( certs==null ) return null; @@ -115,7 +119,8 @@ class JSSESupport implements SSLSupport, SSLSessionManager { x509Certs[i] = (java.security.cert.X509Certificate) cf.generateCertificate(stream); } catch(Exception ex) { - log.info("Error translating cert " + certs[i], ex); + log.info(sm.getString( + "jseeSupport.certTranslationError", certs[i]), ex); return null; } } @@ -153,7 +158,7 @@ class JSSESupport implements SSLSupport, SSLSessionManager { protected void handShake() throws IOException { if( ssl.getWantClientAuth() ) { - log.debug("No client cert sent for want"); + log.debug(sm.getString("jsseSupport.noCertWant")); } else { ssl.setNeedClientAuth(true); } @@ -161,7 +166,7 @@ class JSSESupport implements SSLSupport, SSLSessionManager { if (ssl.getEnabledCipherSuites().length == 0) { // Handshake is never going to be successful. // Assume this is because handshakes are disabled - log.warn("SSL server initiated renegotiation is disabled, closing connection"); + log.warn(sm.getString("jsseSupport.serverRenegDisabled")); session.invalidate(); ssl.close(); return; @@ -180,7 +185,7 @@ class JSSESupport implements SSLSupport, SSLSessionManager { try { in.read(b); } catch(SSLException sslex) { - log.info("SSL Error getting client Certs",sslex); + log.info(sm.getString("jsseSupport.clientCertError"), sslex); throw sslex; } catch (IOException e) { // ignore - presumably the timeout diff --git a/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties b/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties index 5e8ce34f2..a01e0c954 100644 --- a/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties +++ b/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties @@ -17,4 +17,9 @@ jsse.alias_no_key_entry=Alias name {0} does not identify a key entry jsse.keystore_load_failed=Failed to load keystore type {0} with path {1} due to {2} jsse.invalid_ssl_conf=SSL configuration is invalid due to {0} jsse.invalid_truststore_password=The provided trust store password could not be used to unlock and/or validate the trust store. Retrying to access the trust store with a null password which will skip validation. -jsse.invalidTrustManagerClassName=The trustManagerClassName provided [{0}] does not implement javax.net.ssl.TrustManager \ No newline at end of file +jsse.invalidTrustManagerClassName=The trustManagerClassName provided [{0}] does not implement javax.net.ssl.TrustManager +jsseSupport.clientCertError=Error trying to obtain a certificate from the client +jseeSupport.certTranslationError=Error translating certificate [{0}] +jsseSupport.noCertWant=No client certificate sent for want +jsseSupport.serverRenegDisabled=SSL server initiated renegotiation is disabled, closing connection +jsseSupport.unexpectedData=Unexpected data read from input stream \ No newline at end of file -- 2.11.0