Author: remm
Date: Mon Dec 10 20:01:37 2018
New Revision: 1848627

URL: http://svn.apache.org/viewvc?rev=1848627&view=rev
Log:
Add i18n for util/net package.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
    tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
    tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Mon Dec 
10 20:01:37 2018
@@ -789,7 +789,7 @@ public abstract class AbstractEndpoint<S
                 return IntrospectionUtils.setProperty(this,name,value,false);
             }
         }catch ( Exception x ) {
-            getLog().error("Unable to set attribute \""+name+"\" to 
\""+value+"\"",x);
+            getLog().error(sm.getString("endpoint.setAttributeError", name, 
value), x);
             return false;
         }
     }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Mon Dec 10 
20:01:37 2018
@@ -914,7 +914,7 @@ public class AprEndpoint extends Abstrac
                 getExecutor().execute(new SocketWithOptionsProcessor(wrapper));
             }
         } catch (RejectedExecutionException x) {
-            log.warn("Socket processing request was rejected for:"+socket,x);
+            log.warn(sm.getString("endpoint.rejectedExecution", socket), x);
             return false;
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties 
[UTF-8] (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties 
[UTF-8] Mon Dec 10 20:01:37 2018
@@ -91,8 +91,14 @@ endpoint.invalidJmxNameSslHostCert=Unabl
 endpoint.jmxRegistrationFailed=Failed to register the JMX object with name 
[{0}]
 endpoint.jsse.noSslContext=No SSLContext could be found for the host name [{0}]
 endpoint.launch.fail=Failed to launch new runnable
+endpoint.nio.keyMustBeCancelled=Key must be cancelled
+endpoint.nio.keyProcessingError=Error processing selection key
+endpoint.nio.latchMustBeZero=Latch must be at count zero or null
+endpoint.nio.nullLatch=Latch cannot be null
+endpoint.nio.pollerEventError=Error processing poller event
 endpoint.nio.registerFail=Failed to register socket with selector from poller
 endpoint.nio.selectorCloseFail=Failed to close selector when closing the poller
+endpoint.nio.selectorLoopError=Error in selector loop
 endpoint.nio.stopLatchAwaitFail=The pollers did not stop within the expected 
time
 endpoint.nio.stopLatchAwaitInterrupted=This thread was interrupted while 
waiting for the pollers to stop
 endpoint.nio.timeoutCme=Exception during processing of timeouts. The code has 
been checked repeatedly and no concurrent modification has been found. If you 
are able to repeat this error please open a Tomcat bug and provide the steps to 
reproduce.
@@ -107,12 +113,16 @@ endpoint.pollerThreadStop=The poller thr
 endpoint.portOffset.invalid=The value [{0}] for portOffset is not valid as 
portOffset may not be negative
 endpoint.process.fail=Error allocating socket processor
 endpoint.processing.fail=Error running socket processor
+endpoint.rejectedExecution=Socket processing request was rejected for [{0}]
 endpoint.removeDefaultSslHostConfig=The default SSLHostConfig (named [{0}]) 
may not be removed
 endpoint.sendfile.addfail=Sendfile failure: [{0}] [{1}]
 endpoint.sendfile.error=Unexpected sendfile error
+endpoint.sendfile.tooMuchData=Sendfile configured to send more data than was 
available
 endpoint.sendfileThreadStop=The sendfile thread failed to stop in a timely 
manner
 endpoint.serverSocket.closeFailed=Failed to close server socket for [{0}]
 endpoint.setAttribute=Set [{0}] to [{1}]
+endpoint.setAttributeError=Unable to set attribute [{0}] to [{1}]
+endpoint.socketOptionsError=Error setting socket options
 endpoint.timeout.err=Error processing socket timeout
 endpoint.unknownSslHostName=The SSL host name [{0}] is not recognised for this 
endpoint
 endpoint.warn.executorShutdown=The executor associated with thread pool [{0}] 
has not fully shutdown. Some application threads may still be running.
@@ -132,6 +142,11 @@ jsse.keystore_load_failed=Failed to load
 jsse.ssl3=SSLv3 has been explicitly enabled. This protocol is known to be 
insecure.
 jsse.tls13.auth=The JSSE TLS 1.3 implementation does not support 
authentication after the initial handshake and is therefore incompatible with 
optional client authentication
 
+nioBlockingSelector.keyNotRegistered=Key no longer registered
+nioBlockingSelector.possibleLeak=Possible key leak, cancelling key in the 
finalizer
+nioBlockingSelector.processingError=Error processing selection key operations
+nioBlockingSelector.selectError=Error selecting key
+
 sniExtractor.clientHelloInvalid=The ClientHello message was not correctly 
formatted
 sniExtractor.clientHelloTooBig=The ClientHello was not presented in a single 
TLS record so no SNI information could be extracted
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Mon Dec 10 
20:01:37 2018
@@ -333,7 +333,7 @@ public class Nio2Endpoint extends Abstra
             return processSocket(socketWrapper, SocketEvent.OPEN_READ, false);
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
-            log.error("",t);
+            log.error(sm.getString("endpoint.socketOptionsError"),t);
         }
         // Tell to close the socket
         return false;

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Mon 
Dec 10 20:01:37 2018
@@ -36,10 +36,12 @@ import org.apache.tomcat.util.ExceptionU
 import org.apache.tomcat.util.collections.SynchronizedQueue;
 import org.apache.tomcat.util.collections.SynchronizedStack;
 import org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper;
+import org.apache.tomcat.util.res.StringManager;
 
 public class NioBlockingSelector {
 
     private static final Log log = 
LogFactory.getLog(NioBlockingSelector.class);
+    protected static final StringManager sm = 
StringManager.getManager(NioBlockingSelector.class);
 
     private static final AtomicInteger threadCounter = new AtomicInteger();
 
@@ -85,7 +87,9 @@ public class NioBlockingSelector {
     public int write(ByteBuffer buf, NioChannel socket, long writeTimeout)
             throws IOException {
         SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());
-        if ( key == null ) throw new IOException("Key no longer registered");
+        if (key == null) {
+            throw new 
IOException(sm.getString("nioBlockingSelector.keyNotRegistered"));
+        }
         KeyReference reference = keyReferenceStack.pop();
         if (reference == null) {
             reference = new KeyReference();
@@ -157,7 +161,9 @@ public class NioBlockingSelector {
      */
     public int read(ByteBuffer buf, NioChannel socket, long readTimeout) 
throws IOException {
         SelectionKey key = 
socket.getIOChannel().keyFor(socket.getPoller().getSelector());
-        if ( key == null ) throw new IOException("Key no longer registered");
+        if (key == null) {
+            throw new 
IOException(sm.getString("nioBlockingSelector.keyNotRegistered"));
+        }
         KeyReference reference = keyReferenceStack.pop();
         if (reference == null) {
             reference = new KeyReference();
@@ -310,7 +316,7 @@ public class NioBlockingSelector {
                         continue;
                     } catch (Throwable x) {
                         ExceptionUtils.handleThrowable(x);
-                        log.error("",x);
+                        
log.error(sm.getString("nioBlockingSelector.selectError"), x);
                         continue;
                     }
 
@@ -337,7 +343,7 @@ public class NioBlockingSelector {
                         }
                     }//while
                 }catch ( Throwable t ) {
-                    log.error("",t);
+                    
log.error(sm.getString("nioBlockingSelector.processingError"), t);
                 }
             }
             events.clear();
@@ -467,7 +473,7 @@ public class NioBlockingSelector {
         @Override
         public void finalize() {
             if (key!=null && key.isValid()) {
-                log.warn("Possible key leak, cancelling key in the 
finalizer.");
+                log.warn(sm.getString("nioBlockingSelector.possibleLeak"));
                 try {key.cancel();}catch (Exception ignore){}
             }
         }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1848627&r1=1848626&r2=1848627&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Mon Dec 10 
20:01:37 2018
@@ -119,7 +119,7 @@ public class NioEndpoint extends Abstrac
                 return super.setProperty(name, value);
             }
         }catch ( Exception x ) {
-            log.error("Unable to set attribute \""+name+"\" to 
\""+value+"\"",x);
+            log.error(sm.getString("endpoint.setAttributeError", name, value), 
x);
             return false;
         }
     }
@@ -406,7 +406,7 @@ public class NioEndpoint extends Abstrac
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
             try {
-                log.error("",t);
+                log.error(sm.getString("endpoint.socketOptionsError"), t);
             } catch (Throwable tt) {
                 ExceptionUtils.handleThrowable(tt);
             }
@@ -481,14 +481,13 @@ public class NioEndpoint extends Abstrac
                 }
             }
         } catch (Exception x) {
-            log.error("",x);
+            log.error(sm.getString("endpoint.err.close"), x);
         }
     }
 
     // ----------------------------------------------------- Poller Inner 
