Use the StringManager for i18n
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 23 Sep 2011 16:55:21 +0000 (16:55 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 23 Sep 2011 16:55:21 +0000 (16:55 +0000)
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
java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties

index c1739c1..6d9edbd 100644 (file)
@@ -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<SSLSession,Integer> keySizeCache =
         new WeakHashMap<SSLSession, Integer>();
 
@@ -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
index 5e8ce34..a01e0c9 100644 (file)
@@ -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