Author: remy.maucherat(a)jboss.com
Date: 2012-07-26 08:58:36 -0400 (Thu, 26 Jul 2012)
New Revision: 2055
Removed:
trunk/src/main/java/org/apache/coyote/ajp/LocalStrings.properties
trunk/src/main/java/org/apache/coyote/ajp/LocalStrings_es.properties
trunk/src/main/java/org/apache/coyote/http11/LocalStrings.properties
trunk/src/main/java/org/apache/coyote/http11/LocalStrings_es.properties
trunk/src/main/java/org/apache/coyote/http11/LocalStrings_fr.properties
trunk/src/main/java/org/apache/coyote/http11/LocalStrings_ja.properties
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings.properties
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties
trunk/src/main/java/org/apache/tomcat/util/http/LocalStrings.properties
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings.properties
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_es.properties
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_fr.properties
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_fr.properties
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_ja.properties
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings.properties
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_es.properties
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_fr.properties
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_ja.properties
trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java
Modified:
trunk/src/main/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
trunk/src/main/java/org/apache/catalina/filters/FilterBase.java
trunk/src/main/java/org/apache/catalina/util/StringManager.java
trunk/src/main/java/org/apache/catalina/valves/RemoteIpValve.java
trunk/src/main/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
trunk/src/main/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/src/main/java/org/apache/coyote/ajp/AjpAprProtocol.java
trunk/src/main/java/org/apache/coyote/ajp/AjpMessage.java
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalInputBuffer.java
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalOutputBuffer.java
trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProcessor.java
trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProtocol.java
trunk/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java
trunk/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
trunk/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java
trunk/src/main/java/org/apache/coyote/http11/InternalAprInputBuffer.java
trunk/src/main/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
trunk/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java
trunk/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
trunk/src/main/java/org/apache/tomcat/util/buf/HexUtils.java
trunk/src/main/java/org/apache/tomcat/util/buf/UEncoder.java
trunk/src/main/java/org/apache/tomcat/util/buf/UTF8Decoder.java
trunk/src/main/java/org/apache/tomcat/util/http/Cookies.java
trunk/src/main/java/org/apache/tomcat/util/http/HttpMessages.java
trunk/src/main/java/org/apache/tomcat/util/http/MimeHeaders.java
trunk/src/main/java/org/apache/tomcat/util/http/Parameters.java
trunk/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java
trunk/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
trunk/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java
trunk/src/main/java/org/jboss/web/CoyoteLogger.java
trunk/src/main/java/org/jboss/web/CoyoteMessages.java
Log:
Migrate Coyote and util to JBoss Logging.
Modified:
trunk/src/main/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
===================================================================
---
trunk/src/main/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -33,7 +33,7 @@
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
-import org.apache.tomcat.util.res.StringManager;
+import org.apache.catalina.util.StringManager;
/**
* Provide a workaround for known places where the Java Runtime environment can
Modified: trunk/src/main/java/org/apache/catalina/filters/FilterBase.java
===================================================================
--- trunk/src/main/java/org/apache/catalina/filters/FilterBase.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/catalina/filters/FilterBase.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -24,7 +24,7 @@
import javax.servlet.ServletException;
import org.apache.tomcat.util.IntrospectionUtils;
-import org.apache.tomcat.util.res.StringManager;
+import org.apache.catalina.util.StringManager;
/**
* Base class for filters that provides generic initialisation and a simple
Modified: trunk/src/main/java/org/apache/catalina/util/StringManager.java
===================================================================
--- trunk/src/main/java/org/apache/catalina/util/StringManager.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/catalina/util/StringManager.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -227,6 +227,16 @@
Object[] args = new Object[] {arg1, arg2, arg3, arg4};
return getString(key, args);
}
+ public String getString(String key, Object arg1, Object arg2,
+ Object arg3, Object arg4, Object arg5) {
+ Object[] args = new Object[] {arg1, arg2, arg3, arg4, arg5};
+ return getString(key, args);
+ }
+ public String getString(String key, Object arg1, Object arg2,
+ Object arg3, Object arg4, Object arg5, Object arg6) {
+ Object[] args = new Object[] {arg1, arg2, arg3, arg4, arg5, arg6};
+ return getString(key, args);
+ }
// --------------------------------------------------------------
// STATIC SUPPORT METHODS
// --------------------------------------------------------------
Modified: trunk/src/main/java/org/apache/catalina/valves/RemoteIpValve.java
===================================================================
--- trunk/src/main/java/org/apache/catalina/valves/RemoteIpValve.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/catalina/valves/RemoteIpValve.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -28,7 +28,7 @@
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
-import org.apache.tomcat.util.res.StringManager;
+import org.apache.catalina.util.StringManager;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
import org.apache.catalina.valves.Constants;
Modified: trunk/src/main/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
===================================================================
---
trunk/src/main/java/org/apache/catalina/valves/StuckThreadDetectionValve.java 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/catalina/valves/StuckThreadDetectionValve.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -29,7 +29,7 @@
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
-import org.apache.tomcat.util.res.StringManager;
+import org.apache.catalina.util.StringManager;
import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
Modified: trunk/src/main/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/ajp/AjpAprProcessor.java 2012-07-19 15:51:17 UTC
(rev 2054)
+++ trunk/src/main/java/org/apache/coyote/ajp/AjpAprProcessor.java 2012-07-26 12:58:36 UTC
(rev 2055)
@@ -22,6 +22,8 @@
package org.apache.coyote.ajp;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
@@ -48,7 +50,7 @@
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.AprEndpoint.Handler.SocketState;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
@@ -65,19 +67,6 @@
public class AjpAprProcessor implements ActionHook {
- /**
- * Logger.
- */
- protected static org.jboss.logging.Logger log
- = org.jboss.logging.Logger.getLogger(AjpAprProcessor.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
// ----------------------------------------------------------- Constructors
@@ -385,7 +374,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.process"), t);
+ CoyoteLogger.AJP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -453,9 +442,7 @@
continue;
} else if(type != Constants.JK_AJP13_FORWARD_REQUEST) {
// Usually the servlet didn't read the previous request body
- if(log.isDebugEnabled()) {
- log.debug("Unexpected message: "+type);
- }
+ CoyoteLogger.AJP_LOGGER.unexpectedAjpMessage(type);
error = true;
break;
}
@@ -466,7 +453,7 @@
error = true;
break;
} catch (Throwable t) {
- log.debug(sm.getString("ajpprocessor.header.error"), t);
+ CoyoteLogger.AJP_LOGGER.errorParsingAjpHeaderMessage(t);
// 400 - Bad Request
response.setStatus(400);
error = true;
@@ -477,7 +464,7 @@
try {
prepareRequest();
} catch (Throwable t) {
- log.debug(sm.getString("ajpprocessor.request.prepare"), t);
+ CoyoteLogger.AJP_LOGGER.errorPreparingAjpRequest(t);
// 400 - Internal Server Error
response.setStatus(400);
error = true;
@@ -491,7 +478,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("ajpprocessor.request.process"),
t);
+ CoyoteLogger.AJP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -628,7 +615,7 @@
}
}
} catch (java.security.cert.CertificateException e) {
- log.error(sm.getString("ajpprocessor.certs.fail"), e);
+ CoyoteLogger.AJP_LOGGER.errorProcessingCertificates(e);
return;
}
request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, jsseCerts);
@@ -1128,7 +1115,7 @@
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
- throw new IOException(sm.getString("ajpprotocol.failedread"));
+ throw new IOException(MESSAGES.failedRead());
}
}
@@ -1164,7 +1151,7 @@
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
return false;
} else {
- throw new
IOException(sm.getString("ajpprotocol.failedread"));
+ throw new IOException(MESSAGES.failedRead());
}
}
}
@@ -1245,7 +1232,6 @@
boolean useAvailableData)
throws IOException {
- byte[] buf = message.getBuffer();
int headerLength = message.getHeaderLength();
if (first) {
@@ -1257,7 +1243,7 @@
}
inputBuffer.get(message.getBuffer(), 0, headerLength);
if (message.processHeader() < 0) {
- throw new IOException(sm.getString("ajpprotocol.badmessage"));
+ throw new IOException(MESSAGES.invalidAjpMessage());
}
read(message.getLen());
inputBuffer.get(message.getBuffer(), headerLength, message.getLen());
@@ -1299,7 +1285,7 @@
throws IOException {
if (outputBuffer.position() > 0) {
if (Socket.sendbb(socket, 0, outputBuffer.position()) < 0) {
- throw new
IOException(sm.getString("ajpprocessor.failedsend"));
+ throw new IOException(MESSAGES.failedWrite());
}
outputBuffer.clear();
}
Modified: trunk/src/main/java/org/apache/coyote/ajp/AjpAprProtocol.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/ajp/AjpAprProtocol.java 2012-07-19 15:51:17 UTC
(rev 2054)
+++ trunk/src/main/java/org/apache/coyote/ajp/AjpAprProtocol.java 2012-07-26 12:58:36 UTC
(rev 2055)
@@ -44,7 +44,7 @@
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.AprEndpoint.Handler;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
@@ -59,16 +59,6 @@
implements ProtocolHandler, MBeanRegistration {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(AjpAprProtocol.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
// ------------------------------------------------------------ Constructor
@@ -124,16 +114,10 @@
* Pass config info
*/
public void setAttribute(String name, Object value) {
- if (log.isTraceEnabled()) {
- log.trace(sm.getString("ajpprotocol.setattribute", name, value));
- }
attributes.put(name, value);
}
public Object getAttribute(String key) {
- if (log.isTraceEnabled()) {
- log.trace(sm.getString("ajpprotocol.getattribute", key));
- }
return attributes.get(key);
}
@@ -175,12 +159,9 @@
try {
endpoint.init();
} catch (Exception ex) {
- log.error(sm.getString("ajpprotocol.endpoint.initerror"), ex);
+ CoyoteLogger.AJP_LOGGER.errorInitializingEndpoint(ex);
throw ex;
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("ajpprotocol.init", getName()));
- }
}
@@ -189,34 +170,32 @@
if (this.domain != null ) {
try {
tpOname = new ObjectName
- (domain + ":" + "type=ThreadPool,name=" +
getName());
+ (domain + ":" + "type=ThreadPool,name=" +
getName());
Registry.getRegistry(null, null)
.registerComponent(endpoint, tpOname, null );
} catch (Exception e) {
- log.error("Can't register threadpool" );
+ CoyoteLogger.AJP_LOGGER.errorRegisteringPool(e);
}
rgOname = new ObjectName
- (domain + ":type=GlobalRequestProcessor,name=" + getName());
- Registry.getRegistry(null, null).registerComponent
- (cHandler.global, rgOname, null);
+ (domain + ":type=GlobalRequestProcessor,name=" +
getName());
+ Registry.getRegistry(null, null).registerComponent(cHandler.global,
rgOname, null);
}
}
try {
endpoint.start();
} catch (Exception ex) {
- log.error(sm.getString("ajpprotocol.endpoint.starterror"), ex);
+ CoyoteLogger.AJP_LOGGER.errorStartingEndpoint(ex);
throw ex;
}
- if (log.isInfoEnabled())
- log.info(sm.getString("ajpprotocol.start", getName()));
+ CoyoteLogger.AJP_LOGGER.startingAjpProtocol(getName());
}
public void pause() throws Exception {
try {
endpoint.pause();
} catch (Exception ex) {
- log.error(sm.getString("ajpprotocol.endpoint.pauseerror"), ex);
+ CoyoteLogger.AJP_LOGGER.errorPausingEndpoint(ex);
throw ex;
}
canDestroy = false;
@@ -242,28 +221,25 @@
canDestroy = true;
}
}
- if (log.isInfoEnabled())
- log.info(sm.getString("ajpprotocol.pause", getName()));
+ CoyoteLogger.AJP_LOGGER.pausingAjpProtocol(getName());
}
public void resume() throws Exception {
try {
endpoint.resume();
} catch (Exception ex) {
- log.error(sm.getString("ajpprotocol.endpoint.resumeerror"), ex);
+ CoyoteLogger.AJP_LOGGER.errorResumingEndpoint(ex);
throw ex;
}
- if (log.isInfoEnabled())
- log.info(sm.getString("ajpprotocol.resume", getName()));
+ CoyoteLogger.AJP_LOGGER.resumingAjpProtocol(getName());
}
public void destroy() throws Exception {
- if (log.isInfoEnabled())
- log.info(sm.getString("ajpprotocol.stop", getName()));
+ CoyoteLogger.AJP_LOGGER.stoppingAjpProtocol(getName());
if (canDestroy) {
endpoint.destroy();
} else {
- log.warn(sm.getString("ajpprotocol.cannotDestroy", getName()));
+ CoyoteLogger.AJP_LOGGER.cannotDestroyAjpProtocol(getName());
try {
RequestInfo[] states = cHandler.global.getRequestProcessors();
for (int i = 0; i < states.length; i++) {
@@ -272,7 +248,7 @@
}
}
} catch (Exception ex) {
- log.error(sm.getString("ajpprotocol.cannotDestroy", getName()),
ex);
+ CoyoteLogger.AJP_LOGGER.cannotDestroyAjpProtocolWithException(getName(),
ex);
throw ex;
}
}
@@ -439,14 +415,10 @@
state = result.event(status);
} catch (java.net.SocketException e) {
// SocketExceptions are normal
- AjpAprProcessor.log.debug
- (sm.getString
- ("ajpprotocol.proto.socketexception.debug"), e);
+ CoyoteLogger.AJP_LOGGER.socketException(e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- AjpAprProcessor.log.debug
- (sm.getString
- ("ajpprotocol.proto.ioexception.debug"), e);
+ CoyoteLogger.AJP_LOGGER.socketException(e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
@@ -455,8 +427,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- AjpAprProcessor.log.error
- (sm.getString("ajpprotocol.proto.error"), e);
+ CoyoteLogger.AJP_LOGGER.socketError(e);
} finally {
if (state != SocketState.LONG) {
connections.remove(socket);
@@ -499,14 +470,10 @@
} catch(java.net.SocketException e) {
// SocketExceptions are normal
- AjpAprProtocol.log.debug
- (sm.getString
- ("ajpprotocol.proto.socketexception.debug"), e);
+ CoyoteLogger.AJP_LOGGER.socketException(e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- AjpAprProtocol.log.debug
- (sm.getString
- ("ajpprotocol.proto.ioexception.debug"), e);
+ CoyoteLogger.AJP_LOGGER.socketException(e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
@@ -515,8 +482,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- AjpAprProtocol.log.error
- (sm.getString("ajpprotocol.proto.error"), e);
+ CoyoteLogger.AJP_LOGGER.socketError(e);
}
recycledProcessors.offer(processor);
return SocketState.CLOSED;
@@ -541,13 +507,10 @@
ObjectName rpName = new ObjectName
(proto.getDomain() + ":type=RequestProcessor,worker="
+ proto.getJmxName() + ",name=AjpRequest" +
count);
- if (log.isDebugEnabled()) {
- log.debug("Register " + rpName);
- }
Registry.getRegistry(null, null).registerComponent(rp, rpName,
null);
rp.setRpName(rpName);
} catch (Exception e) {
- log.warn("Error registering request");
+ CoyoteLogger.AJP_LOGGER.errorRegisteringRequest(e);
}
}
}
@@ -560,13 +523,10 @@
synchronized (this) {
try {
ObjectName rpName = rp.getRpName();
- if (log.isDebugEnabled()) {
- log.debug("Unregister " + rpName);
- }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
- log.warn("Error unregistering request", e);
+ CoyoteLogger.AJP_LOGGER.errorUnregisteringRequest(e);
}
}
}
Modified: trunk/src/main/java/org/apache/coyote/ajp/AjpMessage.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/ajp/AjpMessage.java 2012-07-19 15:51:17 UTC (rev
2054)
+++ trunk/src/main/java/org/apache/coyote/ajp/AjpMessage.java 2012-07-26 12:58:36 UTC (rev
2055)
@@ -17,10 +17,12 @@
package org.apache.coyote.ajp;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
* A single packet for communication between the web server and the
@@ -41,13 +43,6 @@
protected static org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(AjpMessage.class);
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
// ------------------------------------------------------------ Constructor
@@ -162,8 +157,7 @@
*/
public void appendBytes(MessageBytes mb) {
if (mb == null) {
- log.error(sm.getString("ajpmessage.null"),
- new NullPointerException());
+ CoyoteLogger.AJP_LOGGER.cannotAppendNull();
appendInt(0);
appendByte(0);
return;
@@ -186,8 +180,7 @@
*/
public void appendByteChunk(ByteChunk bc) {
if (bc == null) {
- log.error(sm.getString("ajpmessage.null"),
- new NullPointerException());
+ CoyoteLogger.AJP_LOGGER.cannotAppendNull();
appendInt(0);
appendByte(0);
return;
@@ -202,8 +195,7 @@
*/
public void appendCharChunk(CharChunk cc) {
if (cc == null) {
- log.error(sm.getString("ajpmessage.null"),
- new NullPointerException());
+ CoyoteLogger.AJP_LOGGER.cannotAppendNull();
appendInt(0);
appendByte(0);
return;
@@ -237,8 +229,7 @@
*/
public void appendString(String str) {
if (str == null) {
- log.error(sm.getString("ajpmessage.null"),
- new NullPointerException());
+ CoyoteLogger.AJP_LOGGER.cannotAppendNull();
appendInt(0);
appendByte(0);
return;
@@ -275,8 +266,7 @@
*/
public void appendBytes(byte[] b, int off, int numBytes) {
if (pos + numBytes + 3 > buf.length) {
- log.error(sm.getString("ajpmessage.overflow", "" +
numBytes, "" + pos),
- new ArrayIndexOutOfBoundsException());
+ CoyoteLogger.AJP_LOGGER.ajpMessageOverflow(numBytes, pos);
if (log.isDebugEnabled()) {
dump("Overflow/coBytes");
}
@@ -343,7 +333,7 @@
public int getBytes(byte[] dest) {
int length = getInt();
if (pos + length > buf.length) {
- log.error(sm.getString("ajpmessage.read", "" + length));
+ CoyoteLogger.AJP_LOGGER.ajpMessageUnderflow(length);
return 0;
}
@@ -392,7 +382,7 @@
len = getInt();
// Verify message signature
if ((mark != 0x1234) && (mark != 0x4142)) {
- log.error(sm.getString("ajpmessage.invalid", "" +
mark));
+ CoyoteLogger.AJP_LOGGER.invalidAjpMessage(mark);
if (log.isDebugEnabled()) {
dump("In: ");
}
Deleted: trunk/src/main/java/org/apache/coyote/ajp/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/ajp/LocalStrings.properties 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/ajp/LocalStrings.properties 2012-07-26 12:58:36
UTC (rev 2055)
@@ -1,39 +0,0 @@
-# $Id: LocalStrings.properties 1657 2011-02-10 15:47:18Z remy.maucherat(a)jboss.com $
-
-# language
-
-# package org.apache.coyote.ajp
-
-#
-# AjpAprProtocol
-#
-
-ajpprotocol.endpoint.initerror=Error initializing endpoint
-ajpprotocol.endpoint.starterror=Error starting endpoint
-ajpprotocol.init=Initializing Coyote AJP/1.3 on {0}
-ajpprotocol.proto.error=Error reading request, ignored
-ajpprotocol.getattribute=Attribute {0}
-ajpprotocol.setattribute=Attribute {0}: {1}
-ajpprotocol.start=Starting Coyote AJP/1.3 on {0}
-ajpprotocol.stop=Stopping Coyote AJP/1.3 on {0}
-ajpprotocol.cannotDestroy=Skip destroy for Coyote AJP/1.3 on {0} due to active request
processors
-ajpprotocol.pause=Pausing Coyote AJP/1.3 on {0}
-ajpprotocol.endpoint.pauseerror=Error pausing endpoint
-ajpprotocol.resume=Resuming Coyote AJP/1.3 on {0}
-ajpprotocol.endpoint.resumeerror=Error resuming endpoint
-ajpprotocol.failedread=Socket read failed
-ajpprotocol.failedwrite=Socket write failed
-ajpprotocol.request.register=Error registering request processor in JMX
-ajpprotocol.badmessage=Invalid message received
-
-ajpprocessor.header.error=Header message parsing failed
-ajpprocessor.request.prepare=Error preparing request
-ajpprocessor.request.process=Error processing request
-ajpprocessor.certs.fail=Certificate conversion failed
-ajpprocessor.socket.info=Exception getting socket information
-
-ajpmessage.null=Cannot append null value
-ajpmessage.overflow=Overflow error for buffer adding {0} bytes at position {1}
-ajpmessage.read=Requested {0} bytes exceeds message available data
-ajpmessage.invalid=Invalid message received with signature {0}
-
Deleted: trunk/src/main/java/org/apache/coyote/ajp/LocalStrings_es.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/ajp/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/ajp/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,24 +0,0 @@
-ajpprotocol.endpoint.initerror = Error inicializando punto final
-ajpprotocol.endpoint.starterror = Error arrancando punto final
-ajpprotocol.init = Inicializando Coyote AJP/1.3 en {0}
-ajpprotocol.proto.error = Error leyendo requerimiento, ignorado
-ajpprotocol.getattribute = Atributo {0}
-ajpprotocol.setattribute = Atributo {0}\: {1}
-ajpprotocol.start = Arrancando Coyote AJP/1.3 en {0}
-ajpprotocol.stop = Parando Coyote AJP/1.3 en {0}
-ajpprotocol.pause = Pausando Coyote AJP/1.3 en {0}
-ajpprotocol.endpoint.pauseerror = Error pausando punto final
-ajpprotocol.resume = Retomando Coyote AJP/1.3 en {0}
-ajpprotocol.endpoint.resumeerror = Error retomando punto final
-ajpprotocol.failedread = Fallo en lectura de Conector
-ajpprotocol.failedwrite = Fallo en escritura de Conector
-ajpprotocol.request.register = Error registrando procesador de requerimiento en JMX
-ajpprocessor.header.error = Fallo en an\u00E1lisis de mensaje de cabecera
-ajpprocessor.request.prepare = Error preparando requerimiento
-ajpprocessor.request.process = Error procesando requerimiento
-ajpprocessor.certs.fail = Fallo en conversi\u00F3n de Certificado
-ajpprocessor.socket.info = Excepci\u00F3n obteniendo informaci\u00F3n de conector
-ajpmessage.null = No puedo a\u00F1adir valor nulo
-ajpmessage.overflow = Error de desbordamiento en b\u00FAfer al a\u00F1adir {0} bytes en
posici\u00F3n {1}
-ajpmessage.read = Los {0} bytes requeridos exceden los datos disponibles de mensaje
-ajpmessage.invalid = Mensaje inv\u00E1lido recibido con firma {0}
Modified: trunk/src/main/java/org/apache/coyote/http11/AbstractInternalInputBuffer.java
===================================================================
---
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalInputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalInputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -21,6 +21,8 @@
*/
package org.apache.coyote.http11;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -30,8 +32,6 @@
import org.apache.coyote.Request;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.res.StringManager;
-import org.jboss.logging.Logger;
/**
* {@code AbstractInternalInputBuffer}
@@ -43,16 +43,6 @@
public abstract class AbstractInternalInputBuffer implements InputBuffer {
/**
- *
- */
- protected static final Logger log =
Logger.getLogger(AbstractInternalInputBuffer.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm = StringManager.getManager(Constants.Package);
-
- /**
* Associated Coyote request.
*/
protected Request request;
@@ -325,7 +315,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
chr = buf[pos++];
@@ -345,7 +335,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -363,7 +353,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
@@ -387,7 +377,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -420,7 +410,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
@@ -442,7 +432,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -491,7 +481,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
chr = buf[pos];
@@ -520,7 +510,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -554,7 +544,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -573,7 +563,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -600,7 +590,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/AbstractInternalOutputBuffer.java
===================================================================
---
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalOutputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/coyote/http11/AbstractInternalOutputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -33,8 +33,6 @@
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.res.StringManager;
-import org.jboss.logging.Logger;
/**
* {@code AbstractInternalOutputBuffer}
@@ -46,16 +44,6 @@
public abstract class AbstractInternalOutputBuffer implements OutputBuffer {
/**
- *
- */
- protected static final Logger log =
Logger.getLogger(AbstractInternalOutputBuffer.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm = StringManager.getManager(Constants.Package);
-
- /**
* Associated Coyote response.
*/
protected Response response;
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProcessor.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProcessor.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProcessor.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -36,7 +36,7 @@
import org.apache.tomcat.util.net.SSLSupport;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.NioEndpoint.Handler.SocketState;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
* {@code Http11AbstractProcessor}
@@ -47,17 +47,6 @@
*/
public abstract class Http11AbstractProcessor implements ActionHook {
- /**
- * Logger.
- */
- protected static org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(Http11AbstractProcessor.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm = StringManager.getManager(Constants.Package);
-
protected static final boolean CHUNK_ON_CLOSE = Boolean.valueOf(
System.getProperty("org.apache.coyote.http11.Http11Processor.CHUNK_ON_CLOSE",
"false"))
.booleanValue();
@@ -285,7 +274,7 @@
Pattern nRule = Pattern.compile(userAgent);
noCompressionUserAgents = addREArray(noCompressionUserAgents, nRule);
} catch (PatternSyntaxException pse) {
- log.error(sm.getString("http11processor.regexp.error", userAgent), pse);
+ CoyoteLogger.HTTP_LOGGER.errorParsingRegexp(userAgent, pse);
}
}
@@ -438,7 +427,7 @@
Pattern nRule = Pattern.compile(userAgent);
restrictedUserAgents = addREArray(restrictedUserAgents, nRule);
} catch (PatternSyntaxException pse) {
- log.error(sm.getString("http11processor.regexp.error", userAgent), pse);
+ CoyoteLogger.HTTP_LOGGER.errorParsingRegexp(userAgent, pse);
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProtocol.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProtocol.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11AbstractProtocol.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -32,7 +32,6 @@
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.tomcat.util.net.SSLImplementation;
-import org.apache.tomcat.util.res.StringManager;
/**
* {@code Http11AbstractProtocol}
@@ -47,14 +46,6 @@
*/
public abstract class Http11AbstractProtocol implements ProtocolHandler,
MBeanRegistration {
- protected static org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(Http11NioProtocol.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm = StringManager.getManager(Constants.Package);
-
protected HashMap<String, Object> attributes = new HashMap<String,
Object>();
// *
protected ObjectName tpOname = null;
@@ -152,9 +143,6 @@
*/
@Override
public void setAttribute(String name, Object value) {
- if (log.isTraceEnabled())
- log.trace(sm.getString("http11protocol.setattribute", name, value));
-
attributes.put(name, value);
}
@@ -165,8 +153,6 @@
*/
@Override
public Object getAttribute(String key) {
- if (log.isTraceEnabled())
- log.trace(sm.getString("http11protocol.getattribute", key));
return attributes.get(key);
}
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -56,7 +56,7 @@
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.AprEndpoint.Handler.SocketState;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
@@ -67,19 +67,6 @@
public class Http11AprProcessor implements ActionHook {
- /**
- * Logger.
- */
- protected static org.jboss.logging.Logger log
- = org.jboss.logging.Logger.getLogger(Http11AprProcessor.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
protected static final boolean CHUNK_ON_CLOSE =
Boolean.valueOf(System.getProperty("org.apache.coyote.http11.Http11Processor.CHUNK_ON_CLOSE",
"false")).booleanValue();
@@ -425,7 +412,7 @@
noCompressionUserAgents =
addREArray(noCompressionUserAgents, nRule);
} catch (PatternSyntaxException pse) {
- log.error(sm.getString("http11processor.regexp.error", userAgent),
pse);
+ CoyoteLogger.HTTP_LOGGER.errorParsingRegexp(userAgent, pse);
}
}
@@ -529,10 +516,10 @@
} else if (obj instanceof OutputFilter) {
outputBuffer.addFilter((OutputFilter) obj);
} else {
- log.warn(sm.getString("http11processor.filter.unknown",
className));
+ CoyoteLogger.HTTP_LOGGER.unknownFilter(className);
}
} catch (Exception e) {
- log.error(sm.getString("http11processor.filter.error", className),
e);
+ CoyoteLogger.HTTP_LOGGER.errorInitializingFilter(className, e);
}
}
@@ -611,7 +598,7 @@
Pattern nRule = Pattern.compile(userAgent);
restrictedUserAgents = addREArray(restrictedUserAgents, nRule);
} catch (PatternSyntaxException pse) {
- log.error(sm.getString("http11processor.regexp.error", userAgent),
pse);
+ CoyoteLogger.HTTP_LOGGER.errorParsingRegexp(userAgent, pse);
}
}
@@ -781,7 +768,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.process"), t);
+ CoyoteLogger.HTTP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -866,9 +853,7 @@
error = true;
break;
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("http11processor.header.parse"),
t);
- }
+ CoyoteLogger.HTTP_LOGGER.errorParsingHeader(t);
// 400 - Bad Request
response.setStatus(400);
error = true;
@@ -879,9 +864,7 @@
try {
prepareRequest();
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("http11processor.request.prepare"),
t);
- }
+ CoyoteLogger.HTTP_LOGGER.errorPreparingRequest(t);
// 400 - Internal Server Error
response.setStatus(400);
error = true;
@@ -907,7 +890,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.process"),
t);
+ CoyoteLogger.HTTP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -983,7 +966,7 @@
} catch (IOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.finish"), t);
+ CoyoteLogger.HTTP_LOGGER.errorFinishingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -993,7 +976,7 @@
} catch (IOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.response.finish"), t);
+ CoyoteLogger.HTTP_LOGGER.errorFinishingResponse(t);
error = true;
}
@@ -1092,7 +1075,7 @@
long sa = Address.get(Socket.APR_REMOTE, socket);
remoteAddr = Address.getip(sa);
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.remoteAddr().setString(remoteAddr);
@@ -1105,7 +1088,7 @@
long sa = Address.get(Socket.APR_LOCAL, socket);
localName = Address.getnameinfo(sa, 0);
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.localName().setString(localName);
@@ -1122,7 +1105,7 @@
remoteHost = remoteAddr;
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.remoteHost().setString(remoteHost);
@@ -1135,7 +1118,7 @@
long sa = Address.get(Socket.APR_LOCAL, socket);
localAddr = Address.getip(sa);
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
@@ -1150,7 +1133,7 @@
Sockaddr addr = Address.getInfo(sa);
remotePort = addr.port;
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.setRemotePort(remotePort);
@@ -1164,7 +1147,7 @@
Sockaddr addr = Address.getInfo(sa);
localPort = addr.port;
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.setLocalPort(localPort);
@@ -1204,7 +1187,7 @@
request.setAttribute(org.apache.tomcat.util.net.Constants.SESSION_ID_KEY, sslO);
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.ssl"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e);
}
}
@@ -1244,7 +1227,7 @@
}
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.ssl"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e);
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11AprProtocol.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -44,7 +44,7 @@
import org.apache.tomcat.util.net.AprEndpoint;
import org.apache.tomcat.util.net.SocketStatus;
import org.apache.tomcat.util.net.AprEndpoint.Handler;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
@@ -57,15 +57,6 @@
*/
public class Http11AprProtocol implements ProtocolHandler, MBeanRegistration {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(Http11AprProtocol.class);
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
public Http11AprProtocol() {
setSoLinger(Constants.DEFAULT_CONNECTION_LINGER);
setSoTimeout(Constants.DEFAULT_CONNECTION_TIMEOUT);
@@ -76,15 +67,10 @@
/** Pass config info
*/
public void setAttribute( String name, Object value ) {
- if( log.isTraceEnabled())
- log.trace(sm.getString("http11protocol.setattribute", name,
value));
-
attributes.put(name, value);
}
public Object getAttribute( String key ) {
- if( log.isTraceEnabled())
- log.trace(sm.getString("http11protocol.getattribute", key));
return attributes.get(key);
}
@@ -120,11 +106,10 @@
try {
endpoint.init();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorInitializingEndpoint(ex);
throw ex;
}
- if(log.isDebugEnabled())
- log.debug(sm.getString("http11protocol.init", getName()));
+ CoyoteLogger.HTTP_LOGGER.initHttpConnector(getName());
}
@@ -136,14 +121,14 @@
if( this.domain != null ) {
try {
tpOname=new ObjectName
- (domain + ":" + "type=ThreadPool,name=" +
getName());
+ (domain + ":" + "type=ThreadPool,name=" +
getName());
Registry.getRegistry(null, null)
.registerComponent(endpoint, tpOname, null );
} catch (Exception e) {
- log.error("Can't register threadpool" );
+ CoyoteLogger.HTTP_LOGGER.errorRegisteringPool(e);
}
rgOname=new ObjectName
- (domain + ":type=GlobalRequestProcessor,name=" + getName());
+ (domain + ":type=GlobalRequestProcessor,name=" +
getName());
Registry.getRegistry(null, null).registerComponent
( cHandler.global, rgOname, null );
}
@@ -151,18 +136,17 @@
try {
endpoint.start();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.starterror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorStartingEndpoint(ex);
throw ex;
}
- if(log.isInfoEnabled())
- log.info(sm.getString("http11protocol.start", getName()));
+ CoyoteLogger.HTTP_LOGGER.startHttpConnector(getName());
}
public void pause() throws Exception {
try {
endpoint.pause();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorPausingEndpoint(ex);
throw ex;
}
canDestroy = false;
@@ -188,28 +172,25 @@
canDestroy = true;
}
}
- if(log.isInfoEnabled())
- log.info(sm.getString("http11protocol.pause", getName()));
+ CoyoteLogger.HTTP_LOGGER.pauseHttpConnector(getName());
}
public void resume() throws Exception {
try {
endpoint.resume();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.resumeerror"),
ex);
+ CoyoteLogger.HTTP_LOGGER.errorResumingEndpoint(ex);
throw ex;
}
- if(log.isInfoEnabled())
- log.info(sm.getString("http11protocol.resume", getName()));
+ CoyoteLogger.HTTP_LOGGER.resumeHttpConnector(getName());
}
public void destroy() throws Exception {
- if(log.isInfoEnabled())
- log.info(sm.getString("http11protocol.stop", getName()));
+ CoyoteLogger.HTTP_LOGGER.stopHttpConnector(getName());
if (canDestroy) {
endpoint.destroy();
} else {
- log.warn(sm.getString("http11protocol.cannotDestroy", getName()));
+ CoyoteLogger.HTTP_LOGGER.cannotDestroyHttpProtocol(getName());
try {
RequestInfo[] states = cHandler.global.getRequestProcessors();
for (int i = 0; i < states.length; i++) {
@@ -218,7 +199,7 @@
}
}
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.cannotDestroy",
getName()), ex);
+
CoyoteLogger.HTTP_LOGGER.cannotDestroyHttpProtocolWithException(getName(), ex);
throw ex;
}
}
@@ -587,14 +568,10 @@
state = result.event(status);
} catch (java.net.SocketException e) {
// SocketExceptions are normal
- Http11AprProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.socketexception.debug"),
e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- Http11AprProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.ioexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
@@ -603,8 +580,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11AprProtocol.log.error
- (sm.getString("http11protocol.proto.error"), e);
+ CoyoteLogger.HTTP_LOGGER.socketError(e);
} finally {
if (state != SocketState.LONG) {
connections.remove(socket);
@@ -651,14 +627,10 @@
} catch (java.net.SocketException e) {
// SocketExceptions are normal
- Http11AprProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.socketexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- Http11AprProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.ioexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
@@ -667,8 +639,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11AprProtocol.log.error
- (sm.getString("http11protocol.proto.error"), e);
+ CoyoteLogger.HTTP_LOGGER.socketError(e);
}
recycledProcessors.offer(processor);
return SocketState.CLOSED;
@@ -703,13 +674,10 @@
ObjectName rpName = new ObjectName
(proto.getDomain() +
":type=RequestProcessor,worker="
+ proto.getJmxName() + ",name=HttpRequest" +
count);
- if (log.isDebugEnabled()) {
- log.debug("Register " + rpName);
- }
Registry.getRegistry(null, null).registerComponent(rp, rpName,
null);
rp.setRpName(rpName);
} catch (Exception e) {
- log.warn("Error registering request");
+ CoyoteLogger.HTTP_LOGGER.errorRegisteringRequest(e);
}
}
}
@@ -722,13 +690,10 @@
synchronized (this) {
try {
ObjectName rpName = rp.getRpName();
- if (log.isDebugEnabled()) {
- log.debug("Unregister " + rpName);
- }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
- log.warn("Error unregistering request", e);
+ CoyoteLogger.HTTP_LOGGER.errorUnregisteringRequest(e);
}
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -46,6 +46,7 @@
import org.apache.tomcat.util.net.NioEndpoint;
import org.apache.tomcat.util.net.NioEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.SocketStatus;
+import org.jboss.web.CoyoteLogger;
/**
* {@code Http11NioProcessor}
@@ -151,10 +152,10 @@
} else if (obj instanceof OutputFilter) {
outputBuffer.addFilter((OutputFilter) obj);
} else {
- log.warn(sm.getString("http11processor.filter.unknown", className));
+ CoyoteLogger.HTTP_LOGGER.unknownFilter(className);
}
} catch (Exception e) {
- log.error(sm.getString("http11processor.filter.error", className), e);
+ CoyoteLogger.HTTP_LOGGER.errorInitializingFilter(className, e);
}
}
@@ -228,7 +229,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.process"), t);
+ CoyoteLogger.HTTP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -321,9 +322,7 @@
error = true;
break;
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("http11processor.header.parse"), t);
- }
+ CoyoteLogger.HTTP_LOGGER.errorParsingHeader(t);
// 400 - Bad Request
response.setStatus(400);
error = true;
@@ -333,9 +332,7 @@
try {
prepareRequest();
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("http11processor.request.prepare"), t);
- }
+ CoyoteLogger.HTTP_LOGGER.errorPreparingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -362,7 +359,7 @@
} catch (InterruptedIOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.process"), t);
+ CoyoteLogger.HTTP_LOGGER.errorProcessingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -440,7 +437,7 @@
} catch (IOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.request.finish"), t);
+ CoyoteLogger.HTTP_LOGGER.errorFinishingRequest(t);
// 500 - Internal Server Error
response.setStatus(500);
error = true;
@@ -450,7 +447,7 @@
} catch (IOException e) {
error = true;
} catch (Throwable t) {
- log.error(sm.getString("http11processor.response.finish"), t);
+ CoyoteLogger.HTTP_LOGGER.errorFinishingResponse(t);
error = true;
}
}
@@ -551,7 +548,7 @@
try {
remoteAddr = ((InetSocketAddress) this.channel.getRemoteAddress()).getHostName();
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.remoteAddr().setString(remoteAddr);
@@ -565,7 +562,7 @@
try {
localName = ((InetSocketAddress) this.channel.getLocalAddress()).getHostName();
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.localName().setString(localName);
@@ -584,7 +581,7 @@
remoteHost = remoteAddr;
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.remoteHost().setString(remoteHost);
@@ -599,7 +596,7 @@
localAddr = ((InetSocketAddress) this.channel.getLocalAddress()).getAddress()
.getHostAddress();
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
@@ -614,7 +611,7 @@
try {
remotePort = ((InetSocketAddress) this.channel.getRemoteAddress()).getPort();
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.setRemotePort(remotePort);
@@ -628,7 +625,7 @@
try {
localPort = ((InetSocketAddress) this.channel.getLocalAddress()).getPort();
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.info"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSocketInformation(e);
}
}
request.setLocalPort(localPort);
@@ -654,7 +651,7 @@
request.setAttribute(org.apache.tomcat.util.net.Constants.SESSION_ID_KEY, sslO);
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.ssl"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e);
}
}
@@ -676,7 +673,7 @@
request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, sslO);
}
} catch (Exception e) {
- log.warn(sm.getString("http11processor.socket.ssl"), e);
+ CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e);
}
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/Http11NioProtocol.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -22,7 +22,6 @@
package org.apache.coyote.http11;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.URLEncoder;
import java.nio.channels.ClosedChannelException;
@@ -99,7 +98,7 @@
endpoint.setServerSocketChannelFactory(socketFactory);
}
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.socketfactory.initerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorInitializingSocketFactory(ex);
throw ex;
}
@@ -116,11 +115,11 @@
// endpoint.setKeepAliveTimeout(this.timeout);
endpoint.init();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.initerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorInitializingEndpoint(ex);
throw ex;
}
- CoyoteLogger.ROOT_LOGGER.initConnector(getName());
+ CoyoteLogger.HTTP_LOGGER.initHttpConnector(getName());
}
/*
@@ -136,7 +135,7 @@
tpOname = new ObjectName(domain + ":" + "type=ThreadPool,name="
+ getName());
Registry.getRegistry(null, null).registerComponent(endpoint, tpOname, null);
} catch (Exception e) {
- log.error("Can't register threadpool");
+ CoyoteLogger.HTTP_LOGGER.errorRegisteringPool(e);
}
rgOname = new ObjectName(domain + ":type=GlobalRequestProcessor,name=" +
getName());
Registry.getRegistry(null, null).registerComponent(cHandler.global, rgOname, null);
@@ -145,11 +144,10 @@
try {
endpoint.start();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.starterror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorStartingEndpoint(ex);
throw ex;
}
-
- CoyoteLogger.ROOT_LOGGER.startConnector(getName());
+ CoyoteLogger.HTTP_LOGGER.startHttpConnector(getName());
}
/*
@@ -162,7 +160,7 @@
try {
endpoint.pause();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorPausingEndpoint(ex);
throw ex;
}
canDestroy = false;
@@ -188,8 +186,7 @@
canDestroy = true;
}
}
-
- log.info(sm.getString("http11protocol.pause", getName()));
+ CoyoteLogger.HTTP_LOGGER.pauseHttpConnector(getName());
}
/*
@@ -202,11 +199,10 @@
try {
endpoint.resume();
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.endpoint.resumeerror"), ex);
+ CoyoteLogger.HTTP_LOGGER.errorResumingEndpoint(ex);
throw ex;
}
-
- log.info(sm.getString("http11protocol.resume", getName()));
+ CoyoteLogger.HTTP_LOGGER.resumeHttpConnector(getName());
}
/*
@@ -216,11 +212,11 @@
*/
@Override
public void destroy() throws Exception {
- log.info(sm.getString("http11protocol.stop", getName()));
+ CoyoteLogger.HTTP_LOGGER.stopHttpConnector(getName());
if (canDestroy) {
endpoint.destroy();
} else {
- log.warn(sm.getString("http11protocol.cannotDestroy", getName()));
+ CoyoteLogger.HTTP_LOGGER.cannotDestroyHttpProtocol(getName());
try {
RequestInfo[] states = cHandler.global.getRequestProcessors();
for (int i = 0; i < states.length; i++) {
@@ -229,7 +225,7 @@
}
}
} catch (Exception ex) {
- log.error(sm.getString("http11protocol.cannotDestroy", getName()), ex);
+ CoyoteLogger.HTTP_LOGGER.cannotDestroyHttpProtocolWithException(getName(), ex);
throw ex;
}
}
@@ -241,24 +237,23 @@
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.coyote.http11.Http11AbstractProtocol#getName()
- */
- public String getName() {
- String encodedAddr = "";
- if (getAddress() != null) {
- encodedAddr = "" + getAddress();
- try {
- encodedAddr = URLEncoder.encode(encodedAddr.replace('/', '-'),
"UTF-8") + "-";
- } catch (UnsupportedEncodingException e) {
- log.warn("UTF-8 encoding is not supported");
- }
- }
- return ("http-" + encodedAddr + endpoint.getPort());
- }
+ public String getJmxName() {
+ String encodedAddr = "";
+ if (getAddress() != null) {
+ encodedAddr = "" + getAddress();
+ encodedAddr = URLEncoder.encode(encodedAddr.replace('/',
'-').replace(':', '_').replace('%', '-')) +
"-";
+ }
+ return ("http-" + encodedAddr + endpoint.getPort());
+ }
+ public String getName() {
+ String encodedAddr = "";
+ if (getAddress() != null) {
+ encodedAddr = getAddress() + ":";
+ }
+ return ("http-" + encodedAddr + endpoint.getPort());
+ }
+
/**
* @return the executor
*/
@@ -826,12 +821,10 @@
state = processor.event(status);
} catch (java.net.SocketException e) {
// SocketExceptions are normal
- Http11NioProtocol.log.debug(
- sm.getString("http11protocol.proto.socketexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- Http11NioProtocol.log.debug(
- sm.getString("http11protocol.proto.ioexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
@@ -840,7 +833,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11NioProtocol.log.error(sm.getString("http11protocol.proto.error"),
e);
+ CoyoteLogger.HTTP_LOGGER.socketError(e);
} finally {
if (state != SocketState.LONG) {
connections.remove(channel.getId());
@@ -932,12 +925,10 @@
} catch (IOException e) {
if (e instanceof java.net.SocketException) {
// SocketExceptions are normal
- Http11NioProtocol.log.debug(
- sm.getString("http11protocol.proto.socketexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
} else {
// IOExceptions are normal
- Http11NioProtocol.log.debug(
- sm.getString("http11protocol.proto.ioexception.debug"), e);
+ CoyoteLogger.HTTP_LOGGER.socketException(e);
}
}
// Future developers: if you discover any other
@@ -947,7 +938,7 @@
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11NioProtocol.log.error(sm.getString("http11protocol.proto.error"),
e);
+ CoyoteLogger.HTTP_LOGGER.socketError(e);
}
recycledProcessors.offer(processor);
return SocketState.CLOSED;
@@ -985,16 +976,12 @@
try {
long count = registerCount.incrementAndGet();
ObjectName rpName = new ObjectName(proto.getDomain()
- + ":type=RequestProcessor,worker=" + proto.getName()
+ + ":type=RequestProcessor,worker=" + proto.getJmxName()
+ ",name=HttpRequest" + count);
- if (log.isDebugEnabled()) {
- log.debug("Register " + rpName);
- }
Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
rp.setRpName(rpName);
} catch (Exception e) {
- e.printStackTrace();
- log.warn("Error registering request");
+ CoyoteLogger.HTTP_LOGGER.errorRegisteringRequest(e);
}
}
}
@@ -1010,14 +997,10 @@
synchronized (this) {
try {
ObjectName rpName = rp.getRpName();
- if (log.isDebugEnabled()) {
- log.debug("Unregister " + rpName);
- }
Registry.getRegistry(null, null).unregisterComponent(rpName);
rp.setRpName(null);
} catch (Exception e) {
- e.printStackTrace();
- log.warn("Error unregistering request", e);
+ CoyoteLogger.HTTP_LOGGER.errorUnregisteringRequest(e);
}
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/InternalAprInputBuffer.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -18,6 +18,8 @@
package org.apache.coyote.http11;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.EOFException;
import java.net.SocketTimeoutException;
@@ -29,7 +31,6 @@
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.net.AprEndpoint;
-import org.apache.tomcat.util.res.StringManager;
import org.apache.coyote.InputBuffer;
import org.apache.coyote.Request;
@@ -74,16 +75,6 @@
}
- // -------------------------------------------------------------- Variables
-
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
// ----------------------------------------------------- Instance Variables
@@ -417,7 +408,7 @@
return false;
}
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
chr = buf[pos++];
@@ -434,7 +425,7 @@
return false;
}
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
//
@@ -449,7 +440,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
// Spec says single SP but it also says be tolerant of HT
@@ -467,7 +458,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
pos++;
@@ -492,7 +483,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
// Spec says single SP but it also says be tolerant of HT
@@ -528,7 +519,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
pos++;
@@ -551,7 +542,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.CR) {
@@ -611,7 +602,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
chr = buf[pos];
@@ -645,7 +636,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.COLON) {
@@ -682,7 +673,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if ((buf[pos] == Constants.SP) || (buf[pos] == Constants.HT)) {
@@ -701,7 +692,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.CR) {
@@ -728,7 +719,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
chr = buf[pos];
@@ -802,8 +793,7 @@
if (parsingHeader) {
if (lastValid == buf.length) {
- throw new IllegalArgumentException
- (sm.getString("iib.requestheadertoolarge.error"));
+ throw MESSAGES.requestHeaderTooLarge();
}
bbuf.clear();
@@ -816,7 +806,7 @@
if ((-nRead) == Status.EAGAIN) {
return false;
} else {
- throw new IOException(sm.getString("iib.failedread"));
+ throw new IOException(MESSAGES.failedRead());
}
}
@@ -839,7 +829,7 @@
lastValid = pos + nRead;
} else if (nRead <= 0) {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
- throw new
SocketTimeoutException(sm.getString("iib.failedread"));
+ throw new SocketTimeoutException(MESSAGES.failedRead());
} else if ((-nRead) == Status.EAGAIN && nonBlocking) {
// As asynchronous reads are forbidden, this test is not useful
// && (Http11AprProcessor.containerThread.get() ==
Boolean.TRUE)
@@ -855,14 +845,14 @@
lastValid = pos + nRead;
} else if (nRead <= 0) {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
- throw new
SocketTimeoutException(sm.getString("iib.failedread"));
+ throw new SocketTimeoutException(MESSAGES.failedRead());
} else {
- throw new
IOException(sm.getString("iib.failedread"));
+ throw new IOException(MESSAGES.failedRead());
}
}
}
} else {
- throw new IOException(sm.getString("iib.failedread"));
+ throw new IOException(MESSAGES.failedRead());
}
}
available = false;
Modified: trunk/src/main/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/InternalAprOutputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -17,6 +17,8 @@
package org.apache.coyote.http11;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -27,7 +29,6 @@
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.http.MimeHeaders;
import org.apache.tomcat.util.net.AprEndpoint;
-import org.apache.tomcat.util.res.StringManager;
import org.apache.coyote.ActionCode;
import org.apache.coyote.OutputBuffer;
@@ -82,16 +83,6 @@
}
- // -------------------------------------------------------------- Variables
-
-
- /**
- * The string manager for this package.
- */
- protected static StringManager sm =
- StringManager.getManager(Constants.Package);
-
-
// ----------------------------------------------------- Instance Variables
@@ -405,7 +396,7 @@
if (!committed) {
if (Socket.send(socket, Constants.ACK_BYTES, 0, Constants.ACK_BYTES.length)
< 0)
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
}
@@ -548,7 +539,7 @@
// If non blocking (event) and there are leftover bytes,
// and lastWrite was 0 -> error
if (leftover.getLength() > 0 &&
!(Http11AprProcessor.containerThread.get() == Boolean.TRUE)) {
- throw new IOException(sm.getString("oob.backlog"));
+ throw new IOException(MESSAGES.invalidBacklog());
}
if (lastActiveFilter == -1)
@@ -735,7 +726,7 @@
}
}
if (res < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
response.setLastWrite(res);
if (pos < end) {
@@ -768,7 +759,7 @@
}
}
if (res < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
response.setLastWrite(res);
}
@@ -812,7 +803,7 @@
bbuf.clear();
Socket.timeoutSet(socket, 0);
} else {
- throw new IOException(sm.getString("oob.backlog"));
+ throw new IOException(MESSAGES.invalidBacklog());
}
}
@@ -856,7 +847,7 @@
response.setLastWrite(res);
bbuf.clear();
if (res < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
}
Modified: trunk/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -21,6 +21,8 @@
*/
package org.apache.coyote.http11;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.EOFException;
import java.io.IOException;
import java.net.SocketTimeoutException;
@@ -35,6 +37,7 @@
import org.apache.tomcat.util.net.NioChannel;
import org.apache.tomcat.util.net.NioEndpoint;
import org.apache.tomcat.util.net.SocketStatus;
+import org.jboss.web.CoyoteLogger;
/**
* {@code InternalNioInputBuffer}
@@ -208,7 +211,7 @@
return false;
}
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -225,7 +228,7 @@
return false;
}
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -239,7 +242,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -257,7 +260,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
@@ -279,7 +282,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
// Spec says single SP but it also says be tolerant of HT
@@ -311,7 +314,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
if (buf[pos] == Constants.SP || buf[pos] == Constants.HT) {
pos++;
@@ -332,7 +335,7 @@
// Read new bytes if needed
if (pos >= lastValid) {
if (!fill()) {
- throw new EOFException(sm.getString("iib.eof.error"));
+ throw new EOFException(MESSAGES.eofError());
}
}
@@ -404,9 +407,9 @@
bbuf.get(buf, pos, nRead);
lastValid = pos + nRead;
} else if (nRead == NioChannel.OP_STATUS_CLOSED) {
- throw new IOException(sm.getString("iib.failedread"));
+ throw new IOException(MESSAGES.failedRead());
} else if (nRead == NioChannel.OP_STATUS_READ_TIMEOUT) {
- throw new SocketTimeoutException(sm.getString("iib.failedread"));
+ throw new SocketTimeoutException(MESSAGES.failedRead());
}
}
@@ -421,7 +424,7 @@
if (parsingHeader) {
if (lastValid == buf.length) {
- throw new
IllegalArgumentException(sm.getString("iib.requestheadertoolarge.error"));
+ throw new IllegalArgumentException(MESSAGES.requestHeaderTooLarge());
}
} else {
if (buf.length - end < 4500) {
@@ -457,8 +460,8 @@
try {
ch.read(bb, ch, this.completionHandler);
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug("An error occurs when trying a non-blocking read ", t);
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.errorWithNonBlockingRead(t);
}
}
}
@@ -487,8 +490,8 @@
close(channel);
}
} catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("An error occurs when trying a blocking read " +
e.getMessage());
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.errorWithBlockingRead(e);
}
}
return nr;
Modified: trunk/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -21,6 +21,8 @@
*/
package org.apache.coyote.http11;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.CompletionHandler;
@@ -31,6 +33,7 @@
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.net.NioChannel;
import org.apache.tomcat.util.net.NioEndpoint;
+import org.jboss.web.CoyoteLogger;
/**
* {@code InternalNioOutputBuffer}
@@ -161,8 +164,8 @@
close(channel);
}
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(t.getMessage(), t);
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.errorWithBlockingWrite(t);
}
}
@@ -184,8 +187,8 @@
// Perform the write operation
this.channel.write(this.bbuf, timeout, unit, this.channel, this.completionHandler);
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug(t.getMessage(), t);
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.errorWithNonBlockingWrite(t);
}
}
}
@@ -218,7 +221,7 @@
this.bbuf.clear();
this.bbuf.put(Constants.ACK_BYTES).flip();
if (this.write(writeTimeout, TimeUnit.MILLISECONDS) < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
}
}
@@ -242,7 +245,7 @@
// If non blocking (event) and there are leftover bytes,
// and lastWrite was 0 -> error
if (leftover.getLength() > 0 && !(Http11NioProcessor.containerThread.get()
== Boolean.TRUE)) {
- throw new IOException(sm.getString("oob.backlog"));
+ throw new IOException(MESSAGES.invalidBacklog());
}
if (lastActiveFilter == -1) {
@@ -285,12 +288,12 @@
}
bbuf.clear();
if (res < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
}
leftover.recycle();
} else {
- throw new IOException(sm.getString("oob.backlog"));
+ throw new IOException(MESSAGES.invalidBacklog());
}
}
@@ -314,7 +317,7 @@
}
if (res < 0) {
- throw new IOException(sm.getString("oob.failedwrite"));
+ throw new IOException(MESSAGES.failedWrite());
}
}
}
@@ -341,7 +344,7 @@
@Override
public void completed(Integer result, Void attachment) {
if (result < 0) {
- failed(new IOException(sm.getString("oob.failedwrite")), attachment);
+ failed(new IOException(MESSAGES.failedWrite()), attachment);
return;
}
response.setLastWrite(result);
Deleted: trunk/src/main/java/org/apache/coyote/http11/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,59 +0,0 @@
-# $Id: LocalStrings.properties 1657 2011-02-10 15:47:18Z remy.maucherat(a)jboss.com $
-
-# language
-
-# package org.apache.coyote.http11
-
-#
-# Http11Protocol
-#
-
-http11protocol.endpoint.initerror=Error initializing endpoint
-http11protocol.endpoint.starterror=Error starting endpoint
-http11protocol.init=Initializing Coyote HTTP/1.1 on {0}
-http11protocol.proto.error=Error reading request, ignored
-http11protocol.proto.ioexception.debug=IOException reading request
-http11protocol.proto.ioexception.info=IOException reading request, ignored
-http11protocol.proto.socketexception.debug=SocketException reading request
-http11protocol.proto.socketexception.info=SocketException reading request, ignored
-http11protocol.getattribute=Attribute {0}
-http11protocol.setattribute=Attribute {0}: {1}
-http11protocol.socketfactory.initerror=Error initializing socket factory
-http11protocol.start=Starting Coyote HTTP/1.1 on {0}
-http11protocol.stop=Stopping Coyote HTTP/1.1 on {0}
-http11protocol.cannotDestroy=Skip destroy for Coyote HTTP/1.1 on {0} due to active
request processors
-http11protocol.pause=Pausing Coyote HTTP/1.1 on {0}
-http11protocol.endpoint.pauseerror=Error pausing endpoint
-http11protocol.resume=Resuming Coyote HTTP/1.1 on {0}
-http11protocol.endpoint.resumeerror=Error resuming endpoint
-
-#
-# Http11Processor
-#
-
-http11processor.regexp.error=Error parsing regular expression {0}
-http11processor.filter.unknown=Unknown filter {0}
-http11processor.filter.error=Error intializing filter {0}
-http11processor.header.parse=Error parsing HTTP request header
-http11processor.request.prepare=Error preparing request
-http11processor.request.process=Error processing request
-http11processor.request.finish=Error finishing request
-http11processor.response.finish=Error finishing response
-http11processor.socket.info=Exception getting socket information
-http11processor.socket.ssl=Exception getting SSL attributes
-http11processor.socket.timeout=Error setting socket timeout
-
-#
-# InternalInputBuffer
-#
-
-iib.eof.error=Unexpected EOF read on the socket
-iib.requestheadertoolarge.error=Request header is too large
-
-#
-# InternalOutputBuffer
-#
-
-oob.failedwrite=Write failure
-oob.backlog=Backlog is present
-
Deleted: trunk/src/main/java/org/apache/coyote/http11/LocalStrings_es.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,54 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# $Id: LocalStrings_es.properties 789 2008-09-22 16:52:37Z remy.maucherat(a)jboss.com $
-# language es
-# package org.apache.coyote.http11
-#
-# Http11Protocol
-http11protocol.endpoint.initerror = Error inicializando punto final (endpoint)
-http11protocol.endpoint.starterror = Error arrancando punto final (endpoint)
-http11protocol.init = Inicializando Coyote HTTP/1.1 en puerto {0}
-http11protocol.proto.error = Error leyendo requerimiento, ignorado
-http11protocol.proto.ioexception.debug = IOException leyendo requerimiento
-http11protocol.proto.ioexception.info = IOException leyendo requerimiento, ignorada
-http11protocol.proto.socketexception.debug = SocketException leyendo requerimiento
-http11protocol.proto.socketexception.info = SocketException leyendo requerimiento,
ignorada
-http11protocol.getattribute = Atributo {0}
-http11protocol.setattribute = Atributo {0}\: {1}
-http11protocol.socketfactory.initerror = Error inicializando f\u00E1brica de enchufes
(sockets)
-http11protocol.start = Arrancando Coyote HTTP/1.1 en puerto {0}
-http11protocol.stop = Parando Coyote HTTP/1.1 en puerto {0}
-http11protocol.pause = Pausando Coyote HTTP/1.1 en puerto {0}
-http11protocol.endpoint.pauseerror = Error al pausar punto final
-http11protocol.resume = Retomando Coyote HTTP/1.1 en {0}
-http11protocol.endpoint.resumeerror = Error al retomar punto final
-http11processor.regexp.error = Error al analizar expresi\u00F3n regular {0}
-http11processor.filter.unknown = Filtro desconocido {0}
-http11processor.filter.error = Error inicializando filtro {0}
-http11processor.header.parse = Error analizando cabecera de requerimiento HTTP
-http11processor.request.prepare = Error preparando requerimiento
-http11processor.request.process = Error procesando requerimiento
-http11processor.request.finish = Error acabando requerimiento
-http11processor.response.finish = Error acabando respuesta
-http11processor.socket.info = Excepci\u00F3n obteniendo informaci\u00F3n de conector
-http11processor.socket.ssl = Excepci\u00F3n obteniendo atributos SSL
-http11processor.socket.timeout = Error poniendo tiempo agotado para conector
-#
-# Http11Processor
-#
-#
-# InternalInputBuffer
-iib.eof.error = Inesperado Fin De Archivo (EOF) le\u00EDdo en el enchufe (socket)
-iib.requestheadertoolarge.error = La cabecera del requerimiento es demasido grande
Deleted: trunk/src/main/java/org/apache/coyote/http11/LocalStrings_fr.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/LocalStrings_fr.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/LocalStrings_fr.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,36 +0,0 @@
-# $Id: LocalStrings_fr.properties 520 2008-03-17 21:29:47Z jfrederic.clere(a)jboss.com $
-
-# language fr
-
-# package org.apache.coyote.http11
-
-#
-# Http11Protocol
-#
-
-http11protocol.endpoint.initerror=Erreur � l'initialisation du point de contact
-http11protocol.endpoint.starterror=Erreur au d�marrage du point de contact
-http11protocol.init=Initialisation de Coyote HTTP/1.1 sur {0}
-http11protocol.proto.error=Erreur � la lecture de la requ�te, ignor�
-http11protocol.proto.ioexception.debug=Exception d'entr�e/sortie (IOException) � la
lecture de la requ�te
-http11protocol.proto.ioexception.info=Exception d'entr�e/sortie � la lecture de la
requ�te, ignor�
-http11protocol.proto.socketexception.debug=Exception "Socket" (SocketException)
� la lecture de la requ�te
-http11protocol.proto.socketexception.info=Exception "Socket" (SocketException)
� la lecture de la requ�te, ignor�
-http11protocol.setattribute=Attribut {0}: {1}
-http11protocol.socketfactory.initerror=Erreur � l'initialisation du cr�ateur de
socket (socket factory)
-http11protocol.start=D�marrage de Coyote HTTP/1.1 sur {0}
-http11protocol.stop=Arr�t de Coyote HTTP/1.1 sur {0}
-http11protocol.pause=Suspension de Coyote HTTP/1.1 sur {0}
-http11protocol.resume=Red�marrage de Coyote HTTP/1.1 sur {0}
-
-#
-# Http11Processor
-#
-
-#
-# InternalInputBuffer
-#
-
-iib.eof.error=Fin de flux (EOF) inattendue � la lecture sur la socket
-iib.requestheadertoolarge.error=L'ent�te de requ�te est trop important
-
Deleted: trunk/src/main/java/org/apache/coyote/http11/LocalStrings_ja.properties
===================================================================
--- trunk/src/main/java/org/apache/coyote/http11/LocalStrings_ja.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/coyote/http11/LocalStrings_ja.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,39 +0,0 @@
-# $Id: LocalStrings_ja.properties 520 2008-03-17 21:29:47Z jfrederic.clere(a)jboss.com $
-
-# language ja
-
-# package org.apache.coyote.http11
-
-#
-# Http11Protocol
-#
-
-http11protocol.endpoint.initerror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-http11protocol.endpoint.starterror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u8d77\u52d5\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-http11protocol.init=Coyote HTTP/1.1\u3092 {0} \u3067\u521d\u671f\u5316\u3057\u307e\u3059
-http11protocol.proto.error=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
-http11protocol.proto.ioexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059
-http11protocol.proto.ioexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eIOException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
-http11protocol.proto.socketexception.debug=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059
-http11protocol.proto.socketexception.info=\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u8aad\u307f\u8fbc\u307f\u4e2d\u306eSocketException\u3067\u3059\u304c\u3001\u7121\u8996\u3055\u308c\u307e\u3057\u305f
-http11protocol.setattribute=\u5c5e\u6027 {0}: {1}
-http11protocol.socketfactory.initerror=\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30af\u30c8\u30ea\u3092\u521d\u671f\u5316\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-http11protocol.start=Coyote HTTP/1.1\u3092 {0} \u3067\u8d77\u52d5\u3057\u307e\u3059
-http11protocol.stop=Coyote HTTP/1.1\u3092 {0} \u3067\u505c\u6b62\u3057\u307e\u3059
-http11protocol.pause=Coyote HTTP/1.1\u3092 {0}
\u3067\u4e00\u6642\u505c\u6b62\u3057\u307e\u3059
-http11protocol.endpoint.pauseerror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u4e00\u6642\u505c\u6b62\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-http11protocol.resume=Coyote HTTP/1.1\u3092 {0} \u3067\u518d\u958b\u3057\u307e\u3059
-http11protocol.endpoint.resumeerror=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u306e\u518d\u958b\u4e2d\u306e\u30a8\u30e9\u30fc\u3067\u3059
-
-
-#
-# Http11Processor
-#
-
-#
-# InternalInputBuffer
-#
-
-iib.eof.error=\u30bd\u30b1\u30c3\u30c8\u304b\u3089\u4e88\u671f\u3057\u306a\u3044EOF\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3057\u305f
-iib.requestheadertoolarge.error=\u30ea\u30af\u30a8\u30b9\u30c8\u30d8\u30c3\u30c0\u304c\u9577\u3059\u304e\u307e\u3059
-
Modified: trunk/src/main/java/org/apache/tomcat/util/buf/HexUtils.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/buf/HexUtils.java 2012-07-19 15:51:17 UTC
(rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/buf/HexUtils.java 2012-07-26 12:58:36 UTC
(rev 2055)
@@ -17,8 +17,9 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.ByteArrayOutputStream;
-import org.apache.tomcat.util.res.StringManager;
/**
* Library of utility methods useful in dealing with converting byte arrays
@@ -66,13 +67,6 @@
(byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' };
- /**
- * The string manager for this package.
- */
- private static StringManager sm =
- StringManager.getManager("org.apache.tomcat.util.buf.res");
-
-
// --------------------------------------------------------- Static Methods
@@ -88,35 +82,32 @@
*/
public static byte[] convert(String digits) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- for (int i = 0; i < digits.length(); i += 2) {
- char c1 = digits.charAt(i);
- if ((i+1) >= digits.length())
- throw new IllegalArgumentException
- (sm.getString("hexUtil.odd"));
- char c2 = digits.charAt(i + 1);
- byte b = 0;
- if ((c1 >= '0') && (c1 <= '9'))
- b += ((c1 - '0') * 16);
- else if ((c1 >= 'a') && (c1 <= 'f'))
- b += ((c1 - 'a' + 10) * 16);
- else if ((c1 >= 'A') && (c1 <= 'F'))
- b += ((c1 - 'A' + 10) * 16);
- else
- throw new IllegalArgumentException
- (sm.getString("hexUtil.bad"));
- if ((c2 >= '0') && (c2 <= '9'))
- b += (c2 - '0');
- else if ((c2 >= 'a') && (c2 <= 'f'))
- b += (c2 - 'a' + 10);
- else if ((c2 >= 'A') && (c2 <= 'F'))
- b += (c2 - 'A' + 10);
- else
- throw new IllegalArgumentException
- (sm.getString("hexUtil.bad"));
- baos.write(b);
- }
- return (baos.toByteArray());
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ for (int i = 0; i < digits.length(); i += 2) {
+ char c1 = digits.charAt(i);
+ if ((i+1) >= digits.length())
+ throw MESSAGES.hexaOdd();
+ char c2 = digits.charAt(i + 1);
+ byte b = 0;
+ if ((c1 >= '0') && (c1 <= '9'))
+ b += ((c1 - '0') * 16);
+ else if ((c1 >= 'a') && (c1 <= 'f'))
+ b += ((c1 - 'a' + 10) * 16);
+ else if ((c1 >= 'A') && (c1 <= 'F'))
+ b += ((c1 - 'A' + 10) * 16);
+ else
+ throw MESSAGES.hexaBad();
+ if ((c2 >= '0') && (c2 <= '9'))
+ b += (c2 - '0');
+ else if ((c2 >= 'a') && (c2 <= 'f'))
+ b += (c2 - 'a' + 10);
+ else if ((c2 >= 'A') && (c2 <= 'F'))
+ b += (c2 - 'A' + 10);
+ else
+ throw MESSAGES.hexaBad();
+ baos.write(b);
+ }
+ return (baos.toByteArray());
}
@@ -148,28 +139,28 @@
* is included
*/
public static int convert2Int( byte[] hex ) {
- // Code from Ajp11, from Apache's JServ
-
- // assert b.length==4
- // assert valid data
- int len;
- if(hex.length < 4 ) return 0;
- if( DEC[hex[0]]<0 )
- throw new IllegalArgumentException(sm.getString("hexUtil.bad"));
- len = DEC[hex[0]];
- len = len << 4;
- if( DEC[hex[1]]<0 )
- throw new IllegalArgumentException(sm.getString("hexUtil.bad"));
- len += DEC[hex[1]];
- len = len << 4;
- if( DEC[hex[2]]<0 )
- throw new IllegalArgumentException(sm.getString("hexUtil.bad"));
- len += DEC[hex[2]];
- len = len << 4;
- if( DEC[hex[3]]<0 )
- throw new IllegalArgumentException(sm.getString("hexUtil.bad"));
- len += DEC[hex[3]];
- return len;
+ // Code from Ajp11, from Apache's JServ
+
+ // assert b.length==4
+ // assert valid data
+ int len;
+ if(hex.length < 4 ) return 0;
+ if( DEC[hex[0]]<0 )
+ throw MESSAGES.hexaBad();
+ len = DEC[hex[0]];
+ len = len << 4;
+ if( DEC[hex[1]]<0 )
+ throw MESSAGES.hexaBad();
+ len += DEC[hex[1]];
+ len = len << 4;
+ if( DEC[hex[2]]<0 )
+ throw MESSAGES.hexaBad();
+ len += DEC[hex[2]];
+ len = len << 4;
+ if( DEC[hex[3]]<0 )
+ throw MESSAGES.hexaBad();
+ len += DEC[hex[3]];
+ return len;
}
Modified: trunk/src/main/java/org/apache/tomcat/util/buf/UEncoder.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/buf/UEncoder.java 2012-07-19 15:51:17 UTC
(rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/buf/UEncoder.java 2012-07-26 12:58:36 UTC
(rev 2055)
@@ -17,9 +17,7 @@
package org.apache.tomcat.util.buf;
-import java.io.CharArrayWriter;
import java.io.IOException;
-import java.io.Writer;
import java.util.BitSet;
/** Efficient implementation for encoders.
@@ -35,9 +33,6 @@
*/
public final class UEncoder {
- private static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(UEncoder.class);
-
// Not static - the set may differ ( it's better than adding
// an extra check for "/", "+", etc
private BitSet safeChars=null;
@@ -47,7 +42,6 @@
private CharChunk output=null;
private String encoding="UTF8";
- private static final int debug=0;
public UEncoder() {
initSafeChars();
@@ -82,10 +76,8 @@
for (int i = start; i < end; i++) {
char c = s.charAt(i);
if (safeChars.get(c)) {
- if( debug > 0 ) log("Safe: " + (char)c);
output.append(c);
} else {
- if( debug > 0 ) log("Unsafe: " + (char)c);
cb.append(c);
c2b.convert(cb, bb);
@@ -95,7 +87,6 @@
if ((i+1) < end) {
char d = s.charAt(i+1);
if (d >= 0xDC00 && d <= 0xDFFF) {
- if( debug > 0 ) log("Unsafe: " + d);
cb.append(d);
c2b.convert(cb, bb);
i++;
@@ -126,43 +117,34 @@
// -------------------- Internal implementation --------------------
- //
- private void init() {
-
- }
-
private void initSafeChars() {
- safeChars=new BitSet(128);
- int i;
- for (i = 'a'; i <= 'z'; i++) {
- safeChars.set(i);
- }
- for (i = 'A'; i <= 'Z'; i++) {
- safeChars.set(i);
- }
- for (i = '0'; i <= '9'; i++) {
- safeChars.set(i);
- }
- //safe
- safeChars.set('$');
- safeChars.set('-');
- safeChars.set('_');
- safeChars.set('.');
+ safeChars=new BitSet(128);
+ int i;
+ for (i = 'a'; i <= 'z'; i++) {
+ safeChars.set(i);
+ }
+ for (i = 'A'; i <= 'Z'; i++) {
+ safeChars.set(i);
+ }
+ for (i = '0'; i <= '9'; i++) {
+ safeChars.set(i);
+ }
+ //safe
+ safeChars.set('$');
+ safeChars.set('-');
+ safeChars.set('_');
+ safeChars.set('.');
- // Dangerous: someone may treat this as " "
- // RFC1738 does allow it, it's not reserved
- // safeChars.set('+');
- //extra
- safeChars.set('!');
- safeChars.set('*');
- safeChars.set('\'');
- safeChars.set('(');
- safeChars.set(')');
- safeChars.set(',');
+ // Dangerous: someone may treat this as " "
+ // RFC1738 does allow it, it's not reserved
+ // safeChars.set('+');
+ //extra
+ safeChars.set('!');
+ safeChars.set('*');
+ safeChars.set('\'');
+ safeChars.set('(');
+ safeChars.set(')');
+ safeChars.set(',');
}
- private static void log( String s ) {
- if (log.isDebugEnabled())
- log.debug("Encoder: " + s );
- }
}
Modified: trunk/src/main/java/org/apache/tomcat/util/buf/UTF8Decoder.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/buf/UTF8Decoder.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/buf/UTF8Decoder.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
/**
@@ -34,9 +36,6 @@
public final class UTF8Decoder extends B2CConverter {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(UTF8Decoder.class );
-
// may have state !!
public UTF8Decoder()
@@ -48,104 +47,80 @@
}
public void convert(ByteChunk mb, CharChunk cb )
- throws IOException
- {
- int bytesOff=mb.getOffset();
- int bytesLen=mb.getLength();
- byte bytes[]=mb.getBytes();
-
- int j=bytesOff;
- int end=j+bytesLen;
+ throws IOException {
+ int bytesOff=mb.getOffset();
+ int bytesLen=mb.getLength();
+ byte bytes[]=mb.getBytes();
- while( j< end ) {
- int b0=0xff & bytes[j];
+ int j=bytesOff;
+ int end=j+bytesLen;
- if( (b0 & 0x80) == 0 ) {
- cb.append((char)b0);
- j++;
- continue;
- }
-
- // 2 byte ?
- if( j++ >= end ) {
- // ok, just ignore - we could throw exception
- throw new IOException( "Conversion error - EOF " );
- }
- int b1=0xff & bytes[j];
-
- // ok, let's the fun begin - we're handling UTF8
- if ((0xe0 & b0) == 0xc0) { // 110yyyyy 10xxxxxx (0x80 to 0x7ff)
- int ch = ((0x1f & b0)<<6) + (0x3f & b1);
- if(debug>0)
- log("Convert " + b0 + " " + b1 + " " + ch +
((char)ch));
-
- cb.append((char)ch);
- j++;
- continue;
- }
-
- if( j++ >= end )
- return ;
- int b2=0xff & bytes[j];
-
- if( (b0 & 0xf0 ) == 0xe0 ) {
- if ((b0 == 0xED && b1 >= 0xA0) ||
- (b0 == 0xEF && b1 == 0xBF && b2 >= 0xBE)) {
- if(debug>0)
- log("Error " + b0 + " " + b1+ " " + b2 );
+ while( j< end ) {
+ int b0=0xff & bytes[j];
- throw new IOException( "Conversion error 2");
- }
+ if( (b0 & 0x80) == 0 ) {
+ cb.append((char)b0);
+ j++;
+ continue;
+ }
- int ch = ((0x0f & b0)<<12) + ((0x3f & b1)<<6) + (0x3f & b2);
- cb.append((char)ch);
- if(debug>0)
- log("Convert " + b0 + " " + b1+ " " + b2 + "
" + ch +
- ((char)ch));
- j++;
- continue;
- }
+ // 2 byte ?
+ if( j++ >= end ) {
+ // ok, just ignore - we could throw exception
+ throw new IOException(MESSAGES.utf8DecodingEof());
+ }
+ int b1=0xff & bytes[j];
- if( j++ >= end )
- return ;
- int b3=0xff & bytes[j];
+ // ok, let's the fun begin - we're handling UTF8
+ if ((0xe0 & b0) == 0xc0) { // 110yyyyy 10xxxxxx (0x80 to 0x7ff)
+ int ch = ((0x1f & b0)<<6) + (0x3f & b1);
- if (( 0xf8 & b0 ) == 0xf0 ) {
- if (b0 > 0xF4 || (b0 == 0xF4 && b1 >= 0x90)) {
- if(debug>0)
- log("Convert " + b0 + " " + b1+ " " + b2 + " "
+ b3);
- throw new IOException( "Conversion error ");
- }
- int ch = ((0x0f & b0)<<18) + ((0x3f & b1)<<12) +
- ((0x3f & b2)<<6) + (0x3f & b3);
+ cb.append((char)ch);
+ j++;
+ continue;
+ }
- if(debug>0)
- log("Convert " + b0 + " " + b1+ " " + b2 + "
" + b3 + " " +
- ch + ((char)ch));
+ if( j++ >= end )
+ return ;
+ int b2=0xff & bytes[j];
- if (ch < 0x10000) {
- cb.append( (char)ch );
- } else {
- cb.append((char)(((ch-0x00010000)>>10)+
- 0xd800));
- cb.append((char)(((ch-0x00010000)&0x3ff)+
- 0xdc00));
- }
- j++;
- continue;
- } else {
- // XXX Throw conversion exception !!!
- if(debug>0)
- log("Convert " + b0 + " " + b1+ " " + b2 + "
" + b3);
- throw new IOException( "Conversion error 4" );
- }
- }
- }
+ if( (b0 & 0xf0 ) == 0xe0 ) {
+ if ((b0 == 0xED && b1 >= 0xA0) ||
+ (b0 == 0xEF && b1 == 0xBF && b2 >= 0xBE)) {
+ throw new IOException(MESSAGES.utf8DecodingFailure(b0, b1, b2));
+ }
- private static int debug=1;
- void log(String s ) {
- if (log.isDebugEnabled())
- log.debug("UTF8Decoder: " + s );
+ int ch = ((0x0f & b0)<<12) + ((0x3f & b1)<<6) + (0x3f
& b2);
+ cb.append((char)ch);
+ j++;
+ continue;
+ }
+
+ if( j++ >= end )
+ return ;
+ int b3=0xff & bytes[j];
+
+ if (( 0xf8 & b0 ) == 0xf0 ) {
+ if (b0 > 0xF4 || (b0 == 0xF4 && b1 >= 0x90)) {
+ throw new IOException(MESSAGES.utf8DecodingFailure(b0, b1, b2, b3));
+ }
+ int ch = ((0x0f & b0)<<18) + ((0x3f & b1)<<12) +
+ ((0x3f & b2)<<6) + (0x3f & b3);
+
+ if (ch < 0x10000) {
+ cb.append( (char)ch );
+ } else {
+ cb.append((char)(((ch-0x00010000)>>10)+
+ 0xd800));
+ cb.append((char)(((ch-0x00010000)&0x3ff)+
+ 0xdc00));
+ }
+ j++;
+ continue;
+ } else {
+ throw new IOException(MESSAGES.utf8DecodingFailure(b0, b1, b2, b3));
+ }
+ }
}
-
+
}
Deleted: trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,3 +0,0 @@
-hexUtil.bad=Bad hexadecimal digit
-hexUtil.odd=Odd number of hexadecimal digits
-httpDate.pe=invalid date format: {0}
Deleted: trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-hexUtil.bad=D�gito hexadecimal incorrecto
-hexUtil.odd=N�mero de d�gitos hexadecimales incorrecto
-httpDate.pe=formato de fecha no v�lido: {0}
-
Deleted: trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_fr.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,3 +0,0 @@
-hexUtil.bad=Mauvais digit hexad�cimal
-hexUtil.odd=Nombre impair de digits hexad�cimaux
-httpDate.pe=Format de date invalide: {0}
Deleted: trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/buf/res/LocalStrings_ja.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,3 +0,0 @@
-hexUtil.bad=\u7121\u52b9\u306a16\u9032\u6570\u5024\u3067\u3059
-hexUtil.odd=\u5947\u6570\u6841\u306e16\u9032\u6570\u5024\u3067\u3059
-httpDate.pe=\u7121\u52b9\u306a\u65e5\u4ed8\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u3059:
{0}
Modified: trunk/src/main/java/org/apache/tomcat/util/http/Cookies.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/Cookies.java 2012-07-19 15:51:17 UTC
(rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/Cookies.java 2012-07-26 12:58:36 UTC
(rev 2055)
@@ -22,6 +22,7 @@
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.MessageBytes;
+import org.jboss.web.CoyoteLogger;
/**
* A collection of cookies - reusable and tuned for server side performance.
@@ -34,9 +35,6 @@
*/
public final class Cookies { // extends MultiMap {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(Cookies.class );
-
// expected average number of cookies per request
public static final int INITIAL_SIZE=4;
ServerCookie scookies[]=new ServerCookie[INITIAL_SIZE];
@@ -146,13 +144,8 @@
// Uncomment to test the new parsing code
if( cookieValue.getType() != MessageBytes.T_BYTES ) {
- Exception e = new Exception();
- log.warn("Cookies: Parsing cookie as String. Expected bytes.",
- e);
cookieValue.toBytes();
}
- if(log.isDebugEnabled())
- log.debug("Cookies: Parsing b[]: " + cookieValue.toString());
ByteChunk bc=cookieValue.getByteChunk();
processCookieHeader( bc.getBytes(),
bc.getOffset(),
@@ -161,7 +154,6 @@
}
}
- // XXX will be refactored soon!
private static boolean equals( String s, byte b[], int start, int end) {
int blen = end-start;
if (b == null || blen != s.length()) {
@@ -337,8 +329,7 @@
// INVALID COOKIE, advance to next delimiter
// The starting character of the cookie value was
// not valid.
- log.info("Cookies: Invalid cookie. " +
- "Value not a token or quoted value");
+ CoyoteLogger.HTTP_LOGGER.invalidCookieHeader(new String(bytes,
off, len));
while (pos < end && bytes[pos] != ';'
&&
bytes[pos] != ',')
{pos++; }
@@ -419,7 +410,7 @@
}
// Unknown cookie, complain
- log.info("Cookies: Unknown Special Cookie");
+ CoyoteLogger.HTTP_LOGGER.invalidSpecialCookie(new String(bytes,
nameStart, nameEnd - nameStart));
} else { // Normal Cookie
sc = addCookie();
Modified: trunk/src/main/java/org/apache/tomcat/util/http/HttpMessages.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/HttpMessages.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/HttpMessages.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -17,8 +17,11 @@
package org.apache.tomcat.util.http;
-import org.apache.tomcat.util.res.StringManager;
+import java.io.InputStream;
+import java.util.Properties;
+import org.jboss.web.CoyoteLogger;
+
/**
* Handle (internationalized) HTTP messages.
*
@@ -29,10 +32,18 @@
* @author costin(a)eng.sun.com
*/
public class HttpMessages {
- // XXX move message resources in this package
- protected static StringManager sm =
- StringManager.getManager("org.apache.tomcat.util.http.res");
+ protected static Properties statusMessages = new Properties();
+
+ static {
+ try {
+ InputStream is =
HttpMessages.class.getClassLoader().getResourceAsStream("org/apache/tomcat/util/http/HttpMessages.properties");
+ statusMessages.load(is);
+ } catch (Exception e) {
+ CoyoteLogger.HTTP_LOGGER.errorLoadingMessages(e);
+ }
+ }
+
static String st_200=null;
static String st_302=null;
static String st_400=null;
@@ -53,19 +64,19 @@
// are pre-defined? The user doesn't see them most of the time
switch( status ) {
case 200:
- if( st_200==null ) st_200=sm.getString( "sc.200");
+ if( st_200==null ) st_200=statusMessages.getProperty( "sc.200");
return st_200;
case 302:
- if( st_302==null ) st_302=sm.getString( "sc.302");
+ if( st_302==null ) st_302=statusMessages.getProperty( "sc.302");
return st_302;
case 400:
- if( st_400==null ) st_400=sm.getString( "sc.400");
+ if( st_400==null ) st_400=statusMessages.getProperty( "sc.400");
return st_400;
case 404:
- if( st_404==null ) st_404=sm.getString( "sc.404");
+ if( st_404==null ) st_404=statusMessages.getProperty( "sc.404");
return st_404;
}
- return sm.getString("sc."+ status);
+ return statusMessages.getProperty("sc."+ status);
}
/**
Deleted: trunk/src/main/java/org/apache/tomcat/util/http/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-parameters.bytes=Start processing with input [{0}]
-parameters.copyFail=Failed to create copy of original parameter values for debug logging
purposes
-parameters.decodeFail.debug=Character decoding failed. Parameter [{0}] with value [{1}]
has been ignored.
-parameters.decodeFail.info=Character decoding failed. Parameter [{0}] with value [{1}]
has been ignored. Note that the name and value quoted here may be corrupted due to the
failed decoding. Use debug level logging to see the original, non-corrupted values.
-parameters.emptyChunk=Empty parameter chunk ignored
-parameters.invalidChunk=Invalid chunk starting at byte [{0}] and ending at byte [{1}]
with a value of [{2}] ignored
-parameters.maxCountFail=More than the maximum number of request parameters (GET plus
POST) for a single request ([{0}]) were detected. Any parameters beyond this limit have
been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
-parameters.maxCountFail.fallToDebug=\n Note: further occurrences of this error will be
logged at DEBUG level.
-parameters.multipleDecodingFail=Character decoding failed. A total of [{0}] failures were
detected. Enable debug level logging for this logger to log all failures.
-parameters.noequal=Parameter starting at position [{0}] and ending at position [{1}] with
a value of [{0}] was not followed by an '=' character
-parameters.fallToDebug=\n Note: further occurrences of Parameter errors will be logged at
DEBUG level.
-parameters.failed=Parameters processing failed.
-
-cookies.invalidCookieToken=Cookies: Invalid cookie. Value not a token or quoted value
-cookies.invalidSpecial=Cookies: Unknown Special Cookie
-cookies.fallToDebug=\n Note: further occurrences of Cookie errors will be logged at DEBUG
level.
Modified: trunk/src/main/java/org/apache/tomcat/util/http/MimeHeaders.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/MimeHeaders.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/MimeHeaders.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Enumeration;
@@ -326,7 +328,7 @@
int len = headers.length;
if (count >= len) {
if (count >= MAX_COUNT) {
- throw new IllegalStateException("Header count exceeded allowed
maximum: " + MAX_COUNT);
+ throw MESSAGES.maxHeadersFail(MAX_COUNT);
}
// expand header list array
MimeHeaderField tmp[] = new MimeHeaderField[count * 2];
Modified: trunk/src/main/java/org/apache/tomcat/util/http/Parameters.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/Parameters.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/Parameters.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -28,7 +30,7 @@
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.buf.UDecoder;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
*
@@ -36,12 +38,6 @@
*/
public final class Parameters {
- protected static org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(Parameters.class);
-
- protected static final StringManager sm =
- StringManager.getManager("org.apache.tomcat.util.http");
-
protected static final int MAX_COUNT =
Integer.valueOf(System.getProperty("org.apache.tomcat.util.http.Parameters.MAX_COUNT",
"512")).intValue();
@@ -84,16 +80,10 @@
public void setEncoding( String s ) {
encoding=s;
- if(log.isDebugEnabled()) {
- log.debug( "Set encoding to " + s );
- }
}
public void setQueryStringEncoding( String s ) {
queryStringEncoding=s;
- if(log.isDebugEnabled()) {
- log.debug( "Set query string encoding to " + s );
- }
}
public boolean isParseFailed() {
@@ -169,11 +159,6 @@
return;
}
- if(log.isDebugEnabled()) {
- log.debug("Decoding query " + decodedQuery + " " +
- queryStringEncoding);
- }
-
try {
decodedQuery.duplicate( queryMB );
} catch (IOException e) {
@@ -196,8 +181,7 @@
// Processing this parameter will push us over the limit. ISE is
// what Request.parseParts() uses for requests that are too big
parseFailed = true;
- throw new IllegalStateException(sm.getString(
- "parameters.maxCountFail", Integer.valueOf(limit)));
+ throw MESSAGES.maxParametersFail(limit);
}
ArrayList<String> values = paramHashValues.get(key);
@@ -231,9 +215,8 @@
private void processParameters(byte bytes[], int start, int len, String enc) {
- if(log.isDebugEnabled()) {
- log.debug(sm.getString("parameters.bytes",
- new String(bytes, start, len, DEFAULT_CHARSET)));
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.startProcessingParameter(new String(bytes, start,
len, DEFAULT_CHARSET));
}
int decodeFailCount = 0;
@@ -300,24 +283,21 @@
}
}
- if (log.isDebugEnabled() && valueStart == -1) {
- log.debug(sm.getString("parameters.noequal",
- Integer.valueOf(nameStart), Integer.valueOf(nameEnd),
- new String(bytes, nameStart, nameEnd-nameStart,
- DEFAULT_CHARSET)));
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled() && valueStart == -1) {
+ CoyoteLogger.HTTP_LOGGER.parameterMissingEqual(nameStart, nameEnd, new
String(bytes, nameStart, nameEnd-nameStart, DEFAULT_CHARSET));
}
if (nameEnd <= nameStart ) {
if (valueStart == -1) {
// &&
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("parameters.emptyChunk"));
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.emptyParamterChunk();
}
// Do not flag as error
continue;
}
// &=foo&
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
String extract;
if (valueEnd >= nameStart) {
extract = new String(bytes, nameStart, valueEnd
@@ -325,10 +305,7 @@
} else {
extract = "";
}
- String message = sm.getString("parameters.invalidChunk",
- Integer.valueOf(nameStart),
- Integer.valueOf(valueEnd), extract);
- log.debug(message);
+ CoyoteLogger.HTTP_LOGGER.parameterInvalid(nameStart, valueEnd,
extract);
}
parseFailed = true;
continue;
@@ -345,7 +322,7 @@
// Take copies as if anything goes wrong originals will be
// corrupted. This means original values can be logged.
// For performance - only done for debug
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
try {
origName.append(bytes, nameStart, nameEnd - nameStart);
if (valueStart >= 0) {
@@ -356,7 +333,7 @@
} catch (IOException ioe) {
// Should never happen...
parseFailed = true;
- log.error(sm.getString("parameters.copyFail"), ioe);
+ CoyoteLogger.HTTP_LOGGER.parametersCopyFailed();
}
}
@@ -384,27 +361,25 @@
} catch (IOException e) {
parseFailed = true;
decodeFailCount++;
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("parameters.decodeFail.debug",
- origName.toString(), origValue.toString()), e);
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.HTTP_LOGGER.parameterDecodingFailed(origName.toString(),
origValue.toString());
}
}
tmpName.recycle();
tmpValue.recycle();
// Only recycle copies if we used them
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.HTTP_LOGGER.isDebugEnabled()) {
origName.recycle();
origValue.recycle();
}
}
- if (decodeFailCount > 1 && log.isDebugEnabled()) {
- log.debug(sm.getString("parameters.multipleDecodingFail",
- Integer.valueOf(decodeFailCount)));
+ if (decodeFailCount > 1 && CoyoteLogger.HTTP_LOGGER.isDebugEnabled())
{
+ CoyoteLogger.HTTP_LOGGER.parametersDecodingFailures(decodeFailCount);
}
if (parseFailed) {
- throw new
IllegalStateException(sm.getString("parameters.failed"));
+ CoyoteLogger.HTTP_LOGGER.parametersProcessingFailed();
}
}
Deleted: trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,46 +0,0 @@
-# HttpMessages
-sc.100=Continue
-sc.101=Switching Protocols
-sc.200=OK
-sc.201=Created
-sc.202=Accepted
-sc.203=Non-Authoritative Information
-sc.204=No Content
-sc.205=Reset Content
-sc.206=Partial Content
-sc.207=Multi-Status
-sc.300=Multiple Choices
-sc.301=Moved Permanently
-sc.302=Moved Temporarily
-sc.303=See Other
-sc.304=Not Modified
-sc.305=Use Proxy
-sc.307=Temporary Redirect
-sc.400=Bad Request
-sc.401=Unauthorized
-sc.402=Payment Required
-sc.403=Forbidden
-sc.404=Not Found
-sc.405=Method Not Allowed
-sc.406=Not Acceptable
-sc.407=Proxy Authentication Required
-sc.408=Request Timeout
-sc.409=Conflict
-sc.410=Gone
-sc.411=Length Required
-sc.412=Precondition Failed
-sc.413=Request Entity Too Large
-sc.414=Request-URI Too Long
-sc.415=Unsupported Media Type
-sc.416=Requested Range Not Satisfiable
-sc.417=Expectation Failed
-sc.422=Unprocessable Entity
-sc.423=Locked
-sc.424=Failed Dependency
-sc.500=Internal Server Error
-sc.501=Not Implemented
-sc.502=Bad Gateway
-sc.503=Service Unavailable
-sc.504=Gateway Timeout
-sc.505=HTTP Version Not Supported
-sc.507=Insufficient Storage
Deleted: trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_es.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,62 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# HttpMessages
-sc.100=Continuar
-sc.101=Cambiando Protocolos
-sc.200=OK
-sc.201=Creado
-sc.202=Aceptado
-sc.203=Informaci�n No-Autorizativa
-sc.204=Sin Contenido
-sc.205=Reset Contenido
-sc.206=Contenido Parcial
-sc.207=Multi-Estado
-sc.300=M�ltiples Elecciones
-sc.301=Movido permanentemente
-sc.302=Movido tempor�lmente
-sc.303=Mirar Otro
-sc.304=No Modificado
-sc.305=Usar Proxy
-sc.307=Redirecci�n Temporal
-sc.400=Petici�n incorrecta
-sc.401=No Autorizado
-sc.402=Pago requerido
-sc.403=Prohibido
-sc.404=No Encontrado
-sc.405=M�todo No Permitido
-sc.406=No Aceptable
-sc.407=Autentificaci�n Proxy Requerida
-sc.408=Request Caducada
-sc.409=Conflicto
-sc.410=Ido
-sc.411=Longitud Requerida
-sc.412=Precondici�n Fallada
-sc.413=Entidad de Request Demasiado Grande
-sc.414=Request-URI Demasiado Larga
-sc.415=Tipo de Medio No Soportado
-sc.416=El Rango Pedido No Ser Satisfecho
-sc.417=Expectativa Fallada
-sc.422=Entidad Improcesable
-sc.423=Bloqueado
-sc.424=Dependencia Fallida
-sc.500=Error Interno del Servidor
-sc.501=No Implementado
-sc.502=Pasarela Incorrecta
-sc.503=Servicio no Disponible
-sc.504=Pasarela Caducada
-sc.505=Versi�n de HTTP No Soportada
-sc.507=Almacenaje Insuficiente
-
Deleted: trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_fr.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_fr.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/http/res/LocalStrings_fr.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,44 +0,0 @@
-sc.100=Continuer
-sc.101=Changement de Protocols
-sc.200=OK
-sc.201=Cr�e
-sc.202=Accept�
-sc.203=Information Sans-Autorit�
-sc.204=Pas de Contenu
-sc.205=Remise � Z�ro de Contenu
-sc.206=Contenu Partiel
-sc.207=Etat Multiple
-sc.300=Choix Multiples
-sc.301=D�plac� de fa�on Permanente
-sc.302=D�plac� Temporairement
-sc.303=Voir Autre
-sc.304=Non Modifi�
-sc.305=Utilisation de Relais
-sc.307=Redirection Temporaire
-sc.400=Mauvaise Requ�te
-sc.401=Non-Autoris�
-sc.402=Paiement N�cessaire
-sc.403=Interdit
-sc.404=Introuvable
-sc.405=M�thode Non Autoris�e
-sc.406=Inacceptable
-sc.407=Authentification de Relais N�cessaire
-sc.408=D�passement de D�lais pour la Requ�te
-sc.409=Conflit
-sc.410=Parti
-sc.411=Taille Demand�e
-sc.412=Echec de Pr�-condition
-sc.413=Entit� de Requ�te Trop Grande
-sc.414=URI de Requ�te Trop Grande
-sc.415=Type de Support Non Support�
-sc.416=Etendue de Requ�te Irr�alisable
-sc.417=Echec d'Attente
-sc.422=Entit� Ing�rable
-sc.424=Echec de D�pendance
-sc.500=Erreur Interne de Servlet
-sc.501=Non Impl�ment�
-sc.502=Mauvaise Passerelle
-sc.503=Service Indisponible
-sc.504=D�passement de D�lais pour la Passerelle
-sc.505=Version HTTP Non Support�e
-sc.507=Stockage Insuffisant
Modified: trunk/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/net/AbstractEndpoint.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -26,8 +26,6 @@
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.tomcat.util.res.StringManager;
-
/**
* {@code AbstractEndpoint}
*
@@ -37,8 +35,6 @@
*/
public abstract class AbstractEndpoint {
- protected static StringManager sm =
StringManager.getManager("org.apache.tomcat.util.net.res");
-
/**
* The default socket timeout = 60 sec
*/
Modified: trunk/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/net/AprEndpoint.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -22,6 +22,8 @@
package
org.apache.tomcat.util.net;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashMap;
@@ -39,8 +41,7 @@
import org.apache.tomcat.jni.SSLSocket;
import org.apache.tomcat.jni.Socket;
import org.apache.tomcat.jni.Status;
-import org.apache.tomcat.util.res.StringManager;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
/**
* APR endpoint, providing the following services:
@@ -57,14 +58,6 @@
public class AprEndpoint {
- // -------------------------------------------------------------- Constants
-
- protected static Logger log = Logger.getLogger(AprEndpoint.class);
-
- protected static StringManager sm =
- StringManager.getManager("org.apache.tomcat.util.net.res");
-
-
// ----------------------------------------------------------------- Fields
@@ -581,12 +574,12 @@
// Bind the server socket
int ret = Socket.bind(serverSock, inetAddress);
if (ret != 0) {
- throw new Exception(sm.getString("endpoint.init.bind",
"" + ret, Error.strerror(ret)));
+ throw MESSAGES.socketBindFailed(ret, Error.strerror(ret));
}
// Start listening on the server socket
ret = Socket.listen(serverSock, backlog);
if (ret != 0) {
- throw new Exception(sm.getString("endpoint.init.listen",
"" + ret, Error.strerror(ret)));
+ throw MESSAGES.socketListenFailed(ret, Error.strerror(ret));
}
if (OS.IS_WIN32 || OS.IS_WIN64) {
// On Windows set the reuseaddr flag after the bind/listen
@@ -634,8 +627,7 @@
SSLContext.setOptions(sslContext,
SSL.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION);
else {
// OpenSSL does not support unsafe legacy renegotiation.
- log.warn(sm.getString("endpoint.warn.noInsecureReneg",
- SSL.versionString()));
+
CoyoteLogger.UTIL_LOGGER.noInsecureRengotiation(SSL.versionString());
}
}
// List the ciphers that the client is permitted to negotiate
@@ -848,20 +840,16 @@
if (sslContext != 0) {
SSLSocket.attach(sslContext, socket);
if (SSLSocket.handshake(socket) != 0) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("endpoint.err.handshake") +
": " + SSL.getLastError());
- }
+ CoyoteLogger.UTIL_LOGGER.handshakeFailed(SSL.getLastError());
return false;
}
}
} catch (Throwable t) {
- if (log.isDebugEnabled()) {
- if (step == 2) {
- log.debug(sm.getString("endpoint.err.handshake"), t);
- } else {
- log.debug(sm.getString("endpoint.err.unexpected"), t);
- }
+ if (step == 2) {
+ CoyoteLogger.UTIL_LOGGER.handshakeFailed(t);
+ } else {
+ CoyoteLogger.UTIL_LOGGER.unexpectedError(t);
}
// Tell to close the socket
return false;
@@ -886,9 +874,7 @@
if ((maxThreads > 0) && (curThreads < maxThreads)) {
curThreadsBusy++;
if (curThreadsBusy == maxThreads) {
- log.info(sm.getString("endpoint.info.maxThreads",
- Integer.toString(maxThreads), address,
- Integer.toString(port)));
+ CoyoteLogger.UTIL_LOGGER.maxThreadsReached(maxThreads, address,
port);
}
return (newWorkerThread());
} else {
@@ -962,10 +948,10 @@
return Poll.create(size, pool, 0, (timeout > 0) ? (timeout * 1000) : -1);
} catch (Error e) {
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
- log.info(sm.getString("endpoint.poll.limitedpollsize",
"" + size));
+ CoyoteLogger.UTIL_LOGGER.limitedPollerSize(size);
return 0;
} else {
- log.error(sm.getString("endpoint.poll.initfail"), e);
+ CoyoteLogger.UTIL_LOGGER.errorCreatingPoller(e);
return -1;
}
}
@@ -990,7 +976,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- log.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
return true;
@@ -1015,7 +1001,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- log.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
return true;
@@ -1040,7 +1026,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- log.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
return true;
@@ -1120,7 +1106,7 @@
// Ignore
}
} catch (Throwable t) {
- log.error(sm.getString("endpoint.accept.fail"),
t);
+ CoyoteLogger.UTIL_LOGGER.errorAcceptingSocket(t);
}
}
}
@@ -1140,7 +1126,7 @@
Socket.destroy(socket);
}
} catch (Throwable t) {
- log.error(sm.getString("endpoint.accept.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorAcceptingSocket(t);
}
}
@@ -1686,7 +1672,7 @@
} catch (InterruptedException e) {
// Ignore
} catch (Throwable t) {
- log.error(sm.getString("endpoint.maintain.error"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
}
}
@@ -1764,7 +1750,7 @@
// the list with the read flag.
timeouts.remove(info.socket);
Socket.destroy(info.socket);
-
log.error(sm.getString("endpoint.poll.error"));
+ CoyoteLogger.UTIL_LOGGER.errorPollingSocket();
}
}
info = localAddList.get();
@@ -1810,7 +1796,7 @@
}
} else {
// Unknown event
-
log.warn(sm.getString("endpoint.poll.flags", "" + desc[n*2]));
+
CoyoteLogger.UTIL_LOGGER.errorPollingSocketCode(desc[n*2]);
if (!processSocket(desc[n*2+1],
SocketStatus.ERROR)) {
// Close socket and clear pool
Socket.destroy(desc[n*2+1]);
@@ -1828,7 +1814,7 @@
}
} else {
// Unknown event
-
log.warn(sm.getString("endpoint.poll.flags", "" + desc[n*2]));
+
CoyoteLogger.UTIL_LOGGER.errorPollingSocketCode(desc[n*2]);
// Close socket and clear pool
Socket.destroy(desc[n*2+1]);
}
@@ -1840,7 +1826,7 @@
if (errn > Status.APR_OS_START_USERERR) {
errn -= Status.APR_OS_START_USERERR;
}
- log.error(sm.getString("endpoint.poll.fail",
"" + errn, Error.strerror(errn)));
+ CoyoteLogger.UTIL_LOGGER.pollerFailure(errn,
Error.strerror(errn));
// Destroy and reallocate the poller
reset = true;
}
@@ -1869,9 +1855,9 @@
} catch (Throwable t) {
if (maintain == 0) {
- log.error(sm.getString("endpoint.maintain.error"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocketTimeout(t);
} else {
- log.error(sm.getString("endpoint.poll.error"), t);
+ CoyoteLogger.UTIL_LOGGER.errorPollingSocketWithException(t);
}
}
@@ -2212,7 +2198,7 @@
}
}
} catch (Exception e) {
- log.error(sm.getString("endpoint.sendfile.error"), e);
+ CoyoteLogger.UTIL_LOGGER.errorSendingFile(e);
return false;
}
// Add socket to the list. Newly added sockets will wait
@@ -2279,7 +2265,7 @@
sendfileData.put(new Long(data.socket), data);
sendfileCount++;
} else {
-
log.warn(sm.getString("endpoint.sendfile.addfail", "" + rv,
Error.strerror(rv)));
+ CoyoteLogger.UTIL_LOGGER.errorSendingFile(rv,
Error.strerror(rv));
// Can't do anything: close the socket right
away
Socket.destroy(data.socket);
}
@@ -2343,7 +2329,7 @@
if (errn > Status.APR_OS_START_USERERR) {
errn -= Status.APR_OS_START_USERERR;
}
- log.error(sm.getString("endpoint.poll.fail",
"" + errn, Error.strerror(errn)));
+ CoyoteLogger.UTIL_LOGGER.pollerFailure(errn,
Error.strerror(errn));
// Handle poll critical failure
synchronized (this) {
destroy();
@@ -2369,7 +2355,7 @@
}
}
} catch (Throwable t) {
- log.error(sm.getString("endpoint.poll.error"), t);
+ CoyoteLogger.UTIL_LOGGER.errorPollingSocketWithException(t);
}
}
Modified: trunk/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/net/NioEndpoint.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -24,7 +24,6 @@
import java.io.File;
import java.io.IOException;
-import java.net.BindException;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousChannelGroup;
@@ -46,7 +45,7 @@
import org.apache.tomcat.util.net.NioEndpoint.Handler.SocketState;
import org.apache.tomcat.util.net.jsse.NioJSSESocketChannelFactory;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
/**
* {@code NioEndpoint} NIO2 endpoint, providing the following services:
@@ -61,8 +60,6 @@
*/
public class NioEndpoint extends AbstractEndpoint {
- protected static Logger logger = Logger.getLogger(NioEndpoint.class);
-
private AsynchronousServerSocketChannel listener;
private ConcurrentHashMap<Long, NioChannel> connections;
private ConcurrentLinkedQueue<ChannelProcessor> recycledChannelProcessors;
@@ -227,14 +224,8 @@
this.serverSocketChannelFactory.init();
if (listener == null) {
- try {
- listener = this.serverSocketChannelFactory.createServerChannel(port, backlog,
- address, reuseAddress);
- } catch (BindException be) {
- logger.fatal(be.getMessage(), be);
- throw new BindException(be.getMessage() + " "
- + (address == null ? "<null>" : address.toString()) + ":"
+ port);
- }
+ listener = this.serverSocketChannelFactory.createServerChannel(port, backlog,
+ address, reuseAddress);
}
initialized = true;
@@ -304,7 +295,7 @@
try {
listener.close();
} catch (IOException e) {
- logger.error(sm.getString("endpoint.err.close"), e);
+ CoyoteLogger.UTIL_LOGGER.errorClosingSocket(e);
} finally {
listener = null;
}
@@ -367,15 +358,11 @@
serverSocketChannelFactory.initChannel(channel);
return true;
} catch (Throwable t) {
- // logger.error(t.getMessage(), t);
- if (logger.isDebugEnabled()) {
- if (t instanceof SSLHandshakeException) {
- logger.debug(sm.getString("endpoint.err.handshake"), t);
- } else {
- logger.debug(sm.getString("endpoint.err.unexpected"), t);
- }
- }
-
+ if (t instanceof SSLHandshakeException) {
+ CoyoteLogger.UTIL_LOGGER.handshakeFailed(t);
+ } else {
+ CoyoteLogger.UTIL_LOGGER.unexpectedError(t);
+ }
return false;
}
}
@@ -473,7 +460,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- logger.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
return true;
@@ -498,7 +485,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- logger.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
}
@@ -515,7 +502,7 @@
} catch (Throwable t) {
// This means we got an OOM or similar creating a thread, or that
// the pool and its queue are full
- logger.error(sm.getString("endpoint.process.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorProcessingSocket(t);
return false;
}
}
@@ -600,9 +587,7 @@
try {
channel.close();
} catch (IOException e) {
- if (logger.isDebugEnabled()) {
- logger.debug(e.getMessage(), e);
- }
+ CoyoteLogger.UTIL_LOGGER.errorClosingSocket(e);
} finally {
if (this.connections.remove(channel.getId()) != null) {
this.counter.decrementAndGet();
@@ -663,15 +648,15 @@
}
// If a problem occurs, close the channel right away
if (!ok) {
- logger.info("Fail processing the channel");
+ CoyoteLogger.UTIL_LOGGER.errorProcessingChannel();
closeChannel(channel);
}
} catch (Exception exp) {
if (running) {
- logger.error(sm.getString("endpoint.accept.fail"), exp);
+ CoyoteLogger.UTIL_LOGGER.errorAcceptingSocket(exp);
}
} catch (Throwable t) {
- logger.error(sm.getString("endpoint.accept.fail"), t);
+ CoyoteLogger.UTIL_LOGGER.errorAcceptingSocket(t);
}
}
}
@@ -716,14 +701,11 @@
serverSocketChannelFactory.handshake(channel);
if (!processChannel(channel, null)) {
- logger.info("Fail processing the channel");
+ CoyoteLogger.UTIL_LOGGER.errorProcessingChannel();
closeChannel(channel);
}
} catch (Exception exp) {
- if (logger.isDebugEnabled()) {
- logger.debug(exp.getMessage(), exp);
- }
-
+ CoyoteLogger.UTIL_LOGGER.errorProcessingChannelDebug(exp);
closeChannel(channel);
} finally {
this.recycle();
@@ -1051,10 +1033,7 @@
closeChannel(channel);
}
} catch (Throwable th) {
- logger.error(th.getMessage(), th);
- if (logger.isDebugEnabled()) {
- logger.debug(th.getMessage(), th);
- }
+ CoyoteLogger.UTIL_LOGGER.errorProcessingChannelWithException(th);
} finally {
this.recycle();
}
@@ -1350,9 +1329,7 @@
ch.awaitRead(ch, getCompletionHandler());
} catch (Exception e) {
// Ignore
- if (logger.isDebugEnabled()) {
- logger.debug(e.getMessage(), e);
- }
+ CoyoteLogger.UTIL_LOGGER.errorAwaitingRead(e);
}
} else if (info.write()) {
remove(info);
@@ -1363,9 +1340,7 @@
remove(info);
// TODO
} else {
- if (logger.isDebugEnabled()) {
- logger.debug("Unknown Event");
- }
+ CoyoteLogger.UTIL_LOGGER.unknownEvent();
remove(info);
if (!processChannel(ch, SocketStatus.ERROR)) {
closeChannel(ch);
Modified:
trunk/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java 2012-07-26
12:58:36 UTC (rev 2055)
@@ -21,6 +21,8 @@
*/
package org.apache.tomcat.util.net.jsse;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -64,7 +66,7 @@
import org.apache.tomcat.util.net.DefaultNioServerSocketChannelFactory;
import org.apache.tomcat.util.net.NioChannel;
-import org.apache.tomcat.util.res.StringManager;
+import org.jboss.web.CoyoteLogger;
/**
* {@code NioJSSESocketChannelFactory}
@@ -85,8 +87,6 @@
*/
public class NioJSSESocketChannelFactory extends DefaultNioServerSocketChannelFactory {
- private static StringManager sm = StringManager
- .getManager("org.apache.tomcat.util.net.jsse.res");
private static final boolean RFC_5746_SUPPORTED;
// defaults
private static final String defaultProtocol = "TLS";
@@ -478,16 +478,14 @@
}
ks.load(istream, storePass);
} catch (FileNotFoundException fnfe) {
- log.error(sm.getString("jsse.keystore_load_failed", type, path,
fnfe.getMessage()),
- fnfe);
+ CoyoteLogger.UTIL_LOGGER.errorLoadingKeystore(type, path, fnfe.getMessage());
throw fnfe;
} catch (IOException ioe) {
- log.error(sm.getString("jsse.keystore_load_failed", type, path,
ioe.getMessage()), ioe);
+ CoyoteLogger.UTIL_LOGGER.errorLoadingKeystoreWithException(type, path,
ioe.getMessage(), ioe);
throw ioe;
} catch (Exception ex) {
- String msg = sm.getString("jsse.keystore_load_failed", type, path,
ex.getMessage());
- log.error(msg, ex);
- throw new IOException(msg);
+ CoyoteLogger.UTIL_LOGGER.errorLoadingKeystoreWithException(type, path,
ex.getMessage(), ex);
+ throw new IOException(ex);
} finally {
if (istream != null) {
try {
@@ -520,7 +518,7 @@
KeyStore ks = getKeystore(keystoreType, keystoreProvider, keystorePass);
if (keyAlias != null && !ks.isKeyEntry(keyAlias)) {
- throw new IOException(sm.getString("jsse.alias_no_key_entry", keyAlias));
+ throw new IOException(MESSAGES.noKeyAlias(keyAlias));
}
KeyManagerFactory kmf = KeyManagerFactory.getInstance(algorithm);
@@ -807,8 +805,7 @@
// Will never get here - no client can connect to an unbound port
} catch (SSLException ssle) {
// SSL configuration is invalid. Possibly cert doesn't match ciphers
- IOException ioe = new IOException(sm.getString("jsse.invalid_ssl_conf",
- ssle.getMessage()));
+ IOException ioe = new
IOException(MESSAGES.invalidSSLConfiguration(ssle.getMessage()));
ioe.initCause(ssle);
throw ioe;
} catch (Exception e) {
Deleted: trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-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}
Deleted:
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-jsse.alias_no_key_entry = El nombre de Alias {0} no identifica una entrada de clave
-jsse.keystore_load_failed = No pude cargar almac\u00E9n de claves de tipo {0} con ruta
{1} debido a {2}
Deleted:
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_fr.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_fr.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_fr.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1 +0,0 @@
-jsse.alias_no_key_entry=Le nom alias {0} n''identifie pas une entr�e de clef
Deleted:
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_ja.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_ja.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/jsse/res/LocalStrings_ja.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,2 +0,0 @@
-jsse.alias_no_key_entry=\u5225\u540d {0}
\u306f\u30ad\u30fc\u30a8\u30f3\u30c8\u30ea\u3092\u767a\u898b\u3067\u304d\u307e\u305b\u3093
-
Deleted: trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings.properties
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,29 +0,0 @@
-# net resources
-endpoint.err.fatal=Endpoint {0} shutdown due to exception: {1}
-endpoint.err.nonfatal=Endpoint {0} ignored exception: {1}
-endpoint.info.maxThreads=Maximum number of threads ({0}) created for connector with
address {1} and port {2}
-endpoint.warn.reinit=Reinitializing ServerSocket
-endpoint.warn.restart=Restarting endpoint
-endpoint.warn.security=Endpoint {0} security exception: {1}
-endpoint.err.socket=Socket error caused by remote host {0}
-endpoint.err.handshake=Handshake failed
-endpoint.err.unexpected=Unexpected error processing socket
-endpoint.warn.nullSocket=Null socket returned by accept
-endpoint.debug.unlock=Caught exception trying to unlock accept on port {0}
-endpoint.err.close=Caught exception trying to close socket
-endpoint.noProcessor=No Processors - worker thread dead!
-
-endpoint.init.bind=Socket bind failed: [{0}] {1}
-endpoint.init.listen=Socket listen failed: [{0}] {1}
-endpoint.accept.fail=Socket accept failed
-endpoint.poll.limitedpollsize=Failed to create poller with specified size of {0}
-endpoint.poll.initfail=Poller creation failed
-endpoint.poll.fail=Critical poller failure (restarting poller): [{0}] {1}
-endpoint.poll.flags=Unfiltered poll flag {0}, sending error
-endpoint.poll.error=Unexpected poller error
-endpoint.maintain.error=Error processing timeouts
-endpoint.process.fail=Error allocating socket processor
-endpoint.sendfile.error=Unexpected sendfile error
-endpoint.sendfile.addfail=Sendfile failure: [{0}] {1}
-endpoint.sendfile.nosupport=Disabling sendfile, since either the APR version or the
system doesn't support it
-endpoint.warn.noInsecureReneg=Secure renegotation is not supported by the SSL library
{0}
Deleted: trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_es.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_es.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_es.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,39 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-#
http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# net resources
-endpoint.err.fatal = Punto Final (Endpoint) {0} parado debido a excepci\u00F3n\: {1}
-endpoint.err.nonfatal = El Punto Final (Endpoint) {0} ignor\u00F3 excepci\u00F3n\: {1}
-endpoint.warn.reinit = Reinicializando ServerSocket
-endpoint.warn.restart = Rearrancando punto final (endpoint)
-endpoint.warn.security = Punto Final (Endpoint) {0} con excepci\u00F3n de seguridad\:
{1}
-endpoint.err.socket = Error de conector causado por m\u00E1quina remota {0}
-endpoint.err.handshake = Acuerdo fallido
-endpoint.err.unexpected = Error inesperado al procesar conector
-endpoint.warn.nullSocket = Conector nulo devuelto por aceptaci\u00F3n
-endpoint.debug.unlock = Excepci\u00F3n cogida intentando desbloquear aceptaci\u00F3n en
puerto {0}
-endpoint.err.close = Excepci\u00F3n cogida intentando cerrar conector
-endpoint.noProcessor = No hay procesadores - \u00A1hilo de trabajadir muerto\!
-endpoint.init.bind = Ligado de conector fall\u00F3\: [{0}] {1}
-endpoint.init.listen = Escucha de conector fall\u00F3\: [{0}] {1}
-endpoint.accept.fail = Aceptaci\u00F3n de conector fall\u00F3
-endpoint.poll.limitedpollsize = No pude crear encuestador de medida espec\u00EDfica de
{0}
-endpoint.poll.initfail = Fall\u00F3 la creaci\u00F3n del encuestador
-endpoint.poll.fail = Fallo cr\u00EDtico de encuestador (reiniciando encuestador)\: [{0}]
{1}
-endpoint.poll.fail = Conector [{0}] evento de encuesta\: [{1}] {2}
-endpoint.poll.error = Error inesperado de encuestador
-endpoint.process.fail = Error reservando procesador de conector
-endpoint.sendfile.error = Error inesperado de env\u00EDo de fichero
-endpoint.sendfile.addfail = Fallo en Sednfile\: [{0}] {1}
-endpoint.sendfile.nosupport = Desactivando sendfile ya que o la versi\u00F3n APR o el
sistema no lo soportan
Deleted: trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_fr.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_fr.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_fr.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,6 +0,0 @@
-# net resources
-endpoint.err.fatal=Le point de contact {0} a �t� �teint suite � l''exception{1}
-endpoint.err.nonfatal=Le point de contact {0} a ignor� l''exception: {1}
-endpoint.warn.reinit=R�initialisation du ServerSocket
-endpoint.warn.restart=Red�marrage du point de contact
-
Deleted: trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_ja.properties
===================================================================
---
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_ja.properties 2012-07-19
15:51:17 UTC (rev 2054)
+++
trunk/src/main/java/org/apache/tomcat/util/net/res/LocalStrings_ja.properties 2012-07-26
12:58:36 UTC (rev 2055)
@@ -1,6 +0,0 @@
-# net resources
-endpoint.err.fatal=\u4f8b\u5916\u306e\u305f\u3081\u306b\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8
{0} \u306f\u30b7\u30e3\u30c3\u30c8\u30c0\u30a6\u30f3\u3057\u307e\u3059: {1}
-endpoint.err.nonfatal=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8 {0}
\u306f\u4f8b\u5916\u3092\u7121\u8996\u3057\u307e\u3057\u305f: {1}
-endpoint.warn.reinit=ServerSocket\u3092\u518d\u521d\u671f\u5316\u3057\u307e\u3059
-endpoint.warn.restart=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059
-endpoint.warn.security=\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8 {0}
\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4f8b\u5916\u3067\u3059: {1}
Deleted: trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java
===================================================================
--- trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java 2012-07-19 15:51:17
UTC (rev 2054)
+++ trunk/src/main/java/org/apache/tomcat/util/res/StringManager.java 2012-07-26 12:58:36
UTC (rev 2055)
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *
http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tomcat.util.res;
-
-import java.text.MessageFormat;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * An internationalization / localization helper class which reduces
- * the bother of handling ResourceBundles and takes care of the
- * common cases of message formating which otherwise require the
- * creation of Object arrays and such.
- *
- * <p>The StringManager operates on a package basis. One StringManager
- * per package can be created and accessed via the getManager method
- * call.
- *
- * <p>The StringManager will look for a ResourceBundle named by
- * the package name given plus the suffix of "LocalStrings". In
- * practice, this means that the localized information will be contained
- * in a LocalStrings.properties file located in the package
- * directory of the classpath.
- *
- * <p>Please see the documentation for java.util.ResourceBundle for
- * more information.
- *
- * @version $Revision: 1139 $ $Date: 2009-07-20 18:46:09 +0200 (Mon, 20 Jul 2009) $
- *
- * @author James Duncan Davidson [duncan(a)eng.sun.com]
- * @author James Todd [gonzo(a)eng.sun.com]
- * @author Mel Martinez [mmartinez(a)g1440.com]
- * @see java.util.ResourceBundle
- */
-
-public class StringManager {
-
- /**
- * The ResourceBundle for this StringManager.
- */
-
- private ResourceBundle bundle;
- private Locale locale;
-
- /**
- * Creates a new StringManager for a given package. This is a
- * private method and all access to it is arbitrated by the
- * static getManager method call so that only one StringManager
- * per package will be created.
- *
- * @param packageName Name of package to create StringManager for.
- */
- private StringManager(String packageName) {
- String bundleName = packageName + ".LocalStrings";
- try {
- bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault());
- } catch( MissingResourceException ex ) {
- // Try from the current loader (that's the case for trusted apps)
- // Should only be required if using a TC5 style classloader structure
- // where common != shared != server
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if( cl != null ) {
- try {
- bundle = ResourceBundle.getBundle(
- bundleName, Locale.getDefault(), cl);
- } catch(MissingResourceException ex2) {
- }
- }
- }
- // Get the actual locale, which may be different from the requested one
- if (bundle != null) {
- locale = bundle.getLocale();
- }
- }
-
- /**
- Get a string from the underlying resource bundle or return
- null if the String is not found.
-
- @param key to desired resource String
- @return resource String matching <i>key</i> from underlying
- bundle or null if not found.
- @throws IllegalArgumentException if <i>key</i> is null.
- */
-
- public String getString(String key) {
- if(key == null){
- String msg = "key may not have a null value";
-
- throw new IllegalArgumentException(msg);
- }
- if (bundle == null) {
- return key;
- }
-
- String str = null;
-
- try{
- str = bundle.getString(key);
- }catch(MissingResourceException mre){
- //bad: shouldn't mask an exception the following way:
- // str = "[cannot find message associated with key '" + key +
"' due to " + mre + "]";
- // because it hides the fact that the String was missing
- // from the calling code.
- //good: could just throw the exception (or wrap it in another)
- // but that would probably cause much havoc on existing
- // code.
- //better: consistent with container pattern to
- // simply return null. Calling code can then do
- // a null check.
- str = null;
- }
-
- return str;
- }
-
- /**
- * Get a string from the underlying resource bundle and format
- * it with the given set of arguments.
- *
- * @param key
- * @param args
- */
- public String getString(final String key, final Object... args) {
- String value = getString(key);
- if (value == null) {
- value = key;
- }
-
- MessageFormat mf = new MessageFormat(value);
- mf.setLocale(locale);
- return mf.format(args, new StringBuffer(), null).toString();
- }
-
- // --------------------------------------------------------------
- // STATIC SUPPORT METHODS
- // --------------------------------------------------------------
-
- private static Hashtable managers = new Hashtable();
-
- /**
- * Get the StringManager for a particular package. If a manager for
- * a package already exists, it will be reused, else a new
- * StringManager will be created and returned.
- *
- * @param packageName The package name
- */
- public synchronized static StringManager getManager(String packageName) {
- StringManager mgr = (StringManager)managers.get(packageName);
- if (mgr == null) {
- mgr = new StringManager(packageName);
- managers.put(packageName, mgr);
- }
- return mgr;
- }
-
-}
Modified: trunk/src/main/java/org/jboss/web/CoyoteLogger.java
===================================================================
--- trunk/src/main/java/org/jboss/web/CoyoteLogger.java 2012-07-19 15:51:17 UTC (rev
2054)
+++ trunk/src/main/java/org/jboss/web/CoyoteLogger.java 2012-07-26 12:58:36 UTC (rev
2055)
@@ -25,7 +25,10 @@
import static org.jboss.logging.Logger.Level.ERROR;
import static org.jboss.logging.Logger.Level.INFO;
import static org.jboss.logging.Logger.Level.WARN;
+import static org.jboss.logging.Logger.Level.DEBUG;
+import java.net.InetAddress;
+
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
import org.jboss.logging.LogMessage;
@@ -45,12 +48,343 @@
*/
CoyoteLogger ROOT_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.coyote");
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger UTIL_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.tomcat.util");
+
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger HTTP_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.coyote.http11");
+
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger AJP_LOGGER = Logger.getMessageLogger(CoyoteLogger.class,
"org.apache.coyote.ajp");
+
@LogMessage(level = INFO)
@Message(id = 3000, value = "Coyote HTTP/1.1 starting on: %s")
- void startConnector(String name);
+ void startHttpConnector(String name);
@LogMessage(level = INFO)
@Message(id = 3001, value = "Coyote HTTP/1.1 initializing on : %s")
- void initConnector(String name);
+ void initHttpConnector(String name);
+ @LogMessage(level = ERROR)
+ @Message(id = 3002, value = "Failed to load keystore type %s with path %s due to
%s")
+ void errorLoadingKeystore(String type, String path, String message);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3003, value = "Failed to load keystore type %s with path %s due to
%s")
+ void errorLoadingKeystoreWithException(String type, String path, String message,
@Cause Throwable exception);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3004, value = "Secure renegotiation is not supported by the SSL
library %s")
+ void noInsecureRengotiation(String version);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3005, value = "Handshake failed: %s")
+ void handshakeFailed(String cause);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3006, value = "Handshake failed")
+ void handshakeFailed(@Cause Throwable exception);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3007, value = "Unexpected error processing socket")
+ void unexpectedError(@Cause Throwable exception);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3008, value = "Maximum number of threads (%s) created for
connector with address %s and port %s")
+ void maxThreadsReached(int maxThreads, InetAddress address, int port);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3009, value = "Failed to create poller with specified size of
%s")
+ void limitedPollerSize(int size);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3010, value = "Poller creation failed")
+ void errorCreatingPoller(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3011, value = "Error allocating socket processor")
+ void errorProcessingSocket(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3012, value = "Socket accept failed")
+ void errorAcceptingSocket(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3013, value = "Error processing timeouts")
+ void errorProcessingSocketTimeout(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3014, value = "Unexpected poller error")
+ void errorPollingSocket();
+
+ @LogMessage(level = WARN)
+ @Message(id = 3015, value = "Unfiltered poll flag %s, sending error")
+ void errorPollingSocketCode(long code);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3016, value = "Critical poller failure (restarting poller): [%s]
%s")
+ void pollerFailure(int code, String message);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3017, value = "Unexpected poller error")
+ void errorPollingSocketWithException(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3018, value = "Unexpected sendfile error")
+ void errorSendingFile(@Cause Throwable exception);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3019, value = "Sendfile failure: [%s] %s")
+ void errorSendingFile(int code, String message);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3020, value = "Error closing clannel")
+ void errorClosingChannel(@Cause Throwable exception);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3021, value = "Error closing socket")
+ void errorClosingSocket(@Cause Throwable exception);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3022, value = "Channel processing failed")
+ void errorProcessingChannel();
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3023, value = "Channel processing failed")
+ void errorProcessingChannelDebug(@Cause Throwable exception);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3024, value = "Channel processing failed")
+ void errorProcessingChannelWithException(@Cause Throwable exception);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3025, value = "Error awaiting read")
+ void errorAwaitingRead(@Cause Throwable exception);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3026, value = "Unknown event")
+ void unknownEvent();
+
+ @LogMessage(level = WARN)
+ @Message(id = 3027, value = "Failed loading HTTP messages strings")
+ void errorLoadingMessages(@Cause Throwable exception);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3028, value = "Start processing with input [%s]")
+ void startProcessingParameter(String parameter);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3029, value = "Parameter starting at position [%s] and ending at
position [%s] with a value of [%s] was not followed by an '=' character")
+ void parameterMissingEqual(int start, int end, String value);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3030, value = "Empty parameter chunk ignored")
+ void emptyParamterChunk();
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3031, value = "Invalid chunk starting at byte [%s] and ending at
byte [%s] with a value of [%s] ignored")
+ void parameterInvalid(int start, int end, String value);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3032, value = "Failed to create copy of original parameter values
for debug logging purposes")
+ void parametersCopyFailed();
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3033, value = "Character decoding failed. Parameter [%s] with
value [%s] has been ignored.")
+ void parameterDecodingFailed(String name, String value);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3034, value = "Character decoding failed. A total of [%s] failures
were detected. Enable debug level logging for this logger to log all failures.")
+ void parametersDecodingFailures(int count);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3035, value = "Parameters processing failed.")
+ void parametersProcessingFailed();
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3036, value = "Invalid cookie header [%s].")
+ void invalidCookieHeader(String header);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3037, value = "Invalid special cookie [%s].")
+ void invalidSpecialCookie(String cookie);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3038, value = "Error processing request")
+ void errorProcessingRequest(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3039, value = "Unexpected AJP message with type [%s].")
+ void unexpectedAjpMessage(int type);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3040, value = "Header message parsing failed.")
+ void errorParsingAjpHeaderMessage(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3041, value = "Error preparing AJP request.")
+ void errorPreparingAjpRequest(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3042, value = "Certificate conversion failed")
+ void errorProcessingCertificates(@Cause java.security.cert.CertificateException e);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3043, value = "Error initializing endpoint")
+ void errorInitializingEndpoint(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3044, value = "Threadpool JMX registration failed")
+ void errorRegisteringPool(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3045, value = "Error starting endpoint")
+ void errorStartingEndpoint(@Cause Throwable t);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3046, value = "Starting Coyote AJP/1.3 on %s")
+ void startingAjpProtocol(String name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3047, value = "Error pausing endpoint")
+ void errorPausingEndpoint(@Cause Throwable t);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3048, value = "Pausing Coyote AJP/1.3 on %s")
+ void pausingAjpProtocol(String name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3049, value = "Error resuming endpoint")
+ void errorResumingEndpoint(@Cause Throwable t);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3050, value = "Resuming Coyote AJP/1.3 on %s")
+ void resumingAjpProtocol(String name);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3051, value = "Stopping Coyote AJP/1.3 on %s")
+ void stoppingAjpProtocol(String name);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3052, value = "Skip destroy for Coyote AJP/1.3 on %s due to active
request processors")
+ void cannotDestroyAjpProtocol(String name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3053, value = "Skip destroy for Coyote AJP/1.3 on %s due to active
request processors")
+ void cannotDestroyAjpProtocolWithException(String name, @Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3054, value = "Socket exception processing event.")
+ void socketException(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3055, value = "Error reading request, ignored.")
+ void socketError(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3056, value = "Error registering request")
+ void errorRegisteringRequest(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3057, value = "Error unregistering request")
+ void errorUnregisteringRequest(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3058, value = "Cannot append null value to AJP message")
+ void cannotAppendNull();
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3059, value = "Overflow error for buffer adding %s bytes at
position %s")
+ void ajpMessageOverflow(int count, int pos);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3060, value = "Requested %s bytes exceeds message available
data")
+ void ajpMessageUnderflow(int count);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3061, value = "Invalid message received with signature %s")
+ void invalidAjpMessage(int signature);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3062, value = "Error parsing regular expression %s")
+ void errorParsingRegexp(String expression, @Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3063, value = "Error during non blocking read")
+ void errorWithNonBlockingRead(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3064, value = "Error during blocking read")
+ void errorWithBlockingRead(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3065, value = "Error during non blocking write")
+ void errorWithNonBlockingWrite(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3066, value = "Error during blocking write")
+ void errorWithBlockingWrite(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3067, value = "Exception getting socket information")
+ void errorGettingSocketInformation(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3068, value = "Unknown filter %s")
+ void unknownFilter(String filter);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3069, value = "Error intializing filter %s")
+ void errorInitializingFilter(String filter, @Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3070, value = "Error parsing HTTP request header")
+ void errorParsingHeader(@Cause Throwable t);
+
+ @LogMessage(level = DEBUG)
+ @Message(id = 3071, value = "Error preparing request")
+ void errorPreparingRequest(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3072, value = "Error finishing request")
+ void errorFinishingRequest(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3073, value = "Error finishing response")
+ void errorFinishingResponse(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3074, value = "Exception getting SSL attributes")
+ void errorGettingSslAttributes(@Cause Throwable t);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3075, value = "Coyote HTTP/1.1 pausing on: %s")
+ void pauseHttpConnector(String name);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3076, value = "Coyote HTTP/1.1 resuming on : %s")
+ void resumeHttpConnector(String name);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3077, value = "Coyote HTTP/1.1 stopping on : %s")
+ void stopHttpConnector(String name);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3078, value = "Skip destroy for Coyote HTTP/1.1 on %s due to
active request processors")
+ void cannotDestroyHttpProtocol(String name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3079, value = "Skip destroy for Coyote HTTP/1.1 on %s due to
active request processors")
+ void cannotDestroyHttpProtocolWithException(String name, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3080, value = "Error initializing socket factory")
+ void errorInitializingSocketFactory(@Cause Throwable t);
+
}
Modified: trunk/src/main/java/org/jboss/web/CoyoteMessages.java
===================================================================
--- trunk/src/main/java/org/jboss/web/CoyoteMessages.java 2012-07-19 15:51:17 UTC (rev
2054)
+++ trunk/src/main/java/org/jboss/web/CoyoteMessages.java 2012-07-26 12:58:36 UTC (rev
2055)
@@ -39,4 +39,55 @@
*/
CoyoteMessages MESSAGES = Messages.getBundle(CoyoteMessages.class);
+ @Message(id = 2000, value = "Alias name %s does not identify a key entry")
+ String noKeyAlias(String alias);
+
+ @Message(id = 2001, value = "SSL configuration is invalid due to %s")
+ String invalidSSLConfiguration(String message);
+
+ @Message(id = 2002, value = "Socket bind failed: [%s] %s")
+ Exception socketBindFailed(int code, String message);
+
+ @Message(id = 2003, value = "Socket listen failed: [%s] %s")
+ Exception socketListenFailed(int code, String message);
+
+ @Message(id = 2004, value = "More than the maximum number of request parameters
(GET plus POST) for a single request (%s) were detected. Any parameters beyond this limit
have been ignored. To change this limit, set the maxParameterCount attribute on the
Connector.")
+ IllegalStateException maxParametersFail(int limit);
+
+ @Message(id = 2005, value = "Header count exceeded allowed maximum [%s]")
+ IllegalStateException maxHeadersFail(int limit);
+
+ @Message(id = 2006, value = "Odd number of hexadecimal digits")
+ IllegalStateException hexaOdd();
+
+ @Message(id = 2007, value = "Bad hexadecimal digit")
+ IllegalStateException hexaBad();
+
+ @Message(id = 2008, value = "EOF while decoding UTF-8")
+ String utf8DecodingEof();
+
+ @Message(id = 2009, value = "UTF-8 decoding failure, byte sequence [%s, %s, %s,
%s]")
+ String utf8DecodingFailure(int b0, int b1, int b2, int b3);
+
+ @Message(id = 2010, value = "UTF-8 decoding failure, byte sequence [%s, %s,
%s]")
+ String utf8DecodingFailure(int b0, int b1, int b2);
+
+ @Message(id = 2011, value = "Socket read failed")
+ String failedRead();
+
+ @Message(id = 2012, value = "Socket write failed")
+ String failedWrite();
+
+ @Message(id = 2013, value = "Invalid message received")
+ String invalidAjpMessage();
+
+ @Message(id = 2014, value = "Unexpected EOF read on the socket")
+ String eofError();
+
+ @Message(id = 2015, value = "Request header is too large")
+ IllegalArgumentException requestHeaderTooLarge();
+
+ @Message(id = 2016, value = "Backlog is present")
+ String invalidBacklog();
+
}