Classes
 
     /**
-     *
      * PollerEvent, cacheable object for poller events to avoid GC
      */
     public static class PollerEvent implements Runnable {
@@ -637,7 +636,7 @@ public class NioEndpoint extends Abstrac
                         eventCache.push(pe);
                     }
                 } catch ( Throwable x ) {
-                    log.error("",x);
+                    log.error(sm.getString("endpoint.nio.pollerEventError"), 
x);
                 }
             }
 
@@ -757,7 +756,7 @@ public class NioEndpoint extends Abstrac
                     }
                 } catch (Throwable x) {
                     ExceptionUtils.handleThrowable(x);
-                    log.error("",x);
+                    log.error(sm.getString("endpoint.nio.selectorLoopError"), 
x);
                     continue;
                 }
                 //either we timed out or we woke up, process events first
@@ -822,7 +821,7 @@ public class NioEndpoint extends Abstrac
                 cancelledKey(sk);
             } catch (Throwable t) {
                 ExceptionUtils.handleThrowable(t);
-                log.error("",t);
+                log.error(sm.getString("endpoint.nio.keyProcessingError"), t);
             }
         }
 
@@ -865,8 +864,7 @@ public class NioEndpoint extends Abstrac
                         // Unusual not to be able to transfer any bytes
                         // Check the length was set correctly
                         if (sd.fchannel.size() <= sd.pos) {
-                            throw new IOException("Sendfile configured to " +
-                                    "send more data than was available");
+                            throw new 
IOException(sm.getString("endpoint.sendfile.tooMuchData"));
                         }
                     }
                 }
@@ -928,7 +926,7 @@ public class NioEndpoint extends Abstrac
                 }
                 return SendfileState.ERROR;
             } catch (Throwable t) {
-                log.error("", t);
+                log.error(sm.getString("endpoint.sendfile.error"), t);
                 if (!calledByProcessor && sc != null) {
                     close(sc, sk);
                 }
@@ -1044,7 +1042,7 @@ public class NioEndpoint extends Abstrac
         public CountDownLatch getWriteLatch() { return writeLatch; }
         protected CountDownLatch resetLatch(CountDownLatch latch) {
             if ( latch==null || latch.getCount() == 0 ) return null;
-            else throw new IllegalStateException("Latch must be at count 0");
+            else throw new 
IllegalStateException(sm.getString("endpoint.nio.latchMustBeZero"));
         }
         public void resetReadLatch() { readLatch = resetLatch(readLatch); }
         public void resetWriteLatch() { writeLatch = resetLatch(writeLatch); }
@@ -1053,13 +1051,13 @@ public class NioEndpoint extends Abstrac
             if ( latch == null || latch.getCount() == 0 ) {
                 return new CountDownLatch(cnt);
             }
-            else throw new IllegalStateException("Latch must be at count 0 or 
null.");
+            else throw new 
IllegalStateException(sm.getString("endpoint.nio.latchMustBeZero"));
         }
         public void startReadLatch(int cnt) { readLatch = 
startLatch(readLatch,cnt);}
         public void startWriteLatch(int cnt) { writeLatch = 
startLatch(writeLatch,cnt);}
 
         protected void awaitLatch(CountDownLatch latch, long timeout, TimeUnit 
unit) throws InterruptedException {
-            if ( latch == null ) throw new IllegalStateException("Latch cannot 
be null");
+            if ( latch == null ) throw new 
IllegalStateException(sm.getString("endpoint.nio.nullLatch"));
             // Note: While the return value is ignored if the latch does time
             //       out, logic further up the call stack will trigger a
             //       SocketTimeoutException
@@ -1194,7 +1192,7 @@ public class NioEndpoint extends Abstrac
                     NioEndpoint.NioSocketWrapper att = 
(NioEndpoint.NioSocketWrapper) channel
                             .getAttachment();
                     if (att == null) {
-                        throw new IOException("Key must be cancelled.");
+                        throw new 
IOException(sm.getString("endpoint.nio.keyMustBeCancelled"));
                     }
                     nRead = pool.read(to, channel, selector, 
att.getReadTimeout());
                 } finally {
@@ -1431,7 +1429,7 @@ public class NioEndpoint extends Abstrac
             } catch (VirtualMachineError vme) {
                 ExceptionUtils.handleThrowable(vme);
             } catch (Throwable t) {
-                log.error("", t);
+                log.error(sm.getString("endpoint.processing.fail"), t);
                 socket.getPoller().cancelledKey(key);
             } finally {
                 socketWrapper = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to