JBossWeb SVN: r2095 - in branches/7.2.x/src/main/java/org: apache/tomcat/util/json and 5 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2012-10-02 12:08:29 -0400 (Tue, 02 Oct 2012)
New Revision: 2095
Added:
branches/7.2.x/src/main/java/org/jboss/web/JSONMessages.java
Modified:
branches/7.2.x/src/main/java/org/apache/tomcat/util/http/mapper/Mapper.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONArray.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONObject.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONTokener.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONWriter.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/ManagedBean.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/Registry.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/NioServerSocketChannelFactory.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/SSLImplementation.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/URL.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSEImplementation.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESupport.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/SecureNioChannel.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
Log:
Visual inspection of util (part 2) classes for i18n
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/http/mapper/Mapper.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/http/mapper/Mapper.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/http/mapper/Mapper.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.http.mapper;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.util.ArrayList;
import java.util.List;
@@ -223,7 +225,7 @@
pos = find(hosts, hostName);
}
if (pos < 0) {
- throw new IllegalStateException("No host found: " + hostName);
+ throw MESSAGES.mapperHostNotFound(hostName);
}
Host host = hosts[pos];
if (host.name.equals(hostName)) {
@@ -267,7 +269,7 @@
pos = find(hosts, hostName);
}
if (pos < 0) {
- throw new IllegalStateException("No host found: " + hostName);
+ throw MESSAGES.mapperHostNotFound(hostName);
}
Host host = hosts[pos];
if (host.name.equals(hostName)) {
@@ -377,7 +379,7 @@
Context[] contexts = host.contextList.contexts;
int pos2 = find(contexts, contextPath);
if( pos2<0 ) {
- throw new IllegalStateException("No context found: " + contextPath );
+ throw MESSAGES.mapperContextNotFound(contextPath);
}
Context context = contexts[pos2];
if (context.name.equals(contextPath)) {
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONArray.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONArray.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONArray.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -24,6 +24,8 @@
SOFTWARE.
*/
+import static org.jboss.web.JSONMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Array;
@@ -112,7 +114,7 @@
} else if (c == '(') {
q = ')';
} else {
- throw x.syntaxError("A JSONArray text must start with '['");
+ throw x.syntaxError(MESSAGES.arrayMustStartWithBracket());
}
if (x.nextClean() == ']') {
return;
@@ -138,11 +140,11 @@
case ']':
case ')':
if (q != c) {
- throw x.syntaxError("Expected a '" + new Character(q) + "'");
+ throw x.syntaxError(MESSAGES.arrayCharExpected('q'));
}
return;
default:
- throw x.syntaxError("Expected a ',' or ']'");
+ throw x.syntaxError(MESSAGES.arrayEndExpected());
}
}
}
@@ -199,7 +201,7 @@
this.put(Array.get(array, i));
}
} else {
- throw new JSONException("JSONArray initial value should be a string or collection or array.");
+ throw new JSONException(MESSAGES.arrayInvalidValue());
}
}
@@ -217,7 +219,7 @@
this.put(new JSONObject(Array.get(array, i),includeSuperClass));
}
} else {
- throw new JSONException("JSONArray initial value should be a string or collection or array.");
+ throw new JSONException(MESSAGES.arrayInvalidValue());
}
}
@@ -233,7 +235,7 @@
public Object get(int index) throws JSONException {
Object o = opt(index);
if (o == null) {
- throw new JSONException("JSONArray[" + index + "] not found.");
+ throw new JSONException(MESSAGES.arrayInvalidIndex(index));
}
return o;
}
@@ -259,7 +261,7 @@
((String)o).equalsIgnoreCase("true"))) {
return true;
}
- throw new JSONException("JSONArray[" + index + "] is not a Boolean.");
+ throw new JSONException(MESSAGES.arrayInvalidType(index, "Boolean"));
}
@@ -278,8 +280,7 @@
((Number)o).doubleValue() :
Double.valueOf((String)o).doubleValue();
} catch (Exception e) {
- throw new JSONException("JSONArray[" + index +
- "] is not a number.");
+ throw new JSONException(MESSAGES.arrayInvalidType(index, "Double"));
}
}
@@ -312,8 +313,7 @@
if (o instanceof JSONArray) {
return (JSONArray)o;
}
- throw new JSONException("JSONArray[" + index +
- "] is not a JSONArray.");
+ throw new JSONException(MESSAGES.arrayInvalidType(index, "JSONArray"));
}
@@ -329,8 +329,7 @@
if (o instanceof JSONObject) {
return (JSONObject)o;
}
- throw new JSONException("JSONArray[" + index +
- "] is not a JSONObject.");
+ throw new JSONException(MESSAGES.arrayInvalidType(index, "JSONObject"));
}
@@ -783,7 +782,7 @@
public JSONArray put(int index, Object value) throws JSONException {
JSONObject.testValidity(value);
if (index < 0) {
- throw new JSONException("JSONArray[" + index + "] not found.");
+ throw new JSONException(MESSAGES.arrayInvalidIndex(index));
}
if (index < length()) {
this.myArrayList.set(index, value);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONObject.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONObject.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONObject.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -24,6 +24,8 @@
SOFTWARE.
*/
+import static org.jboss.web.JSONMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Field;
@@ -176,13 +178,13 @@
String key;
if (x.nextClean() != '{') {
- throw x.syntaxError("A JSONObject text must begin with '{'");
+ throw x.syntaxError(MESSAGES.objectMustStartWithBracket());
}
for (;;) {
c = x.nextClean();
switch (c) {
case 0:
- throw x.syntaxError("A JSONObject text must end with '}'");
+ throw x.syntaxError(MESSAGES.objectMustEndWithBracket());
case '}':
return;
default:
@@ -200,7 +202,7 @@
x.back();
}
} else if (c != ':') {
- throw x.syntaxError("Expected a ':' after a key");
+ throw x.syntaxError(MESSAGES.objectExpectedKey());
}
putOnce(key, x.nextValue());
@@ -219,7 +221,7 @@
case '}':
return;
default:
- throw x.syntaxError("Expected a ',' or '}'");
+ throw x.syntaxError(MESSAGES.objectExpectedEnd());
}
}
}
@@ -452,8 +454,7 @@
} else if (o instanceof JSONArray) {
put(key, ((JSONArray)o).put(value));
} else {
- throw new JSONException("JSONObject[" + key +
- "] is not a JSONArray.");
+ throw new JSONException(MESSAGES.objectInvalidType(key, "JSONArray"));
}
return this;
}
@@ -495,8 +496,7 @@
public Object get(String key) throws JSONException {
Object o = opt(key);
if (o == null) {
- throw new JSONException("JSONObject[" + quote(key) +
- "] not found.");
+ throw new JSONException(MESSAGES.objectNotFound(quote(key)));
}
return o;
}
@@ -521,8 +521,7 @@
((String)o).equalsIgnoreCase("true"))) {
return true;
}
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a Boolean.");
+ throw new JSONException(MESSAGES.objectInvalidType(key, "Boolean"));
}
@@ -540,8 +539,7 @@
((Number)o).doubleValue() :
Double.valueOf((String)o).doubleValue();
} catch (Exception e) {
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a number.");
+ throw new JSONException(MESSAGES.objectInvalidType(key, "Double"));
}
}
@@ -575,8 +573,7 @@
if (o instanceof JSONArray) {
return (JSONArray)o;
}
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a JSONArray.");
+ throw new JSONException(MESSAGES.objectInvalidType(key, "JSONArray"));
}
@@ -593,8 +590,7 @@
if (o instanceof JSONObject) {
return (JSONObject)o;
}
- throw new JSONException("JSONObject[" + quote(key) +
- "] is not a JSONObject.");
+ throw new JSONException(MESSAGES.objectInvalidType(key, "JSONObject"));
}
@@ -1073,7 +1069,7 @@
public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (opt(key) != null) {
- throw new JSONException("Duplicate key \"" + key + "\"");
+ throw new JSONException(MESSAGES.objectDuplicateKey(key));
}
put(key, value);
}
@@ -1258,13 +1254,11 @@
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
- throw new JSONException(
- "JSON does not allow non-finite numbers.");
+ throw new JSONException(MESSAGES.objectInfiniteNumber());
}
} else if (o instanceof Float) {
if (((Float)o).isInfinite() || ((Float)o).isNaN()) {
- throw new JSONException(
- "JSON does not allow non-finite numbers.");
+ throw new JSONException(MESSAGES.objectInfiniteNumber());
}
}
}
@@ -1433,7 +1427,7 @@
if (o instanceof String) {
return (String)o;
}
- throw new JSONException("Bad value from toJSONString: " + o);
+ throw new JSONException(MESSAGES.objectBadString(o));
}
if (value instanceof Number) {
return numberToString((Number) value);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONTokener.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONTokener.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONTokener.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -1,5 +1,7 @@
package org.apache.tomcat.util.json;
+import static org.jboss.web.JSONMessages.MESSAGES;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@@ -74,7 +76,7 @@
*/
public void back() throws JSONException {
if (useLastChar || index <= 0) {
- throw new JSONException("Stepping back two steps is not supported");
+ throw new JSONException(MESSAGES.tokenerStepBack());
}
index -= 1;
useLastChar = true;
@@ -157,8 +159,7 @@
public char next(char c) throws JSONException {
char n = next();
if (n != c) {
- throw syntaxError("Expected '" + c + "' and instead saw '" +
- n + "'");
+ throw syntaxError(MESSAGES.tokenerBadChar(c, n));
}
return n;
}
@@ -198,7 +199,7 @@
this.index += pos;
if (pos < n) {
- throw syntaxError("Substring bounds error");
+ throw syntaxError(MESSAGES.tokenerSubstring());
}
this.lastChar = buffer[n - 1];
@@ -241,7 +242,7 @@
case 0:
case '\n':
case '\r':
- throw syntaxError("Unterminated string");
+ throw syntaxError(MESSAGES.tokenerUnterminatedString());
case '\\':
c = next();
switch (c) {
@@ -366,7 +367,7 @@
s = sb.toString().trim();
if (s.equals("")) {
- throw syntaxError("Missing value");
+ throw syntaxError(MESSAGES.tokenerMissingValue());
}
return JSONObject.stringToValue(s);
}
@@ -407,16 +408,7 @@
* @return A JSONException object, suitable for throwing
*/
public JSONException syntaxError(String message) {
- return new JSONException(message + toString());
+ return new JSONException(message + index);
}
-
- /**
- * Make a printable string of this JSONTokener.
- *
- * @return " at character [this.index]"
- */
- public String toString() {
- return " at character " + index;
- }
}
\ No newline at end of file
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONWriter.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONWriter.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/json/JSONWriter.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -1,5 +1,7 @@
package org.apache.tomcat.util.json;
+import static org.jboss.web.JSONMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
@@ -109,7 +111,7 @@
*/
private JSONWriter append(String s) throws JSONException {
if (s == null) {
- throw new JSONException("Null pointer");
+ throw new JSONException(MESSAGES.writerNull());
}
if (this.mode == 'o' || this.mode == 'a') {
try {
@@ -126,7 +128,7 @@
this.comma = true;
return this;
}
- throw new JSONException("Value out of sequence.");
+ throw new JSONException(MESSAGES.writerValueOutOfSequence());
}
/**
@@ -145,7 +147,7 @@
this.comma = false;
return this;
}
- throw new JSONException("Misplaced array.");
+ throw new JSONException(MESSAGES.writerMisplacedArray());
}
/**
@@ -157,8 +159,8 @@
*/
private JSONWriter end(char m, char c) throws JSONException {
if (this.mode != m) {
- throw new JSONException(m == 'o' ? "Misplaced endObject." :
- "Misplaced endArray.");
+ throw new JSONException(m == 'o' ? MESSAGES.writerMisplacedObjectEnd() :
+ MESSAGES.writerMisplacedArrayEnd());
}
this.pop(m);
try {
@@ -200,7 +202,7 @@
*/
public JSONWriter key(String s) throws JSONException {
if (s == null) {
- throw new JSONException("Null key.");
+ throw new JSONException(MESSAGES.writerNullKey());
}
if (this.mode == 'k') {
try {
@@ -217,7 +219,7 @@
throw new JSONException(e);
}
}
- throw new JSONException("Misplaced key.");
+ throw new JSONException(MESSAGES.writerMisplacedKey());
}
@@ -240,7 +242,7 @@
this.comma = false;
return this;
}
- throw new JSONException("Misplaced object.");
+ throw new JSONException(MESSAGES.writerMisplacedObject());
}
@@ -252,11 +254,11 @@
*/
private void pop(char c) throws JSONException {
if (this.top <= 0) {
- throw new JSONException("Nesting error.");
+ throw new JSONException(MESSAGES.writerNestingError());
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
- throw new JSONException("Nesting error.");
+ throw new JSONException(MESSAGES.writerNestingError());
}
this.top -= 1;
this.mode = this.top == 0 ? 'd' : this.stack[this.top - 1] == null ? 'a' : 'k';
@@ -269,7 +271,7 @@
*/
private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
- throw new JSONException("Nesting too deep.");
+ throw new JSONException(MESSAGES.writerNestingTooDeep());
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -19,6 +19,8 @@
package org.apache.tomcat.util.modeler;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Iterator;
@@ -46,8 +48,7 @@
import javax.management.modelmbean.InvalidTargetObjectTypeException;
import javax.management.modelmbean.ModelMBeanNotificationBroadcaster;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
/*
* Changes from commons.modeler:
@@ -101,7 +102,6 @@
* @author Costin Manolache
*/
public class BaseModelMBean implements DynamicMBean, MBeanRegistration, ModelMBeanNotificationBroadcaster {
- private static Logger log = Logger.getLogger(BaseModelMBean.class);
// ----------------------------------------------------------- Constructors
@@ -169,8 +169,8 @@
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute name is null"),
- "Attribute name is null");
+ (new IllegalArgumentException(MESSAGES.nullAttributeName()),
+ MESSAGES.nullAttributeName());
if( (resource instanceof DynamicMBean) &&
! ( resource instanceof BaseModelMBean )) {
@@ -196,16 +196,16 @@
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " + name);
+ ((RuntimeException) t, MESSAGES.errorGettingAttribute(name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, MESSAGES.errorGettingAttribute(name));
else
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, MESSAGES.errorGettingAttribute(name));
} catch (Exception e) {
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, MESSAGES.errorGettingAttribute(name));
}
// Return the results of this method invocation
@@ -224,8 +224,8 @@
// Validate the input parameters
if (names == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute names list is null"),
- "Attribute names list is null");
+ (new IllegalArgumentException(MESSAGES.nullAttributeNameList()),
+ MESSAGES.nullAttributeNameList());
// Prepare our response, eating all exceptions
AttributeList response = new AttributeList();
@@ -283,10 +283,9 @@
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Method name is null"),
- "Method name is null");
+ (new IllegalArgumentException(MESSAGES.nullMethodName()),
+ MESSAGES.nullMethodName());
- if( log.isDebugEnabled()) log.debug("Invoke " + name);
MethodKey mkey = new MethodKey(name, signature);
Method method= managedBean.getInvoke(name, params, signature, this, resource);
@@ -302,22 +301,20 @@
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
- log.error("Exception invoking method " + name , t );
if (t == null)
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " + name);
+ ((RuntimeException) t, MESSAGES.errorInvokingMethod(name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, MESSAGES.errorInvokingMethod(name));
else
throw new MBeanException
- ((Exception)t, "Exception invoking method " + name);
+ ((Exception)t, MESSAGES.errorInvokingMethod(name));
} catch (Exception e) {
- log.error("Exception invoking method " + name , e );
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, MESSAGES.errorInvokingMethod(name));
}
// Return the results of this method invocation
@@ -355,8 +352,7 @@
try {
return Class.forName(signature);
} catch (ClassNotFoundException e) {
- throw new ReflectionException
- (e, "Cannot find Class for " + signature);
+ throw new ReflectionException(e);
}
}
}
@@ -378,8 +374,8 @@
throws AttributeNotFoundException, MBeanException,
ReflectionException
{
- if( log.isDebugEnabled() )
- log.debug("Setting attribute " + this + " " + attribute );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("Setting attribute " + this + " " + attribute );
if( (resource instanceof DynamicMBean) &&
! ( resource instanceof BaseModelMBean )) {
@@ -394,16 +390,16 @@
// Validate the input parameters
if (attribute == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute is null"),
- "Attribute is null");
+ (new IllegalArgumentException(MESSAGES.nullAttribute()),
+ MESSAGES.nullAttribute());
String name = attribute.getName();
Object value = attribute.getValue();
if (name == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Attribute name is null"),
- "Attribute name is null");
+ (new IllegalArgumentException(MESSAGES.nullAttributeName()),
+ MESSAGES.nullAttributeName());
Object oldValue=null;
//if( getAttMap.get(name) != null )
@@ -425,23 +421,22 @@
t = e;
if (t instanceof RuntimeException)
throw new RuntimeOperationsException
- ((RuntimeException) t, "Exception invoking method " + name);
+ ((RuntimeException) t, MESSAGES.errorSettingAttribute(name));
else if (t instanceof Error)
throw new RuntimeErrorException
- ((Error) t, "Error invoking method " + name);
+ ((Error) t, MESSAGES.errorSettingAttribute(name));
else
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, MESSAGES.errorSettingAttribute(name));
} catch (Exception e) {
- log.error("Exception invoking method " + name , e );
throw new MBeanException
- (e, "Exception invoking method " + name);
+ (e, MESSAGES.errorSettingAttribute(name));
}
try {
sendAttributeChangeNotification(new Attribute( name, oldValue),
attribute);
} catch(Exception ex) {
- log.error("Error sending notification " + name, ex);
+ CoyoteLogger.MODELER_LOGGER.errorSendingNotification(ex);
}
//attributes.put( name, value );
// if( source != null ) {
@@ -509,8 +504,8 @@
if (resource == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Managed resource is null"),
- "Managed resource is null");
+ (new IllegalArgumentException(MESSAGES.nullManagedResource()),
+ MESSAGES.nullManagedResource());
return resource;
@@ -548,8 +543,8 @@
{
if (resource == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Managed resource is null"),
- "Managed resource is null");
+ (new IllegalArgumentException(MESSAGES.nullManagedResource()),
+ MESSAGES.nullManagedResource());
// if (!"objectreference".equalsIgnoreCase(type))
// throw new InvalidTargetObjectTypeException(type);
@@ -591,12 +586,12 @@
throws IllegalArgumentException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new IllegalArgumentException(MESSAGES.nullListener());
if (attributeBroadcaster == null)
attributeBroadcaster = new BaseNotificationBroadcaster();
- if( log.isDebugEnabled() )
- log.debug("addAttributeNotificationListener " + listener);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("addAttributeNotificationListener " + listener);
BaseAttributeFilter filter = new BaseAttributeFilter(name);
attributeBroadcaster.addNotificationListener
@@ -621,7 +616,7 @@
throws ListenerNotFoundException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new IllegalArgumentException(MESSAGES.nullListener());
if (attributeBroadcaster == null)
attributeBroadcaster = new BaseNotificationBroadcaster();
@@ -671,12 +666,12 @@
if (notification == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Notification is null"),
- "Notification is null");
+ (new IllegalArgumentException(MESSAGES.nullNotification()),
+ MESSAGES.nullNotification());
if (attributeBroadcaster == null)
return; // This means there are no registered listeners
- if( log.isDebugEnabled() )
- log.debug( "AttributeChangeNotification " + notification );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug( "AttributeChangeNotification " + notification );
attributeBroadcaster.sendNotification(notification);
}
@@ -736,8 +731,8 @@
if (notification == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Notification is null"),
- "Notification is null");
+ (new IllegalArgumentException(MESSAGES.nullNotification()),
+ MESSAGES.nullNotification());
if (generalBroadcaster == null)
return; // This means there are no registered listeners
generalBroadcaster.sendNotification(notification);
@@ -761,8 +756,8 @@
if (message == null)
throw new RuntimeOperationsException
- (new IllegalArgumentException("Message is null"),
- "Message is null");
+ (new IllegalArgumentException(MESSAGES.nullMessage()),
+ MESSAGES.nullMessage());
Notification notification = new Notification
("jmx.modelmbean.generic", this, 1, message);
sendNotification(notification);
@@ -792,9 +787,9 @@
throws IllegalArgumentException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new IllegalArgumentException(MESSAGES.nullListener());
- if( log.isDebugEnabled() ) log.debug("addNotificationListener " + listener);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) CoyoteLogger.MODELER_LOGGER.debug("addNotificationListener " + listener);
if (generalBroadcaster == null)
generalBroadcaster = new BaseNotificationBroadcaster();
@@ -808,8 +803,8 @@
if (attributeBroadcaster == null)
attributeBroadcaster = new BaseNotificationBroadcaster();
- if( log.isDebugEnabled() )
- log.debug("addAttributeNotificationListener " + listener);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("addAttributeNotificationListener " + listener);
attributeBroadcaster.addNotificationListener
(listener, filter, handback);
@@ -876,7 +871,7 @@
throws ListenerNotFoundException {
if (listener == null)
- throw new IllegalArgumentException("Listener is null");
+ throw new IllegalArgumentException(MESSAGES.nullListener());
if (generalBroadcaster == null)
generalBroadcaster = new BaseNotificationBroadcaster();
generalBroadcaster.removeNotificationListener(listener);
@@ -1116,8 +1111,8 @@
ObjectName name)
throws Exception
{
- if( log.isDebugEnabled())
- log.debug("preRegister " + resource + " " + name );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug("preRegister " + resource + " " + name );
oname=name;
if( resource instanceof MBeanRegistration ) {
oname = ((MBeanRegistration)resource).preRegister(server, name );
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/BaseNotificationBroadcaster.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -19,6 +19,8 @@
package org.apache.tomcat.util.modeler;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.util.ArrayList;
import java.util.Iterator;
@@ -228,7 +230,7 @@
int code=reg.getId(null, names[i]);
if( hooks.length < code ) {
// XXX reallocate
- throw new RuntimeException( "Too many hooks " + code );
+ throw MESSAGES.tooManyHooks(code);
}
NotificationListener listeners[]=hooks[code];
if( listeners== null ) {
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/ManagedBean.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/ManagedBean.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/ManagedBean.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -19,6 +19,8 @@
package org.apache.tomcat.util.modeler;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
@@ -366,7 +368,7 @@
if( clazz==null) {
throw new MBeanException
- (ex, "Cannot load ModelMBean class " + getClassName());
+ (ex, MESSAGES.errorLoadingModelMbean(getClassName()));
}
try {
// Stupid - this will set the default minfo first....
@@ -375,8 +377,7 @@
throw e;
} catch (Exception e) {
throw new MBeanException
- (e, "Cannot instantiate ModelMBean of class " +
- getClassName());
+ (e, MESSAGES.errorInstantiatingModelMbean(getClassName()));
}
}
@@ -487,11 +488,11 @@
AttributeInfo attrInfo = (AttributeInfo)attributes.get(aname);
// Look up the actual operation to be used
if (attrInfo == null)
- throw new AttributeNotFoundException(" Cannot find attribute " + aname + " for " + resource);
+ throw new AttributeNotFoundException(MESSAGES.errorGettingAttribute(aname));
String getMethod = attrInfo.getGetMethod();
if (getMethod == null)
- throw new AttributeNotFoundException("Cannot find attribute " + aname + " get method name");
+ throw new AttributeNotFoundException(MESSAGES.errorGettingAttribute(aname));
Object object = null;
NoSuchMethodException exception = null;
@@ -512,7 +513,7 @@
}
if( exception != null )
throw new ReflectionException(exception,
- "Cannot find getter method " + getMethod);
+ MESSAGES.errorGettingAttribute(aname));
//getAttMap.put( name, m );
}
@@ -528,12 +529,12 @@
if( m==null ) {
AttributeInfo attrInfo = (AttributeInfo)attributes.get(aname);
if (attrInfo == null)
- throw new AttributeNotFoundException(" Cannot find attribute " + aname);
+ throw new AttributeNotFoundException(MESSAGES.errorSettingAttribute(aname));
// Look up the actual operation to be used
String setMethod = attrInfo.getSetMethod();
if (setMethod == null)
- throw new AttributeNotFoundException("Cannot find attribute " + aname + " set method name");
+ throw new AttributeNotFoundException(MESSAGES.errorSettingAttribute(aname));
String argType=attrInfo.getType();
@@ -558,8 +559,7 @@
}
if( exception != null )
throw new ReflectionException(exception,
- "Cannot find setter method " + setMethod +
- " " + resource);
+ MESSAGES.errorSettingAttribute(aname));
//setAttMap.put( name, m );
}
@@ -577,16 +577,16 @@
if (params.length != signature.length)
throw new RuntimeOperationsException(
new IllegalArgumentException(
- "Inconsistent arguments and signature"),
- "Inconsistent arguments and signature");
+ MESSAGES.errorInvokingMethod(aname)),
+ MESSAGES.errorInvokingMethod(aname));
// Acquire the ModelMBeanOperationInfo information for
// the requested operation
OperationInfo opInfo = (OperationInfo)operations.get(aname);
if (opInfo == null)
throw new MBeanException(new ServiceNotFoundException(
- "Cannot find operation " + aname),
- "Cannot find operation " + aname);
+ MESSAGES.errorInvokingMethod(aname)),
+ MESSAGES.errorInvokingMethod(aname));
// Prepare the signature required by Java reflection APIs
// FIXME - should we use the signature from opInfo?
@@ -616,8 +616,7 @@
exception = e;
}
if (method == null) {
- throw new ReflectionException(exception, "Cannot find method "
- + aname + " with this signature");
+ throw new ReflectionException(exception, MESSAGES.errorInvokingMethod(aname));
}
// invokeAttMap.put(mkey, method);
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/Registry.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/Registry.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/Registry.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -40,8 +40,7 @@
import javax.management.ObjectName;
import org.apache.tomcat.util.modeler.modules.ModelerSource;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
/*
Issues:
@@ -72,10 +71,6 @@
* @author Costin Manolache
*/
public class Registry implements RegistryMBean, MBeanRegistration {
- /**
- * The Log instance to which we will write our log messages.
- */
- private static Logger log = Logger.getLogger(Registry.class);
// Support for the factory methods
@@ -288,7 +283,7 @@
try {
unregisterComponent(new ObjectName(oname));
} catch (MalformedObjectNameException e) {
- log.info("Error creating object name " + e );
+ CoyoteLogger.MODELER_LOGGER.errorCreatingObjectName(e);
}
}
@@ -330,7 +325,7 @@
} catch( Exception t ) {
if( failFirst ) throw t;
- log.info("Error initializing " + current + " " + t.toString());
+ CoyoteLogger.MODELER_LOGGER.errorInvokingOperation(operation, current);
}
}
}
@@ -524,7 +519,7 @@
try {
info=server.getMBeanInfo(oname);
} catch (Exception e) {
- log.info( "Can't find metadata for object" + oname );
+ CoyoteLogger.MODELER_LOGGER.noMetadata(oname);
return null;
}
@@ -551,7 +546,7 @@
try {
info=server.getMBeanInfo(oname);
} catch (Exception e) {
- log.info( "Can't find metadata " + oname );
+ CoyoteLogger.MODELER_LOGGER.noMetadata(oname);
return null;
}
MBeanOperationInfo attInfo[]=info.getOperations();
@@ -574,7 +569,7 @@
getMBeanServer().unregisterMBean(oname);
}
} catch( Throwable t ) {
- log.error( "Error unregistering mbean ", t);
+ CoyoteLogger.MODELER_LOGGER.errorUnregisteringMbean(oname, t);
}
}
@@ -589,13 +584,13 @@
if (server == null) {
if( MBeanServerFactory.findMBeanServer(null).size() > 0 ) {
server=(MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0);
- if( log.isDebugEnabled() ) {
- log.debug("Using existing MBeanServer " + (System.currentTimeMillis() - t1 ));
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug("Using existing MBeanServer " + (System.currentTimeMillis() - t1 ));
}
} else {
server=MBeanServerFactory.createMBeanServer();
- if( log.isDebugEnabled() ) {
- log.debug("Creating MBeanServer"+ (System.currentTimeMillis() - t1 ));
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug("Creating MBeanServer"+ (System.currentTimeMillis() - t1 ));
}
}
}
@@ -621,8 +616,8 @@
// Search for a descriptor in the same package
if( managed==null ) {
// check package and parent packages
- if( log.isDebugEnabled() ) {
- log.debug( "Looking for descriptor ");
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug( "Looking for descriptor ");
}
findDescriptor( beanClass, type );
@@ -630,8 +625,8 @@
}
if( bean instanceof DynamicMBean ) {
- if( log.isDebugEnabled() ) {
- log.debug( "Dynamic mbean support ");
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug( "Dynamic mbean support ");
}
// Dynamic mbean
loadDescriptors("MbeansDescriptorsDynamicMBeanSource",
@@ -642,8 +637,8 @@
// Still not found - use introspection
if( managed==null ) {
- if( log.isDebugEnabled() ) {
- log.debug( "Introspecting ");
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug( "Introspecting ");
}
// introspection
@@ -652,7 +647,7 @@
managed=findManagedBean(type);
if( managed==null ) {
- log.warn( "No metadata found for " + type );
+ CoyoteLogger.MODELER_LOGGER.noMetadata(type);
return null;
}
managed.setName( type );
@@ -709,8 +704,8 @@
public List load( String sourceType, Object source, String param)
throws Exception
{
- if( log.isTraceEnabled()) {
- log.trace("load " + source );
+ if( CoyoteLogger.MODELER_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.trace("load " + source );
}
String location=null;
String type=null;
@@ -776,12 +771,12 @@
public void registerComponent(Object bean, ObjectName oname, String type)
throws Exception
{
- if( log.isDebugEnabled() ) {
- log.debug( "Managed= "+ oname);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.debug( "Managed= "+ oname);
}
if( bean ==null ) {
- log.error("Null component " + oname );
+ CoyoteLogger.MODELER_LOGGER.nullComponent(oname);
return;
}
@@ -796,15 +791,15 @@
DynamicMBean mbean = managed.createMBean(bean);
if( getMBeanServer().isRegistered( oname )) {
- if( log.isDebugEnabled()) {
- log.debug("Unregistering existing component " + oname );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.debug("Unregistering existing component " + oname );
}
getMBeanServer().unregisterMBean( oname );
}
getMBeanServer().registerMBean( mbean, oname);
} catch( Exception ex) {
- log.error("Error registering " + oname, ex );
+ CoyoteLogger.MODELER_LOGGER.errorRegisteringMbean(oname, ex);
throw ex;
}
}
@@ -817,8 +812,8 @@
public void loadDescriptors( String packageName, ClassLoader classLoader ) {
String res=packageName.replace( '.', '/');
- if( log.isTraceEnabled() ) {
- log.trace("Finding descriptor " + res );
+ if( CoyoteLogger.MODELER_LOGGER.isTraceEnabled() ) {
+ CoyoteLogger.MODELER_LOGGER.trace("Finding descriptor " + res );
}
if( searchedPaths.get( packageName ) != null ) {
@@ -836,8 +831,8 @@
return;
}
- if (log.isDebugEnabled()) {
- log.debug( "Found " + dURL);
+ if (CoyoteLogger.MODELER_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.debug( "Found " + dURL);
}
searchedPaths.put( packageName, dURL );
try {
@@ -847,7 +842,7 @@
loadDescriptors("MbeansDescriptorsSerSource", dURL, null);
return;
} catch(Exception ex ) {
- log.error("Error loading " + dURL);
+ CoyoteLogger.MODELER_LOGGER.errorLoading(dURL);
}
return;
@@ -1009,13 +1004,14 @@
// should be removed
public void unregisterComponent( String domain, String name ) {
+ ObjectName oname= null;
try {
- ObjectName oname=new ObjectName( domain + ":" + name );
+ oname=new ObjectName( domain + ":" + name );
// XXX remove from our tables.
getMBeanServer().unregisterMBean( oname );
} catch( Throwable t ) {
- log.error( "Error unregistering mbean ", t );
+ CoyoteLogger.MODELER_LOGGER.errorUnregisteringMbean(oname, t);
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDOMSource.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -29,15 +29,13 @@
import org.apache.tomcat.util.modeler.OperationInfo;
import org.apache.tomcat.util.modeler.ParameterInfo;
import org.apache.tomcat.util.modeler.Registry;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
public class MbeansDescriptorsDOMSource extends ModelerSource
{
- private static Logger log = Logger.getLogger(MbeansDescriptorsDOMSource.class);
Registry registry;
String location;
@@ -88,7 +86,7 @@
Node descriptorsN=doc.getDocumentElement();
//Node descriptorsN=DomUtil.getChild(doc, "mbeans-descriptors");
if( descriptorsN == null ) {
- log.error("No descriptors found");
+ CoyoteLogger.MODELER_LOGGER.noDescriptorsFound();
return;
}
@@ -100,7 +98,7 @@
}
if( firstMbeanN==null ) {
- log.error(" No mbean tags ");
+ CoyoteLogger.MODELER_LOGGER.noMbeansFound();
return;
}
@@ -155,8 +153,8 @@
// Add this info to our managed bean info
managed.addAttribute( ai );
- if (log.isTraceEnabled()) {
- log.trace("Create attribute " + ai);
+ if (CoyoteLogger.MODELER_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.trace("Create attribute " + ai);
}
}
@@ -237,8 +235,8 @@
// Add this info to our managed bean info
managed.addNotification( ni );
- if (log.isTraceEnabled()) {
- log.trace("Created notification " + ni);
+ if (CoyoteLogger.MODELER_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.trace("Created notification " + ni);
}
}
@@ -275,15 +273,15 @@
{
ParameterInfo pi=new ParameterInfo();
DomUtil.setAttributes(pi, paramN);
- if( log.isTraceEnabled())
- log.trace("Add param " + pi.getName());
+ if( CoyoteLogger.MODELER_LOGGER.isTraceEnabled())
+ CoyoteLogger.MODELER_LOGGER.trace("Add param " + pi.getName());
oi.addParameter( pi );
}
// Add this info to our managed bean info
managed.addOperation( oi );
- if( log.isTraceEnabled()) {
- log.trace("Create operation " + oi);
+ if( CoyoteLogger.MODELER_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.MODELER_LOGGER.trace("Create operation " + oi);
}
}
@@ -295,9 +293,9 @@
}
long t2=System.currentTimeMillis();
- log.debug( "Reading descriptors ( dom ) " + (t2-t1));
+ CoyoteLogger.MODELER_LOGGER.debug( "Reading descriptors ( dom ) " + (t2-t1));
} catch( Exception ex ) {
- log.error( "Error reading descriptors ", ex);
+ CoyoteLogger.MODELER_LOGGER.errorReadingDescriptors(ex);
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -33,12 +33,10 @@
import org.apache.tomcat.util.modeler.OperationInfo;
import org.apache.tomcat.util.modeler.ParameterInfo;
import org.apache.tomcat.util.modeler.Registry;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
public class MbeansDescriptorsIntrospectionSource extends ModelerSource
{
- private static Logger log = Logger.getLogger(MbeansDescriptorsIntrospectionSource.class);
Registry registry;
String location;
@@ -88,7 +86,7 @@
mbeans.add(managed);
} catch( Exception ex ) {
- log.error( "Error reading descriptors ", ex);
+ CoyoteLogger.MODELER_LOGGER.errorReadingDescriptors(ex);
}
}
@@ -211,8 +209,8 @@
if( Modifier.isStatic(methods[j].getModifiers()))
continue;
if( ! Modifier.isPublic( methods[j].getModifiers() ) ) {
- if( log.isDebugEnabled())
- log.debug("Not public " + methods[j] );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug("Not public " + methods[j] );
continue;
}
if( methods[j].getDeclaringClass() == Object.class )
@@ -222,8 +220,8 @@
if( name.startsWith( "get" ) && params.length==0) {
Class ret=methods[j].getReturnType();
if( ! supportedType( ret ) ) {
- if( log.isDebugEnabled() )
- log.debug("Unsupported type " + methods[j]);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("Unsupported type " + methods[j]);
continue;
}
name=unCapitalize( name.substring(3));
@@ -234,8 +232,8 @@
} else if( name.startsWith( "is" ) && params.length==0) {
Class ret=methods[j].getReturnType();
if( Boolean.TYPE != ret ) {
- if( log.isDebugEnabled() )
- log.debug("Unsupported type " + methods[j] + " " + ret );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("Unsupported type " + methods[j] + " " + ret );
continue;
}
name=unCapitalize( name.substring(2));
@@ -246,8 +244,8 @@
} else if( name.startsWith( "set" ) && params.length==1) {
if( ! supportedType( params[0] ) ) {
- if( log.isDebugEnabled() )
- log.debug("Unsupported type " + methods[j] + " " + params[0]);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("Unsupported type " + methods[j] + " " + params[0]);
continue;
}
name=unCapitalize( name.substring(3));
@@ -329,7 +327,7 @@
ai.setSetMethod( sm.getName());
}
ai.setDescription("Introspected attribute " + name);
- if( log.isDebugEnabled()) log.debug("Introspected attribute " +
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled()) CoyoteLogger.MODELER_LOGGER.debug("Introspected attribute " +
name + " " + gm + " " + sm);
if( gm==null )
ai.setReadable(false);
@@ -358,7 +356,7 @@
}
mbean.addOperation(op);
} else {
- log.error("Null arg " + name + " " + m );
+ CoyoteLogger.MODELER_LOGGER.debug("Null arg " + name + " " + m );
}
}
@@ -384,13 +382,13 @@
}
*/
- if( log.isDebugEnabled())
- log.debug("Setting name: " + type );
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug("Setting name: " + type );
mbean.setName( type );
return mbean;
} catch( Exception ex ) {
- ex.printStackTrace();
+ CoyoteLogger.MODELER_LOGGER.errorReadingDescriptors(ex);
return null;
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsSerSource.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.util.modeler.modules;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.URL;
@@ -24,13 +26,11 @@
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
public class MbeansDescriptorsSerSource extends ModelerSource
{
- private static Logger log = Logger.getLogger(MbeansDescriptorsSerSource.class);
Registry registry;
String location;
String type;
@@ -81,7 +81,7 @@
stream=(InputStream)source;
}
if( stream==null ) {
- throw new Exception( "Can't process "+ source);
+ throw MESSAGES.invalidSource(source);
}
ObjectInputStream ois=new ObjectInputStream(stream);
Thread.currentThread().setContextClassLoader(ManagedBean.class.getClassLoader());
@@ -94,11 +94,10 @@
}
} catch( Exception ex ) {
- log.error( "Error reading descriptors " + source + " " + ex.toString(),
- ex);
+ CoyoteLogger.MODELER_LOGGER.errorReadingDescriptors(ex);
throw ex;
}
long t2=System.currentTimeMillis();
- log.info( "Reading descriptors ( ser ) " + (t2-t1));
+ CoyoteLogger.MODELER_LOGGER.debug( "Reading descriptors ( ser ) " + (t2-t1));
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/modeler/modules/MbeansSource.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -35,8 +35,7 @@
import org.apache.tomcat.util.modeler.BaseModelMBean;
import org.apache.tomcat.util.modeler.ManagedBean;
import org.apache.tomcat.util.modeler.Registry;
-import org.jboss.logging.Logger;
-import org.jboss.logging.Logger;
+import org.jboss.web.CoyoteLogger;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -53,7 +52,6 @@
*/
public class MbeansSource extends ModelerSource implements MbeansSourceMBean
{
- private static Logger log = Logger.getLogger(MbeansSource.class);
Registry registry;
String type;
@@ -148,7 +146,7 @@
Node descriptorsN=document.getDocumentElement();
if( descriptorsN == null ) {
- log.error("No descriptors found");
+ CoyoteLogger.MODELER_LOGGER.noDescriptorsFound();
return;
}
@@ -156,8 +154,8 @@
if( firstMbeanN==null ) {
// maybe we have a single mlet
- if( log.isDebugEnabled() )
- log.debug("No child " + descriptorsN);
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() )
+ CoyoteLogger.MODELER_LOGGER.debug("No child " + descriptorsN);
firstMbeanN=descriptorsN;
}
@@ -188,8 +186,8 @@
objectName=DomUtil.getAttribute( mbeanN, "name" );
}
- if( log.isDebugEnabled())
- log.debug( "Processing mbean objectName=" + objectName +
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug( "Processing mbean objectName=" + objectName +
" code=" + code);
// args can be grouped in constructor or direct childs
@@ -214,7 +212,7 @@
object2Node.put( oname, mbeanN );
// XXX Arguments, loader !!!
} catch( Exception ex ) {
- log.error( "Error creating mbean " + objectName, ex);
+ CoyoteLogger.MODELER_LOGGER.errorCreatingMbean(objectName, ex);
}
Node firstAttN=DomUtil.getChild(mbeanN, "attribute");
@@ -230,8 +228,8 @@
String operation=DomUtil.getAttribute(mbeanN, "operation");
- if( log.isDebugEnabled())
- log.debug( "Processing invoke objectName=" + name +
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug( "Processing invoke objectName=" + name +
" code=" + operation);
try {
ObjectName oname=new ObjectName(name);
@@ -239,7 +237,7 @@
processArg( mbeanN );
server.invoke( oname, operation, null, null);
} catch (Exception e) {
- log.error( "Error in invoke " + name + " " + operation);
+ CoyoteLogger.MODELER_LOGGER.errorInvoking(operation, name);
}
}
@@ -260,10 +258,10 @@
}
long t2=System.currentTimeMillis();
- log.info( "Reading mbeans " + (t2-t1));
+ CoyoteLogger.MODELER_LOGGER.debug( "Reading mbeans " + (t2-t1));
loading=false;
} catch( Exception ex ) {
- log.error( "Error reading mbeans ", ex);
+ CoyoteLogger.MODELER_LOGGER.errorReadingDescriptors(ex);
}
}
@@ -275,7 +273,7 @@
//log.info( "XXX UpdateField " + oname + " " + name + " " + value);
Node n=(Node)object2Node.get( oname );
if( n == null ) {
- log.info( "Node not found " + oname );
+ CoyoteLogger.MODELER_LOGGER.nodeNotFound(oname);
return;
}
Node attNode=DomUtil.findChildWithAtt(n, "attribute", "name", name);
@@ -310,9 +308,9 @@
FileOutputStream fos=new FileOutputStream(location);
DomUtil.writeXml(document, fos);
} catch (TransformerException e) {
- log.error( "Error writing");
+ CoyoteLogger.MODELER_LOGGER.errorWritingMbeans(e);
} catch (FileNotFoundException e) {
- log.error( "Error writing" ,e );
+ CoyoteLogger.MODELER_LOGGER.errorWritingMbeans(e);
}
}
}
@@ -327,8 +325,8 @@
value=DomUtil.getContent(descN);
}
try {
- if( log.isDebugEnabled())
- log.debug("Set attribute " + objectName + " " + attName +
+ if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled())
+ CoyoteLogger.MODELER_LOGGER.debug("Set attribute " + objectName + " " + attName +
" " + value);
ObjectName oname=new ObjectName(objectName);
// find the type
@@ -336,15 +334,13 @@
type=registry.getType( oname, attName );
if( type==null ) {
- log.info("Can't find attribute " + objectName + " " + attName );
-
+ CoyoteLogger.MODELER_LOGGER.attributeNotFound(attName, objectName);
} else {
Object valueO=registry.convertValue( type, value);
server.setAttribute(oname, new Attribute(attName, valueO));
}
} catch( Exception ex) {
- log.error("Error processing attribute " + objectName + " " +
- attName + " " + value, ex);
+ CoyoteLogger.MODELER_LOGGER.errorProcessingAttribute(attName, value, objectName, ex);
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/NioServerSocketChannelFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/NioServerSocketChannelFactory.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/NioServerSocketChannelFactory.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -35,9 +35,6 @@
*/
public abstract class NioServerSocketChannelFactory implements Cloneable {
- protected static org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(NioServerSocketChannelFactory.class);
-
private static NioServerSocketChannelFactory theFactory;
protected Hashtable<String, Object> attributes = new Hashtable<String, Object>();
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/SSLImplementation.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/SSLImplementation.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/SSLImplementation.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -17,10 +17,11 @@
package org.apache.tomcat.util.net;
-import java.net.Socket;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import javax.net.ssl.SSLSession;
-import org.apache.tomcat.util.net.jsse.NioJSSESocketChannelFactory;
+import org.jboss.web.CoyoteLogger;
/**
* {@code SSLImplementation}
@@ -34,10 +35,8 @@
* @author EKR & <a href="mailto:nbenothm@redhat.com">Nabil Benothman</a>
*/
abstract public class SSLImplementation {
- private static org.jboss.logging.Logger logger = org.jboss.logging.Logger
- .getLogger(SSLImplementation.class);
- private static final String[] implementations = { "org.apache.tomcat.util.net.jsse.NioJSSEImplementation" };
+ private static final String[] implementations = { "org.apache.tomcat.util.net.jsse.JSSEImplementation" };
/**
* @return the default implementation of {@code SSLImplementation}
@@ -49,13 +48,13 @@
SSLImplementation impl = getInstance(implementations[i]);
return impl;
} catch (Exception e) {
- if (logger.isTraceEnabled())
- logger.trace("Error creating " + implementations[i], e);
+ if (CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("Error creating " + implementations[i], e);
}
}
// If we can't instantiate any of these
- throw new ClassNotFoundException("Can't find any SSL implementation");
+ throw new ClassNotFoundException(MESSAGES.noSslImplementation());
}
/**
@@ -73,10 +72,9 @@
Class<?> clazz = Class.forName(className);
return (SSLImplementation) clazz.newInstance();
} catch (Exception e) {
- if (logger.isDebugEnabled())
- logger.debug("Error loading SSL Implementation " + className, e);
- throw new ClassNotFoundException("Error loading SSL Implementation " + className + " :"
- + e.toString());
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled())
+ CoyoteLogger.UTIL_LOGGER.debug("Error loading SSL Implementation " + className, e);
+ throw new ClassNotFoundException(MESSAGES.errorLoadingSslImplementation(className), e);
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/URL.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/URL.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/URL.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -18,6 +18,8 @@
package org.apache.tomcat.util.net;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.Serializable;
import java.net.MalformedURLException;
import java.util.Locale;
@@ -150,7 +152,7 @@
}
if (protocol == null)
- throw new MalformedURLException("no protocol: " + original);
+ throw new MalformedURLException(MESSAGES.urlWithNoProtocol(original));
// Parse out any ref portion of the spec
i = spec.indexOf('#', start);
@@ -168,7 +170,7 @@
} catch (MalformedURLException e) {
throw e;
} catch (Exception e) {
- throw new MalformedURLException(e.toString());
+ throw new MalformedURLException(MESSAGES.errorProcessingUrl(e.getMessage()));
}
}
@@ -477,8 +479,7 @@
if (index < 0)
break;
if (index == 0)
- throw new MalformedURLException
- ("Invalid relative URL reference");
+ throw new MalformedURLException(MESSAGES.invalidRelativeUrlReference());
int index2 = normalized.lastIndexOf('/', index - 1);
normalized = normalized.substring(0, index2) +
normalized.substring(index + 3);
@@ -493,8 +494,7 @@
int index = normalized.length() - 3;
int index2 = normalized.lastIndexOf('/', index - 1);
if (index2 < 0)
- throw new MalformedURLException
- ("Invalid relative URL reference");
+ throw new MalformedURLException(MESSAGES.invalidRelativeUrlReference());
normalized = normalized.substring(0, index2 + 1);
}
@@ -666,8 +666,7 @@
hStart = ipv6;
ipv6 = authority.indexOf(']', ipv6);
if( ipv6 < 0 ) {
- throw new MalformedURLException(
- "Closing ']' not found in IPV6 address: " + authority);
+ throw new MalformedURLException(MESSAGES.invalidIp6Address(authority));
} else {
at = ipv6-1;
}
@@ -679,7 +678,7 @@
port =
Integer.parseInt(authority.substring(colon + 1));
} catch (NumberFormatException e) {
- throw new MalformedURLException(e.toString());
+ throw new MalformedURLException(MESSAGES.invalidIpAddress(authority, e.getMessage()));
}
host = authority.substring(hStart, colon);
} else {
@@ -708,8 +707,7 @@
return;
}
if (!path.startsWith("/"))
- throw new MalformedURLException
- ("Base path does not start with '/'");
+ throw new MalformedURLException(MESSAGES.invalidBasePath());
if (!path.endsWith("/"))
path += "/../";
path += spec.substring(start, limit);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -27,7 +27,6 @@
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
-import java.net.SocketException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
@@ -96,9 +95,6 @@
private static final int defaultSessionCacheSize = 0;
private static final int defaultSessionTimeout = 86400;
- static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(JSSESocketFactory.class);
-
static {
boolean result = false;
SSLContext context;
@@ -177,7 +173,7 @@
try {
asock = (SSLSocket)socket.accept();
} catch (SSLException e){
- throw new SocketException("SSL handshake error" + e.toString());
+ throw new IOException(MESSAGES.sslHandshakeError(), e);
}
return asock;
}
@@ -186,7 +182,7 @@
// We do getSession instead of startHandshake() so we can call this multiple times
SSLSession session = ((SSLSocket)sock).getSession();
if (session.getCipherSuite().equals("SSL_NULL_WITH_NULL_NULL"))
- throw new IOException("SSL handshake failed. Ciper suite in SSL Session is SSL_NULL_WITH_NULL_NULL");
+ throw new IOException(MESSAGES.invalidSslCipherSuite());
if (!allowUnsafeLegacyRenegotiation && !RFC_5746_SUPPORTED) {
// Prevent further handshakes by removing all cipher suites
@@ -308,15 +304,15 @@
if(truststoreFile == null) {
truststoreFile = System.getProperty("javax.net.ssl.trustStore");
}
- if(log.isDebugEnabled()) {
- log.debug("Truststore = " + truststoreFile);
+ if(CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("Truststore = " + truststoreFile);
}
String truststorePassword = (String)attributes.get("truststorePass");
if( truststorePassword == null) {
truststorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
}
- if(log.isDebugEnabled()) {
- log.debug("TrustPass = " + truststorePassword);
+ if(CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("TrustPass = " + truststorePassword);
}
String truststoreType = (String)attributes.get("truststoreType");
if( truststoreType == null) {
@@ -325,8 +321,8 @@
if(truststoreType == null) {
truststoreType = keystoreType;
}
- if(log.isDebugEnabled()) {
- log.debug("trustType = " + truststoreType);
+ if(CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("trustType = " + truststoreType);
}
String truststoreProvider =
(String)attributes.get("truststoreProvider");
@@ -337,8 +333,8 @@
if (truststoreProvider == null) {
truststoreProvider = keystoreProvider;
}
- if(log.isDebugEnabled()) {
- log.debug("trustProvider = " + truststoreProvider);
+ if(CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("trustProvider = " + truststoreProvider);
}
if (truststoreFile != null){
@@ -582,13 +578,13 @@
try {
xparams.setMaxPathLength(Integer.parseInt(trustLength));
} catch(Exception ex) {
- log.warn("Bad maxCertLength: "+trustLength);
+ CoyoteLogger.UTIL_LOGGER.invalidMaxCertLength(trustLength);
}
}
params = xparams;
} else {
- throw new CRLException("CRLs not supported for type: "+algorithm);
+ throw new CRLException(MESSAGES.unsupportedCrl(algorithm));
}
return params;
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/JSSESupport.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.net.jsse;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -33,6 +35,7 @@
import org.apache.tomcat.util.net.Constants;
import org.apache.tomcat.util.net.SSLSupport;
+import org.jboss.web.CoyoteLogger;
/** JSSESupport
@@ -51,9 +54,6 @@
class JSSESupport implements SSLSupport {
- private static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(JSSESupport.class);
-
protected SSLSocket ssl;
protected SSLSession session;
@@ -87,7 +87,7 @@
try {
certs = session.getPeerCertificates();
} catch( Throwable t ) {
- log.debug("Error getting client certs",t);
+ CoyoteLogger.UTIL_LOGGER.debug("Error getting client certs", t);
return null;
}
if( certs==null ) return null;
@@ -107,12 +107,12 @@
new ByteArrayInputStream(buffer);
x509Certs[i] = (java.security.cert.X509Certificate) cf.generateCertificate(stream);
} catch(Exception ex) {
- log.info("Error translating cert " + certs[i], ex);
+ CoyoteLogger.UTIL_LOGGER.errorTranslatingCertificate(certs[i], ex);
return null;
}
}
- if(log.isTraceEnabled())
- log.trace("Cert #" + i + " = " + x509Certs[i]);
+ if(CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("Cert #" + i + " = " + x509Certs[i]);
}
if(x509Certs.length < 1)
return null;
@@ -144,7 +144,7 @@
protected void handShake() throws IOException {
if( ssl.getWantClientAuth() ) {
- log.debug("No client cert sent for want");
+ CoyoteLogger.UTIL_LOGGER.debug("No client cert sent for want");
} else {
ssl.setNeedClientAuth(true);
}
@@ -152,7 +152,7 @@
if (ssl.getEnabledCipherSuites().length == 0) {
// Handshake is never going to be successful.
// Assume this is because handshakes are disabled
- log.warn("SSL server initiated renegotiation is disabled, closing connection");
+ CoyoteLogger.UTIL_LOGGER.disabledSslRenegociation();
session.invalidate();
ssl.close();
return;
@@ -166,12 +166,12 @@
ssl.startHandshake();
int maxTries = 60; // 60 * 1000 = example 1 minute time out
for (int i = 0; i < maxTries; i++) {
- if(log.isTraceEnabled())
- log.trace("Reading for try #" +i);
+ if(CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("Reading for try #" +i);
try {
int x = in.read(b);
} catch(SSLException sslex) {
- log.info("SSL Error getting client Certs",sslex);
+ CoyoteLogger.UTIL_LOGGER.trace("SSL Error getting client Certs",sslex);
throw sslex;
} catch (IOException e) {
// ignore - presumably the timeout
@@ -182,7 +182,7 @@
}
ssl.setSoTimeout(oldTimeout);
if (listener.completed == false) {
- throw new SocketException("SSL Cert handshake timeout");
+ throw new SocketException(MESSAGES.sslHandshakeTimeout());
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSEImplementation.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSEImplementation.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSEImplementation.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -18,8 +18,6 @@
package org.apache.tomcat.util.net.jsse;
-import java.net.Socket;
-
import javax.net.ssl.SSLSession;
import org.apache.tomcat.util.net.NioChannel;
@@ -37,9 +35,6 @@
static final String SSLClass = "javax.net.ssl.SSLEngine";
- static org.jboss.logging.Logger logger = org.jboss.logging.Logger
- .getLogger(NioJSSEImplementation.class);
-
private NioJSSEFactory factory = null;
/**
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESocketChannelFactory.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -165,7 +165,7 @@
NioChannel channel = new SecureNioChannel(asyncChannel, engine);
return channel;
} catch (Exception e) {
- throw new IOException(e);
+ throw new IOException(MESSAGES.sslHandshakeError(), e);
}
}
@@ -208,8 +208,7 @@
sslChannel.handshake();
if (sslChannel.getSSLSession().getCipherSuite().equals("SSL_NULL_WITH_NULL_NULL")) {
- throw new IOException(
- "SSL handshake failed. Ciper suite in SSL Session is SSL_NULL_WITH_NULL_NULL");
+ throw new IOException(MESSAGES.invalidSslCipherSuite());
}
}
@@ -585,15 +584,15 @@
if (truststoreFile == null) {
truststoreFile = System.getProperty("javax.net.ssl.trustStore");
}
- if (log.isDebugEnabled()) {
- log.debug("Truststore = " + truststoreFile);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("Truststore = " + truststoreFile);
}
String truststorePassword = (String) attributes.get("truststorePass");
if (truststorePassword == null) {
truststorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
}
- if (log.isDebugEnabled()) {
- log.debug("TrustPass = " + truststorePassword);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("TrustPass = " + truststorePassword);
}
String truststoreType = (String) attributes.get("truststoreType");
if (truststoreType == null) {
@@ -602,8 +601,8 @@
if (truststoreType == null) {
truststoreType = keystoreType;
}
- if (log.isDebugEnabled()) {
- log.debug("trustType = " + truststoreType);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("trustType = " + truststoreType);
}
String truststoreProvider = (String) attributes.get("truststoreProvider");
if (truststoreProvider == null) {
@@ -612,8 +611,8 @@
if (truststoreProvider == null) {
truststoreProvider = keystoreProvider;
}
- if (log.isDebugEnabled()) {
- log.debug("trustProvider = " + truststoreProvider);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
+ CoyoteLogger.UTIL_LOGGER.debug("trustProvider = " + truststoreProvider);
}
if (truststoreFile != null) {
@@ -652,13 +651,13 @@
try {
xparams.setMaxPathLength(Integer.parseInt(trustLength));
} catch (Exception ex) {
- log.warn("Bad maxCertLength: " + trustLength);
+ CoyoteLogger.UTIL_LOGGER.invalidMaxCertLength(trustLength);
}
}
params = xparams;
} else {
- throw new CRLException("CRLs not supported for type: " + algorithm);
+ throw new CRLException(MESSAGES.unsupportedCrl(algorithm));
}
return params;
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESupport.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESupport.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/NioJSSESupport.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -28,6 +28,7 @@
import org.apache.tomcat.util.net.Constants;
import org.apache.tomcat.util.net.SSLSupport;
+import org.jboss.web.CoyoteLogger;
/**
* {@code NioJSSESupport}
@@ -38,9 +39,6 @@
*/
class NioJSSESupport implements SSLSupport {
- private static org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(NioJSSESupport.class);
-
protected SecureNioChannel channel;
protected SSLSession session;
@@ -126,7 +124,7 @@
try {
certs = session.getPeerCertificates();
} catch (Throwable t) {
- log.debug("Error getting client certs", t);
+ CoyoteLogger.UTIL_LOGGER.debug("Error getting client certs", t);
return null;
}
if (certs == null)
@@ -145,12 +143,12 @@
x509Certs[i] = (java.security.cert.X509Certificate) cf
.generateCertificate(stream);
} catch (Exception ex) {
- log.info("Error translating cert " + certs[i], ex);
+ CoyoteLogger.UTIL_LOGGER.errorTranslatingCertificate(certs[i], ex);
return null;
}
}
- if (log.isTraceEnabled())
- log.trace("Cert #" + i + " = " + x509Certs[i]);
+ if (CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("Cert #" + i + " = " + x509Certs[i]);
}
if (x509Certs.length < 1)
return null;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/SecureNioChannel.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/SecureNioChannel.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/net/jsse/SecureNioChannel.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -18,6 +18,8 @@
package org.apache.tomcat.util.net.jsse;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
@@ -72,7 +74,7 @@
protected SecureNioChannel(AsynchronousSocketChannel channel, SSLEngine engine) {
super(channel);
if (engine == null) {
- throw new NullPointerException("null SSLEngine parameter");
+ throw MESSAGES.nullSslEngine();
}
this.sslEngine = engine;
@@ -97,8 +99,7 @@
@Deprecated
@Override
public Future<Integer> read(ByteBuffer dst) {
- throw new RuntimeException("Operation not supported for class " + getClass().getName()
- + ". Use method readBytes(...) instead");
+ throw MESSAGES.operationNotSupported();
}
/*
@@ -203,7 +204,7 @@
checkHandshake();
if (handler == null) {
- throw new NullPointerException("'handler' parameter is null");
+ throw MESSAGES.nullHandler();
}
if ((offset < 0) || (length < 0) || (offset > dsts.length - length)) {
throw new IndexOutOfBoundsException();
@@ -257,8 +258,7 @@
@Deprecated
@Override
public Future<Integer> write(ByteBuffer src) {
- throw new RuntimeException("Operation not supported for class " + getClass().getName()
- + ". Use method writeBytes(...) instead");
+ throw MESSAGES.operationNotSupported();
}
/*
@@ -374,7 +374,7 @@
checkHandshake();
if (handler == null) {
- throw new NullPointerException("'handler' parameter is null");
+ throw MESSAGES.nullHandler();
}
if ((offset < 0) || (length < 0) || (offset > srcs.length - length)) {
throw new IndexOutOfBoundsException();
@@ -587,8 +587,7 @@
// here we should trap BUFFER_OVERFLOW and call expand on the
// buffer for now, throw an exception, as we initialized the
// buffers in the constructor
- throw new IOException(this + " Unable to unwrap data, invalid status: "
- + result.getStatus());
+ throw new IOException(MESSAGES.errorUnwrappingData(result.getStatus().toString()));
}
// continue to unwrapping as long as the input buffer has stuff
} while (src.position() != 0);
@@ -642,8 +641,7 @@
*/
private void checkHandshake() {
if (!handshakeComplete) {
- throw new IllegalStateException(
- "Handshake incomplete, you must complete handshake before read/write data.");
+ throw MESSAGES.incompleteHandshake();
}
}
@@ -694,7 +692,7 @@
nBytes = this.channel.read(this.netInBuffer).get();
}
if (nBytes < 0) {
- throw new IOException(this + " : EOF encountered during handshake UNWRAP.");
+ throw new IOException(MESSAGES.errorUnwrappingHandshake());
} else {
boolean cont = false;
// Loop while we can perform pure SSLEngine data
@@ -745,14 +743,12 @@
while (this.netOutBuffer.hasRemaining()) {
if (this.channel.write(this.netOutBuffer).get() < 0) {
// Handle closed channel
- throw new IOException(this
- + " : EOF encountered during handshake WRAP.");
+ throw new IOException(MESSAGES.errorWrappingHandshake());
}
}
} else {
// Wrap should always work with our buffers
- throw new IOException("Unexpected status:" + res.getStatus()
- + " during handshake WRAP.");
+ throw new IOException(MESSAGES.errorWrappingHandshakeStatus(res.getStatus().toString()));
}
break;
@@ -761,7 +757,7 @@
break;
case NOT_HANDSHAKING:
- throw new SSLHandshakeException("NOT_HANDSHAKING during handshake");
+ throw new SSLHandshakeException(MESSAGES.notHandshaking());
case FINISHED:
handshakeComplete = true;
break;
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -24,6 +24,7 @@
import static org.jboss.logging.Logger.Level.DEBUG;
import java.net.InetAddress;
+import java.security.cert.Certificate;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Cause;
@@ -64,6 +65,16 @@
*/
CoyoteLogger BAYEUX_LOGGER = Logger.getMessageLogger(CoyoteLogger.class, "org.apache.tomcat.bayeux");
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger MODELER_LOGGER = Logger.getMessageLogger(CoyoteLogger.class, "org.apache.tomcat.util.modeler");
+
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger FILEUPLOAD_LOGGER = Logger.getMessageLogger(CoyoteLogger.class, "org.apache.tomcat.util.http.fileupload");
+
@LogMessage(level = INFO)
@Message(id = 3000, value = "Coyote HTTP/1.1 starting on: %s")
void startHttpConnector(String name);
@@ -408,4 +419,84 @@
@Message(id = 3085, value = "Failed getting property %s on object %s")
void errorGettingProperty(String propertyName, Object object, @Cause Throwable t);
+ @LogMessage(level = WARN)
+ @Message(id = 3086, value = "Bad maximum certificate length %s")
+ void invalidMaxCertLength(String length);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3087, value = "Error translating certificate %s")
+ void errorTranslatingCertificate(Certificate certificate, @Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3088, value = "SSL server initiated renegotiation is disabled, closing connection")
+ void disabledSslRenegociation();
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3089, value = "No descriptors found")
+ void noDescriptorsFound();
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3090, value = "No Mbeans found")
+ void noMbeansFound();
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3091, value = "Error reading descriptors")
+ void errorReadingDescriptors(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3092, value = "Error creating MBean %s")
+ void errorCreatingMbean(String objectName, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3093, value = "Error invoking %s on %s")
+ void errorInvoking(String operation, String name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3094, value = "Node not found %s")
+ void nodeNotFound(Object name);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3095, value = "Error writing MBeans")
+ void errorWritingMbeans(@Cause Throwable t);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3096, value = "Can't find attribute %s on %s")
+ void attributeNotFound(String attributeName, String objectName);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3097, value = "Error processing attribute %s value %s on %s")
+ void errorProcessingAttribute(String attributeName, String attributeValue, String objectName, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3098, value = "Error sending notification")
+ void errorSendingNotification(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3099, value = "Error creating object name")
+ void errorCreatingObjectName(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3100, value = "Error invoking operation %s on %s")
+ void errorInvokingOperation(String operation, Object objectName);
+
+ @LogMessage(level = INFO)
+ @Message(id = 3101, value = "No metadata for %s")
+ void noMetadata(Object objectName);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3102, value = "Error unregistering MBean %s")
+ void errorUnregisteringMbean(Object objectName, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3103, value = "Null %s component")
+ void nullComponent(Object objectName);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3104, value = "Error registering MBean %s")
+ void errorRegisteringMbean(Object objectName, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3105, value = "Error loading %s")
+ void errorLoading(Object source);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-10-02 12:04:41 UTC (rev 2094)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -160,4 +160,118 @@
@Message(id = 2040, value = "Invalid escape character in cookie value")
IllegalArgumentException invalidEscapeCharacter();
+ @Message(id = 2041, value = "SSL handshake error")
+ String sslHandshakeError();
+
+ @Message(id = 2042, value = "SSL handshake failed, cipher suite in SSL Session is SSL_NULL_WITH_NULL_NULL")
+ String invalidSslCipherSuite();
+
+ @Message(id = 2043, value = "Certificate revocation list is not supported for algorithm %s")
+ String unsupportedCrl(String algorithm);
+
+ @Message(id = 2044, value = "SSL handshake timeout")
+ String sslHandshakeTimeout();
+
+ @Message(id = 2045, value = "Null SSL engine")
+ IllegalArgumentException nullSslEngine();
+
+ @Message(id = 2046, value = "Operation not supported")
+ RuntimeException operationNotSupported();
+
+ @Message(id = 2047, value = "Null handler")
+ IllegalArgumentException nullHandler();
+
+ @Message(id = 2048, value = "Unable to unwrap data, invalid status %s")
+ String errorUnwrappingData(String status);
+
+ @Message(id = 2049, value = "Handshake incomplete, you must complete handshake before read/write data")
+ IllegalStateException incompleteHandshake();
+
+ @Message(id = 2050, value = "Error encountered during handshake unwrap")
+ String errorUnwrappingHandshake();
+
+ @Message(id = 2051, value = "Error encountered during handshake wrap")
+ String errorWrappingHandshake();
+
+ @Message(id = 2052, value = "Unexpected status %s during handshake wrap")
+ String errorWrappingHandshakeStatus(String status);
+
+ @Message(id = 2053, value = "NOT_HANDSHAKING during handshake")
+ String notHandshaking();
+
+ @Message(id = 2054, value = "Error loading SSL implementation %s")
+ String errorLoadingSslImplementation(String className);
+
+ @Message(id = 2055, value = "No SSL implementation")
+ String noSslImplementation();
+
+ @Message(id = 2056, value = "URL with no protocol: %s")
+ String urlWithNoProtocol(String url);
+
+ @Message(id = 2057, value = "Error processing URL: %s")
+ String errorProcessingUrl(String cause);
+
+ @Message(id = 2058, value = "Invalid relative URL reference")
+ String invalidRelativeUrlReference();
+
+ @Message(id = 2059, value = "Closing ']' not found in IPV6 address %s")
+ String invalidIp6Address(String authority);
+
+ @Message(id = 2060, value = "Invalid IP address %s: %s")
+ String invalidIpAddress(String authority, String cause);
+
+ @Message(id = 2061, value = "Base path does not start with '/'")
+ String invalidBasePath();
+
+ @Message(id = 2062, value = "Cannot process source: %s")
+ IllegalStateException invalidSource(Object source);
+
+ @Message(id = 2063, value = "Attribute name is null")
+ String nullAttributeName();
+
+ @Message(id = 2064, value = "Error getting attribute %s")
+ String errorGettingAttribute(String name);
+
+ @Message(id = 2065, value = "Attribute name list is null")
+ String nullAttributeNameList();
+
+ @Message(id = 2066, value = "Method name is null")
+ String nullMethodName();
+
+ @Message(id = 2067, value = "Error invoking method %s")
+ String errorInvokingMethod(String name);
+
+ @Message(id = 2068, value = "Attribute is null")
+ String nullAttribute();
+
+ @Message(id = 2069, value = "Error setting attribute %s")
+ String errorSettingAttribute(String name);
+
+ @Message(id = 2070, value = "Null managed resource")
+ String nullManagedResource();
+
+ @Message(id = 2071, value = "Null listener")
+ String nullListener();
+
+ @Message(id = 2072, value = "Null notification")
+ String nullNotification();
+
+ @Message(id = 2073, value = "Null message")
+ String nullMessage();
+
+ @Message(id = 2074, value = "Too many hooks registered %s")
+ IllegalStateException tooManyHooks(int count);
+
+ @Message(id = 2075, value = "Cannot load model MBean %s")
+ String errorLoadingModelMbean(String className);
+
+ @Message(id = 2076, value = "Cannot instantiate model MBean %s")
+ String errorInstantiatingModelMbean(String className);
+
+ @Message(id = 2077, value = "No host found: %s")
+ IllegalStateException mapperHostNotFound(String hostName);
+
+ @Message(id = 2078, value = "No context found: %s")
+ IllegalStateException mapperContextNotFound(String contextPath);
+
}
Added: branches/7.2.x/src/main/java/org/jboss/web/JSONMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/JSONMessages.java (rev 0)
+++ branches/7.2.x/src/main/java/org/jboss/web/JSONMessages.java 2012-10-02 16:08:29 UTC (rev 2095)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed 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.jboss.web;
+
+import org.jboss.logging.Cause;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageBundle;
+import org.jboss.logging.Messages;
+
+/**
+ * Logging IDs 8000-8200
+ * @author Remy Maucherat
+ */
+@MessageBundle(projectCode = "JBWEB")
+public interface JSONMessages {
+
+ /**
+ * The messages
+ */
+ JSONMessages MESSAGES = Messages.getBundle(JSONMessages.class);
+
+ @Message(id = 8000, value = "A JSONArray text must start with '[' at ")
+ String arrayMustStartWithBracket();
+
+ @Message(id = 8001, value = "Expected a '%s' at ")
+ String arrayCharExpected(char ch);
+
+ @Message(id = 8002, value = "Expected a ',' or ']' at ")
+ String arrayEndExpected();
+
+ @Message(id = 8003, value = "Array initial value should be a string or collection or array")
+ String arrayInvalidValue();
+
+ @Message(id = 8004, value = "Index %s not found in array")
+ String arrayInvalidIndex(int index);
+
+ @Message(id = 8005, value = "Array value at %s does not correspond to type %s")
+ String arrayInvalidType(int index, String type);
+
+ @Message(id = 8006, value = "A JSONObject text must begin with '{' at ")
+ String objectMustStartWithBracket();
+
+ @Message(id = 8007, value = "A JSONObject text must end with '}' at ")
+ String objectMustEndWithBracket();
+
+ @Message(id = 8008, value = "Expected a ':' after a key at ")
+ String objectExpectedKey();
+
+ @Message(id = 8009, value = "Expected a ',' or '}' at ")
+ String objectExpectedEnd();
+
+ @Message(id = 8010, value = "JSONObject[%s] does not correspond to type %s")
+ String objectInvalidType(String key, String type);
+
+ @Message(id = 8011, value = "JSONObject[%s] not found")
+ String objectNotFound(String key);
+
+ @Message(id = 8012, value = "Duplicate key %s")
+ String objectDuplicateKey(String key);
+
+ @Message(id = 8013, value = "JSON does not allow non-finite numbers")
+ String objectInfiniteNumber();
+
+ @Message(id = 8014, value = "Bad value from toJSONString: %s")
+ String objectBadString(Object o);
+
+ @Message(id = 8015, value = "Stepping back two steps is not supported")
+ String tokenerStepBack();
+
+ @Message(id = 8016, value = "Expected '%s' and instead saw '%s' at ")
+ String tokenerBadChar(char expected, char found);
+
+ @Message(id = 8017, value = "Substring bounds error at ")
+ String tokenerSubstring();
+
+ @Message(id = 8018, value = "Unterminated string at ")
+ String tokenerUnterminatedString();
+
+ @Message(id = 8019, value = "Missing value at ")
+ String tokenerMissingValue();
+
+ @Message(id = 8020, value = "Null string")
+ String writerNull();
+
+ @Message(id = 8021, value = "Value out of sequence")
+ String writerValueOutOfSequence();
+
+ @Message(id = 8023, value = "Misplaced array")
+ String writerMisplacedArray();
+
+ @Message(id = 8024, value = "Misplaced array end")
+ String writerMisplacedArrayEnd();
+
+ @Message(id = 8025, value = "Misplaced object end")
+ String writerMisplacedObjectEnd();
+
+ @Message(id = 8026, value = "Null key")
+ String writerNullKey();
+
+ @Message(id = 8027, value = "Misplaced key")
+ String writerMisplacedKey();
+
+ @Message(id = 8028, value = "Misplaced object")
+ String writerMisplacedObject();
+
+ @Message(id = 8029, value = "Nesting error")
+ String writerNestingError();
+
+ @Message(id = 8030, value = "Nesting too deep")
+ String writerNestingTooDeep();
+
+}
12 years, 2 months
JBossWeb SVN: r2094 - in branches/7.2.x: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2012-10-02 08:04:41 -0400 (Tue, 02 Oct 2012)
New Revision: 2094
Modified:
branches/7.2.x/src/main/java/org/apache/catalina/core/StandardHostValve.java
branches/7.2.x/webapps/docs/changelog.xml
Log:
Port default error page (now clarified). Also port a minor additional patch.
Modified: branches/7.2.x/src/main/java/org/apache/catalina/core/StandardHostValve.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/catalina/core/StandardHostValve.java 2012-10-01 16:46:15 UTC (rev 2093)
+++ branches/7.2.x/src/main/java/org/apache/catalina/core/StandardHostValve.java 2012-10-02 12:04:41 UTC (rev 2094)
@@ -419,6 +419,10 @@
return;
ErrorPage errorPage = context.findErrorPage(statusCode);
+ if (errorPage == null) {
+ // Look for a default error page
+ errorPage = context.findErrorPage(0);
+ }
if (errorPage != null) {
response.setAppCommitted(false);
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,
@@ -509,6 +513,7 @@
// Reset the response (keeping the real error code and message)
response.resetBuffer(true);
+ response.setContentLength(-1);
// Forward control to the specified location
ServletContext servletContext =
Modified: branches/7.2.x/webapps/docs/changelog.xml
===================================================================
--- branches/7.2.x/webapps/docs/changelog.xml 2012-10-01 16:46:15 UTC (rev 2093)
+++ branches/7.2.x/webapps/docs/changelog.xml 2012-10-02 12:04:41 UTC (rev 2094)
@@ -46,6 +46,9 @@
<fix>
<bug>53801</bug>: Fix some edge case with overlapping security constraints. (markt)
</fix>
+ <fix>
+ Add default error pages which got clarified. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
12 years, 2 months
JBossWeb SVN: r2093 - in branches/7.2.x/src/main/java/org: apache/el/parser and 13 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2012-10-01 12:46:15 -0400 (Mon, 01 Oct 2012)
New Revision: 2093
Modified:
branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java
branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java
branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java
branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java
branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java
branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java
branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java
branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java
branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java
branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java
branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java
branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java
branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java
Log:
Visual inspection of the Jasper and util (part 1) classes for i18n
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/ExpressionBuilder.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -241,8 +241,7 @@
return new MethodExpressionLiteral(expression, expectedReturnType,
expectedParamTypes);
} else {
- throw new ELException("Not a Valid Method Expression: "
- + expression);
+ throw new ELException(MESSAGES.invalidMethodExpression(expression));
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperFactory.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.lang.reflect.Method;
import javax.el.FunctionMapper;
@@ -32,7 +34,7 @@
public FunctionMapperFactory(FunctionMapper mapper) {
if (mapper == null) {
- throw new NullPointerException("FunctionMapper target cannot be null");
+ throw MESSAGES.invalidNullFunctionMapper();
}
this.target = mapper;
}
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/FunctionMapperImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
@@ -102,10 +104,10 @@
*/
public Function(String prefix, String localName, Method m) {
if (localName == null) {
- throw new NullPointerException("LocalName cannot be null");
+ throw MESSAGES.invalidNullLocalName();
}
if (m == null) {
- throw new NullPointerException("Method cannot be null");
+ throw MESSAGES.invalidNullMethod();
}
this.prefix = prefix;
this.localName = localName;
Modified: branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/lang/VariableMapperFactory.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.el.lang;
+import static org.jboss.web.ELMessages.MESSAGES;
+
import javax.el.ValueExpression;
import javax.el.VariableMapper;
@@ -27,7 +29,7 @@
public VariableMapperFactory(VariableMapper target) {
if (target == null) {
- throw new NullPointerException("Target VariableMapper cannot be null");
+ throw MESSAGES.invalidNullVariableMapper();
}
this.target = target;
}
@@ -50,6 +52,6 @@
@Override
public ValueExpression setVariable(String variable, ValueExpression expression) {
- throw new UnsupportedOperationException("Cannot Set Variables on Factory");
+ throw MESSAGES.cannotSetVariablesOnFactory();
}
}
Modified: branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/el/parser/AstIdentifier.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -176,14 +176,9 @@
if (obj instanceof MethodExpression) {
return (MethodExpression) obj;
} else if (obj == null) {
- throw new MethodNotFoundException("Identity '" + this.image
- + "' was null and was unable to invoke");
+ throw new MethodNotFoundException(MESSAGES.invalidNullIdentity(this.image));
} else {
- throw new ELException(
- "Identity '"
- + this.image
- + "' does not reference a MethodExpression instance, returned type: "
- + obj.getClass().getName());
+ throw new ELException(MESSAGES.invalidIdentityHasWrongType(this.image, obj.getClass().getName()));
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/Compiler.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -35,6 +35,7 @@
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.Options;
import org.apache.jasper.servlet.JspServletWrapper;
+import org.jboss.web.JasperLogger;
/**
* Main JSP compiler class. This class uses Ant for compiling.
@@ -48,9 +49,6 @@
*/
public abstract class Compiler {
- protected org.jboss.logging.Logger log = org.jboss.logging.Logger
- .getLogger(Compiler.class);
-
// ----------------------------------------------------- Instance Variables
protected JspCompilationContext ctxt;
@@ -102,7 +100,7 @@
t1 = t2 = t3 = t4 = 0;
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
@@ -212,7 +210,7 @@
// directives we validated in pass 1
Validator.validateExDirectives(this, pageNodes);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t2 = System.currentTimeMillis();
}
@@ -224,7 +222,7 @@
tfp = new TagFileProcessor();
tfp.loadTagFiles(this, pageNodes);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t3 = System.currentTimeMillis();
}
@@ -252,9 +250,9 @@
// to be GC'd and save memory.
ctxt.setWriter(null);
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t4 = System.currentTimeMillis();
- log.debug("Generated " + javaFileName + " total=" + (t4 - t1)
+ JasperLogger.COMPILER_LOGGER.debug("Generated " + javaFileName + " total=" + (t4 - t1)
+ " generate=" + (t4 - t3) + " validate=" + (t2 - t1));
}
@@ -468,8 +466,8 @@
jsw.setServletClassLastModifiedTime(targetLastModified);
}
if (targetLastModified < jspRealLastModified) {
- if (log.isDebugEnabled()) {
- log.debug("Compiler: outdated: " + targetFile + " "
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
+ JasperLogger.COMPILER_LOGGER.debug("Compiler: outdated: " + targetFile + " "
+ targetLastModified);
}
return true;
@@ -543,8 +541,8 @@
String classFileName = ctxt.getClassFileName();
if (classFileName != null) {
File classFile = new File(classFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + classFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " + classFile);
classFile.delete();
}
} catch (Exception e) {
@@ -554,8 +552,8 @@
String javaFileName = ctxt.getServletJavaFileName();
if (javaFileName != null) {
File javaFile = new File(javaFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + javaFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " + javaFile);
javaFile.delete();
}
} catch (Exception e) {
@@ -568,8 +566,8 @@
String classFileName = ctxt.getClassFileName();
if (classFileName != null) {
File classFile = new File(classFileName);
- if (log.isDebugEnabled())
- log.debug("Deleting " + classFile);
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled())
+ JasperLogger.COMPILER_LOGGER.debug("Deleting " + classFile);
classFile.delete();
}
} catch (Exception e) {
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/DefaultErrorHandler.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -81,7 +81,7 @@
buf.append(details[i].getErrorMessage());
}
}
- buf.append("\n\nStacktrace:");
+ buf.append("\n\n").append(MESSAGES.stacktrace());
throw new JasperException(MESSAGES.failedClassCompilation(buf.toString()));
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -49,6 +49,7 @@
import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
+import org.jboss.web.JasperLogger;
/**
* JDT class compiler. This compiler will load source dependencies from the
@@ -68,7 +69,7 @@
throws FileNotFoundException, JasperException, Exception {
long t1 = 0;
- if (log.isDebugEnabled()) {
+ if (JasperLogger.COMPILER_LOGGER.isDebugEnabled()) {
t1 = System.currentTimeMillis();
}
@@ -116,7 +117,7 @@
buf.getChars(0, result.length, result, 0);
}
} catch (IOException e) {
- log.error("Compilation error", e);
+ JasperLogger.COMPILER_LOGGER.errorReadingSourceFile(sourceFile, e);
} finally {
if (reader != null) {
try {
@@ -217,9 +218,9 @@
new NameEnvironmentAnswer(classFileReader, null);
}
} catch (IOException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorReadingClassFile(className, exc);
} catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorReadingClassFile(className, exc);
} finally {
if (is != null) {
try {
@@ -314,7 +315,7 @@
settings.put(CompilerOptions.OPTION_Source,
CompilerOptions.VERSION_1_7);
} else {
- log.warn("Unknown source VM " + opt + " ignored.");
+ JasperLogger.COMPILER_LOGGER.unknownSourceJvm(opt);
settings.put(CompilerOptions.OPTION_Source,
CompilerOptions.VERSION_1_5);
}
@@ -355,7 +356,7 @@
settings.put(CompilerOptions.OPTION_Compliance,
CompilerOptions.VERSION_1_7);
} else {
- log.warn("Unknown target VM " + opt + " ignored.");
+ JasperLogger.COMPILER_LOGGER.unknownTargetJvm(opt);
settings.put(CompilerOptions.OPTION_TargetPlatform,
CompilerOptions.VERSION_1_5);
}
@@ -385,7 +386,7 @@
(name, pageNodes, new StringBuilder(problem.getMessage()),
problem.getSourceLineNumber(), ctxt));
} catch (JasperException e) {
- log.error("Error visiting node", e);
+ JasperLogger.COMPILER_LOGGER.errorCreatingCompilerReport(e);
}
}
}
@@ -416,7 +417,7 @@
}
}
} catch (IOException exc) {
- log.error("Compilation error", exc);
+ JasperLogger.COMPILER_LOGGER.errorCompiling(exc);
}
}
};
@@ -446,9 +447,9 @@
errDispatcher.javacError(jeds);
}
- if( log.isDebugEnabled() ) {
+ if( JasperLogger.COMPILER_LOGGER.isDebugEnabled() ) {
long t2=System.currentTimeMillis();
- log.debug("Compiled " + ctxt.getServletJavaFileName() + " "
+ JasperLogger.COMPILER_LOGGER.debug("Compiled " + ctxt.getServletJavaFileName() + " "
+ (t2-t1) + "ms");
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/JspRuntimeContext.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.compiler;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilePermission;
@@ -284,8 +286,7 @@
} catch (FileNotFoundException ex) {
ctxt.incrementRemoved();
} catch (Throwable t) {
- jsw.getServletContext().log("Background compile failed",
- t);
+ jsw.getServletContext().log(MESSAGES.backgroundCompilationFailed(), t);
}
}
}
@@ -422,7 +423,7 @@
new FilePermission(jndiUrl,"read") );
}
} catch(Exception e) {
- context.log("Security Init for context failed",e);
+ context.log(MESSAGES.errorInitializingSecurity(), e);
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/Parser.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -254,7 +254,7 @@
quote, isElIgnored,
pageInfo.isDeferredSyntaxAllowedAsLiteral());
} catch (IllegalArgumentException iae) {
- err.jspError(start, iae.getMessage());
+ err.jspError(start, MESSAGES.errorUnquotingAttributeValue(), iae);
}
if (watch.length() == 1) // quote
return ret;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapStratum.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.compiler;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.List;
import java.util.ArrayList;
@@ -47,14 +49,14 @@
/** Sets InputStartLine. */
public void setInputStartLine(int inputStartLine) {
if (inputStartLine < 0)
- throw new IllegalArgumentException("" + inputStartLine);
+ throw MESSAGES.invalidNegativeSmapPosition(inputStartLine);
this.inputStartLine = inputStartLine;
}
/** Sets OutputStartLine. */
public void setOutputStartLine(int outputStartLine) {
if (outputStartLine < 0)
- throw new IllegalArgumentException("" + outputStartLine);
+ throw MESSAGES.invalidNegativeSmapPosition(outputStartLine);
this.outputStartLine = outputStartLine;
}
@@ -66,7 +68,7 @@
*/
public void setLineFileID(int lineFileID) {
if (lineFileID < 0)
- throw new IllegalArgumentException("" + lineFileID);
+ throw MESSAGES.invalidNegativeSmapPosition(lineFileID);
this.lineFileID = lineFileID;
this.lineFileIDSet = true;
}
@@ -74,14 +76,14 @@
/** Sets InputLineCount. */
public void setInputLineCount(int inputLineCount) {
if (inputLineCount < 0)
- throw new IllegalArgumentException("" + inputLineCount);
+ throw MESSAGES.invalidNegativeSmapPosition(inputLineCount);
this.inputLineCount = inputLineCount;
}
/** Sets OutputLineIncrement. */
public void setOutputLineIncrement(int outputLineIncrement) {
if (outputLineIncrement < 0)
- throw new IllegalArgumentException("" + outputLineIncrement);
+ throw MESSAGES.invalidNegativeSmapPosition(outputLineIncrement);
this.outputLineIncrement = outputLineIncrement;
}
@@ -92,7 +94,7 @@
*/
public String getString() {
if (inputStartLine == -1 || outputStartLine == -1)
- throw new IllegalStateException();
+ throw MESSAGES.undefinedPosition();
StringBuilder out = new StringBuilder();
out.append(inputStartLine);
if (lineFileIDSet)
@@ -251,8 +253,7 @@
// check the input - what are you doing here??
int fileIndex = filePathList.indexOf(inputFileName);
if (fileIndex == -1) // still
- throw new IllegalArgumentException(
- "inputFileName: " + inputFileName);
+ throw MESSAGES.unknownFileName(inputFileName);
//Jasper incorrectly SMAPs certain Nodes, giving them an
//outputStartLine of 0. This can cause a fatal error in
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/SmapUtil.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -44,9 +44,6 @@
*/
public class SmapUtil {
- private org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( SmapUtil.class );
-
//*********************************************************************
// Constants
Modified: branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -123,15 +123,15 @@
private Vector variableVector;
- private static final String ATTR_NAME = "the name attribute of the attribute directive";
+ private static final String ATTR_NAME = MESSAGES.tagFileProcessorAttrName();
- private static final String VAR_NAME_GIVEN = "the name-given attribute of the variable directive";
+ private static final String VAR_NAME_GIVEN = MESSAGES.tagFileProcessorVarNameGiven();
- private static final String VAR_NAME_FROM = "the name-from-attribute attribute of the variable directive";
+ private static final String VAR_NAME_FROM = MESSAGES.tagFileProcessorVarNameFrom();
- private static final String VAR_ALIAS = "the alias attribute of the variable directive";
+ private static final String VAR_ALIAS = MESSAGES.tagFileProcessorVarAlias();
- private static final String TAG_DYNAMIC = "the dynamic-attributes attribute of the tag directive";
+ private static final String TAG_DYNAMIC = MESSAGES.tagFileProcessorTagDynamic();
private HashMap nameTable = new HashMap();
Modified: branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/el/ELResolverImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.el;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.Iterator;
import javax.el.ArrayELResolver;
@@ -59,7 +61,7 @@
public Object getValue(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
@@ -69,7 +71,8 @@
return this.variableResolver.resolveVariable(property
.toString());
} catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
+ throw new ELException(MESSAGES.errorResolvingVariable
+ (property.toString(), e.getMessage()), e.getCause());
}
}
}
@@ -83,7 +86,7 @@
public Class<?> getType(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
@@ -94,7 +97,8 @@
.toString());
return (obj != null) ? obj.getClass() : null;
} catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
+ throw new ELException(MESSAGES.errorResolvingVariable
+ (property.toString(), e.getMessage()), e.getCause());
}
}
}
@@ -110,13 +114,12 @@
PropertyNotFoundException, PropertyNotWritableException,
ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
context.setPropertyResolved(true);
- throw new PropertyNotWritableException(
- "Legacy VariableResolver wrapped, not writable");
+ throw new PropertyNotWritableException(MESSAGES.legacyVariableResolver());
}
if (!context.isPropertyResolved()) {
@@ -127,7 +130,7 @@
public boolean isReadOnly(ELContext context, Object base, Object property)
throws NullPointerException, PropertyNotFoundException, ELException {
if (context == null) {
- throw new NullPointerException();
+ throw MESSAGES.elResolverNullContext();
}
if (base == null) {
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/BodyContentImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.CharArrayReader;
import java.io.IOException;
import java.io.Reader;
@@ -310,7 +312,7 @@
private void ensureOpen() throws IOException {
if (closed) {
- throw new IOException("Stream closed");
+ throw new IOException(MESSAGES.streamClosed());
}
else {
return;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/CharBuffer.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
@@ -111,13 +113,13 @@
return;
}
if (text == null) {
- throw new IllegalArgumentException("text: may not be null.");
+ throw MESSAGES.nullCharBufferTextArgument();
}
if (start > text.length()) {
- throw new IllegalArgumentException("start: points beyond end of text.");
+ throw MESSAGES.invalidCharBufferStartPosition();
}
if ((start + length) > text.length()) {
- throw new IllegalArgumentException("length: specifies length in excess of text length.");
+ throw MESSAGES.invalidCharBufferLength();
}
//If length of string to add is greater than will fit in current char array then add what will fit
@@ -161,13 +163,13 @@
return;
}
if (characters == null) {
- throw new IllegalArgumentException("characters: may not be null.");
+ throw MESSAGES.nullCharBufferCharactersArgument();
}
if (start > characters.length) {
- throw new IllegalArgumentException("start: points beyond end of array.");
+ throw MESSAGES.invalidCharBufferStartPosition();
}
if ((start + length) > characters.length) {
- throw new IllegalArgumentException("length: specifies length in excess of array length.");
+ throw MESSAGES.invalidCharBufferLength();
}
//If length of string to add is greater than will fit in current char array then add what will fit
@@ -263,7 +265,7 @@
*/
public void writeOut(Writer writer) throws IOException, IllegalArgumentException {
if (writer == null) {
- throw new IllegalArgumentException("writer: may not be null.");
+ throw MESSAGES.nullCharBufferWriterArgument();
}
for (Iterator iter = this.bufList.iterator(); iter.hasNext();) {
char[] curBuf = (char[]) iter.next();
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/InstanceManagerFactory.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -20,6 +20,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import javax.servlet.ServletConfig;
import org.apache.tomcat.InstanceManager;
@@ -36,7 +38,7 @@
InstanceManager instanceManager =
(InstanceManager) config.getServletContext().getAttribute(InstanceManager.class.getName());
if (instanceManager == null) {
- throw new IllegalStateException("No org.apache.tomcat.InstanceManager set in ServletContext");
+ throw MESSAGES.noInstanceManager();
}
return instanceManager;
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -67,14 +69,14 @@
public void addELContextListener(ELContextListener listener) {
if (listener == null) {
- throw new IllegalArgumentException("ELConextListener was null");
+ throw MESSAGES.nullElContextListener();
}
this.contextListeners.add(listener);
}
public static JspApplicationContextImpl getInstance(ServletContext context) {
if (context == null) {
- throw new IllegalArgumentException("ServletContext was null");
+ throw MESSAGES.nullServletContext();
}
JspApplicationContextImpl impl = (JspApplicationContextImpl) context
.getAttribute(KEY);
@@ -87,7 +89,7 @@
public ELContextImpl createELContext(JspContext context) {
if (context == null) {
- throw new IllegalArgumentException("JspContext was null");
+ throw MESSAGES.nullJspContext();
}
// create ELContext for JspContext
@@ -135,11 +137,10 @@
public void addELResolver(ELResolver resolver) throws IllegalStateException {
if (resolver == null) {
- throw new IllegalArgumentException("ELResolver was null");
+ throw MESSAGES.nullElResolver();
}
if (this.instantiated) {
- throw new IllegalStateException(
- "cannot call addELResolver after the first request has been made");
+ throw MESSAGES.cannotAddElResolver();
}
this.resolvers.add(resolver);
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -30,6 +30,7 @@
import org.apache.jasper.Constants;
import org.jboss.logging.Logger;
+import org.jboss.web.JasperLogger;
/**
* Implementation of JspFactory.
@@ -38,9 +39,6 @@
*/
public class JspFactoryImpl extends JspFactory {
- // Logger
- private Logger log = Logger.getLogger(JspFactoryImpl.class);
-
private static final String SPEC_VERSION = "2.2";
private static final boolean USE_POOL =
Boolean.valueOf(System.getProperty("org.apache.jasper.runtime.JspFactoryImpl.USE_POOL", "true")).booleanValue();
@@ -108,7 +106,7 @@
return pc;
} catch (Throwable ex) {
/* FIXME: need to do something reasonable here!! */
- log.fatal("Exception initializing page context", ex);
+ JasperLogger.ROOT_LOGGER.errorInitializingPageContext(ex);
return null;
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/JspWriterImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -79,7 +79,7 @@
boolean autoFlush) {
super(sz, autoFlush);
if (sz < 0)
- throw new IllegalArgumentException("Buffer size <= 0");
+ throw MESSAGES.invalidNegativeBufferSize();
this.response = response;
cb = sz == 0 ? null : new char[sz];
nextChar = 0;
@@ -187,7 +187,7 @@
/** check to make sure that the stream has not been closed */
private void ensureOpen() throws IOException {
if (response == null || closed)
- throw new IOException("Stream closed");
+ throw new IOException(MESSAGES.streamClosed());
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/PageContextImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -146,8 +146,7 @@
if (request instanceof HttpServletRequest && needsSession)
this.session = ((HttpServletRequest) request).getSession();
if (needsSession && session == null)
- throw new IllegalStateException(
- "Page needs a session and none is available");
+ throw MESSAGES.pageNeedsSession();
// initialize the initial out ...
depth = -1;
@@ -753,7 +752,7 @@
public void handlePageException(final Throwable t) throws IOException,
ServletException {
if (t == null)
- throw new NullPointerException("null Throwable");
+ throw MESSAGES.nullThrowable();
if (SecurityUtil.isPackageProtectionEnabled()) {
try {
Modified: branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/runtime/ProtectedFunctionMapper.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.jasper.runtime;
+import static org.jboss.web.JasperMessages.MESSAGES;
+
import java.util.HashMap;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -105,17 +107,13 @@
}
});
} catch (PrivilegedActionException ex) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + ex.getException().getMessage());
+ throw MESSAGES.invalidFunctionMapping(ex.getException().getMessage());
}
} else {
try {
method = c.getDeclaredMethod(methodName, args);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + e.getMessage());
+ throw MESSAGES.invalidFunctionMapping(e.getMessage());
}
}
@@ -159,18 +157,14 @@
}
});
} catch (PrivilegedActionException ex) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + ex.getException().getMessage());
+ throw MESSAGES.invalidFunctionMapping(ex.getException().getMessage());
}
} else {
funcMapper = new ProtectedFunctionMapper();
try {
method = c.getDeclaredMethod(methodName, args);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(
- "Invalid function mapping - no such method: "
- + e.getMessage());
+ throw MESSAGES.invalidFunctionMapping(e.getMessage());
}
}
funcMapper.theMethod = method;
Modified: branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/security/SecurityClassLoad.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -18,6 +18,8 @@
package org.apache.jasper.security;
+import org.jboss.web.JasperLogger;
+
/**
* Static class used to preload java classes when using the
* Java SecurityManager so that the defineClassInPackage
@@ -28,9 +30,6 @@
public final class SecurityClassLoad {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( SecurityClassLoad.class );
-
public static void securityClassLoad(ClassLoader loader){
if( System.getSecurityManager() == null ){
@@ -108,7 +107,7 @@
loader.loadClass( basePackage +
"runtime.JspWriterImpl$1");
} catch (ClassNotFoundException ex) {
- log.error("SecurityClassLoad", ex);
+ JasperLogger.ROOT_LOGGER.errorLoadingCoreClass(ex);
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/servlet/JspServlet.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -190,9 +190,7 @@
// precompilation request can be ignored.
return (true); // ?jsp_precompile=false
} else {
- throw new ServletException("Cannot have request parameter " +
- Constants.PRECOMPILE + " set to " +
- value);
+ throw new ServletException(MESSAGES.invalidRequestParameterValue(Constants.PRECOMPILE, value));
}
}
Modified: branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/jasper/xmlparser/XMLEncodingDetector.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -1549,7 +1549,7 @@
char c1 = Character.toLowerCase(target.charAt(1));
char c2 = Character.toLowerCase(target.charAt(2));
if (c0 == 'x' && c1 == 'm' && c2 == 'l') {
- err.jspError("jsp.error.xml.reservedPITarget");
+ err.jspError(MESSAGES.reservedPiTarget());
}
}
@@ -1562,7 +1562,7 @@
}
else {
// if there is data there should be some space
- err.jspError("jsp.error.xml.spaceRequiredInPI");
+ err.jspError(MESSAGES.requiredWhiteSpaceAfterPiTarget());
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/BayeuxServlet.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import javax.servlet.ServletContext;
@@ -29,9 +31,9 @@
import org.apache.tomcat.util.json.JSONArray;
import org.apache.tomcat.util.json.JSONException;
import org.apache.tomcat.util.json.JSONObject;
-import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
import org.jboss.servlet.http.HttpEventServlet;
+import org.jboss.web.CoyoteLogger;
/**
*
@@ -42,9 +44,6 @@
public class BayeuxServlet extends HttpServlet implements HttpEventServlet {
- private static Logger log = Logger.getLogger(BayeuxServlet.class);
-
-
/**
* The timeout.
*/
@@ -96,8 +95,8 @@
public void event(HttpEvent cometEvent) throws IOException, ServletException {
HttpEvent.EventType type = cometEvent.getType();
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Received Comet Event type="+type);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Received Comet Event type="+type);
}
switch (type) {
case BEGIN:
@@ -140,14 +139,14 @@
} else { // GET method or application/x-www-form-urlencoded
String message = cometEvent.getHttpServletRequest().getParameter(
Bayeux.MESSAGE_PARAMETER);
- if (log.isTraceEnabled()) {
- log.trace("[" + Thread.currentThread().getName()
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("[" + Thread.currentThread().getName()
+ "] Received JSON message:" + message);
}
try {
int action = handleBayeux(message, cometEvent);
- if (log.isTraceEnabled()) {
- log.trace("[" + Thread.currentThread().getName()
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("[" + Thread.currentThread().getName()
+ "] Bayeux handling complete, action result="
+ action);
}
@@ -156,7 +155,7 @@
}
} catch (Exception e) {
tb.remove(cometEvent);
- log.warn("Exception in check", e);
+ CoyoteLogger.BAYEUX_LOGGER.errorInCheckBayeux(e);
cometEvent.close();
}
}
@@ -172,37 +171,37 @@
for (int i = 0; i < jsArray.length(); i++) {
JSONObject msg = jsArray.getJSONObject(i);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Processing bayeux message:"+msg);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Processing bayeux message:"+msg);
}
request = RequestFactory.getRequest(tb,event,msg);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Processing bayeux message using request:"+request);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Processing bayeux message using request:"+request);
}
result = request.process(result);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Processing bayeux message result:"+result);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Processing bayeux message result:"+result);
}
}
if (result>0 && request!=null) {
event.getHttpServletRequest().setAttribute(BayeuxRequest.LAST_REQ_ATTR, request);
ClientImpl ci = (ClientImpl)tb.getClient(((RequestBase)request).getClientId());
ci.addCometEvent(event);
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Done bayeux message added to request attribute");
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Done bayeux message added to request attribute");
}
} else if (result == 0 && request!=null) {
RequestBase.deliver(event,(ClientImpl)tb.getClient(((RequestBase)request).getClientId()));
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Done bayeux message, delivered to client");
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Done bayeux message, delivered to client");
}
}
}catch (JSONException e) {
- log.warn("Error", e);// FIXME impl error handling
+ CoyoteLogger.BAYEUX_LOGGER.errorProcessingBayeux(e);
result = -1;
}catch (BayeuxException e) {
- log.warn("Error", e); // FIXME impl error handling
+ CoyoteLogger.BAYEUX_LOGGER.errorProcessingBayeux(e);
result = -1;
}
return result;
@@ -231,9 +230,9 @@
public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
if (servletResponse instanceof HttpServletResponse) {
- ( (HttpServletResponse) servletResponse).sendError(500, "Misconfigured Tomcat server, must be configured to support Comet operations.");
+ ( (HttpServletResponse) servletResponse).sendError(500, MESSAGES.invalidBayeuxConfiguration());
} else {
- throw new ServletException("Misconfigured Tomcat server, must be configured to support Comet operations for the Bayeux protocol.");
+ throw new ServletException(MESSAGES.invalidBayeuxConfiguration());
}
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ChannelImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
@@ -79,7 +81,7 @@
*/
public boolean matches(String pattern) {
if (pattern == null)
- throw new NullPointerException("Channel pattern must not be null.");
+ throw MESSAGES.invalidNullChannelPattern();
if (getId().equals(pattern))
return true;
int wildcardPos = pattern.indexOf("/*");
@@ -125,8 +127,7 @@
Message data = msgs[i];
if (!(data instanceof MessageImpl))
- throw new IllegalArgumentException("Invalid message class, you can only publish messages "+
- "created through the Bayeux.newMessage() method");
+ throw MESSAGES.invalidMessagePublish();
/*if (log.isDebugEnabled()) {
log.debug("Publishing message:"+data+" to channel:"+this);
}*/
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/ClientImpl.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -31,13 +31,11 @@
import org.apache.cometd.bayeux.Listener;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONObject;
-import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
+import org.jboss.web.CoyoteLogger;
public class ClientImpl implements Client {
- private static Logger log = Logger.getLogger(ClientImpl.class);
-
public static final int SUPPORT_CALLBACK_POLL = 0x1;
public static final int SUPPORT_LONG_POLL = 0x2;
@@ -139,8 +137,8 @@
map.put(Bayeux.CHANNEL_FIELD,message.getChannel().getId());
map.put(Bayeux.DATA_FIELD,message);
JSONObject json = new JSONObject(map);
- if (log.isTraceEnabled()) {
- log.trace("Message instantly delivered to remote client["+this+"] message:"+json);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("Message instantly delivered to remote client["+this+"] message:"+json);
}
rq.addToDeliveryQueue(this, json);
//deliver the batch
@@ -152,13 +150,13 @@
delivered = true;
} catch (Exception e) {
// TODO: fix
- log.warn("Exception", e);
+ CoyoteLogger.BAYEUX_LOGGER.errorDeliveringBayeux(e);
}
}
}
if (!delivered) {
- if (log.isTraceEnabled()) {
- log.trace("Message added to queue for remote client["+this+"] message:"+message);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("Message added to queue for remote client["+this+"] message:"+message);
}
//queue the message for the next round
messages.add(message);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
@@ -36,6 +38,7 @@
import org.apache.tomcat.util.json.JSONObject;
import org.jboss.logging.Logger;
import org.jboss.servlet.http.HttpEvent;
+import org.jboss.web.CoyoteLogger;
/**
* Common functionality and member variables for all Bayeux requests.
@@ -47,8 +50,6 @@
*/
public abstract class RequestBase implements BayeuxRequest {
- private static Logger log = Logger.getLogger(RequestBase.class);
-
protected static final SimpleDateFormat timestampFmt =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
static {
@@ -155,10 +156,10 @@
protected static void deliver(HttpEvent event, ClientImpl to) throws IOException, ServletException, BayeuxException {
JSONArray jarray = getJSONArray(event,true);
- if ( jarray == null ) throw new BayeuxException("No message to send!");
+ if ( jarray == null ) throw new BayeuxException(MESSAGES.noBayeuxMessage());
String jsonstring = jarray.toString();
- if (log.isTraceEnabled()) {
- log.trace("["+Thread.currentThread().getName()+"] Delivering message to[" + to + "] message:" + jsonstring);
+ if (CoyoteLogger.BAYEUX_LOGGER.isTraceEnabled()) {
+ CoyoteLogger.BAYEUX_LOGGER.trace("["+Thread.currentThread().getName()+"] Delivering message to[" + to + "] message:" + jsonstring);
}
if (to!=null) {
@@ -182,7 +183,7 @@
out.print(jsonp);
out.print('(');
} else {
- throw new BayeuxException("Client doesn't support any appropriate connection type.");
+ throw new BayeuxException(MESSAGES.noBayeuxConnectionType());
}
out.print(jsonstring);
if ( to == null ) {
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/UUIDGenerator.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -15,6 +15,8 @@
*/
package org.apache.tomcat.bayeux;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.security.SecureRandom;
import java.util.Random;
@@ -43,7 +45,7 @@
public static byte[] randomUUID(boolean secure, byte[] into, int offset) {
if ( (offset+UUID_LENGTH)>into.length )
- throw new ArrayIndexOutOfBoundsException("Unable to fit "+UUID_LENGTH+" bytes into the array. length:"+into.length+" required length:"+(offset+UUID_LENGTH));
+ throw MESSAGES.errorGeneratingUuid(UUID_LENGTH, into.length, offset + UUID_LENGTH);
Random r = (secure&&(secrand!=null))?secrand:rand;
nextBytes(into,offset,UUID_LENGTH,r);
into[6+offset] &= 0x0F;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaConnectRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -70,9 +72,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (! (Bayeux.TRANSPORT_LONG_POLL.equals(conType) || Bayeux.TRANSPORT_CALLBACK_POLL.equals(conType)))
- return new HttpError(400,"Unsupported connection type.",null);
+ return new HttpError(400, MESSAGES.noBayeuxConnectionType(), null);
return null;//no error
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaDisconnectRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -66,7 +68,7 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
// if (! (Bayeux.TRANSPORT_LONG_POLL.equals(conType) || Bayeux.TRANSPORT_CALLBACK_POLL.equals(conType)))
// return new HttpError(400,"Unsupported connection type.",null);
return null;//no error
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaHandshakeRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -74,7 +76,7 @@
public HttpError validate() {
boolean error = (version==null || version.length()==0);
if (!error) error = suppConnTypesFlag==0;
- if (error) return new HttpError(400,"Invalid handshake request, supportedConnectionType field missing.",null);
+ if (error) return new HttpError(400, MESSAGES.invalidBayeuxHandshake(),null);
else return null;
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaSubscribeRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -71,9 +73,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (subscription==null||subscription.length()==0)
- return new HttpError(400,"Subscription missing.",null);
+ return new HttpError(400, MESSAGES.noBayeuxSubscription(), null);
return null;//no error
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/MetaUnsubscribeRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
@@ -72,9 +74,9 @@
*/
public HttpError validate() {
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if (subscription==null||subscription.length()==0)
- return new HttpError(400,"Subscription missing.",null);
+ return new HttpError(400, MESSAGES.noBayeuxSubscription(), null);
return null;//no error
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/request/PublishRequest.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -16,6 +16,8 @@
*/
package org.apache.tomcat.bayeux.request;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.util.HashMap;
@@ -69,16 +71,16 @@
*/
public HttpError validate() {
if(channel==null|| (!this.getTomcatBayeux().hasChannel(channel)))
- return new HttpError(400,"Channel Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
if(data==null || data.length()==0)
- return new HttpError(400,"Message data missing.", null);
+ return new HttpError(400, MESSAGES.noBayeuxMessageData(), null);
try {
this.msgData = new JSONObject(data);
}catch (JSONException x) {
- return new HttpError(400,"Invalid JSON object in data attribute.",x);
+ return new HttpError(400, MESSAGES.invalidBayeuxMessageData(), x);
}
if(clientId==null|| (!this.getTomcatBayeux().hasClient(clientId)))
- return new HttpError(400,"Client Id not valid.", null);
+ return new HttpError(400, MESSAGES.invalidBayeuxClientId(), null);
return null;//no error
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/jni/Library.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.jni;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
/** Library
*
* @author Mladen Turk
@@ -61,7 +63,7 @@
for (int j=0; j<paths.length; j++) {
java.io.File fd = new java.io.File(paths[j] + System.getProperty("file.separator") + name);
if (fd.exists()) {
- err += "(Error on: " + paths[j] + System.getProperty("file.separator") + name +")";
+ err += MESSAGES.aprError() + paths[j] + System.getProperty("file.separator") + name +")";
}
}
err += e.getMessage();
@@ -217,11 +219,10 @@
APR_TCP_NODELAY_INHERITED = has(19);
APR_O_NONBLOCK_INHERITED = has(20);
if (APR_MAJOR_VERSION < 1) {
- throw new UnsatisfiedLinkError("Unsupported APR Version (" +
- aprVersionString() + ")");
+ throw MESSAGES.unsupportedAprVersion(aprVersionString());
}
if (!APR_HAS_THREADS) {
- throw new UnsatisfiedLinkError("Missing APR_HAS_THREADS");
+ throw MESSAGES.missingAprThreadsSupport();
}
}
return initialize();
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/DomUtil.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -31,6 +31,7 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.jboss.web.CoyoteLogger;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -45,8 +46,6 @@
* @author Costin Manolache
*/
public class DomUtil {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( DomUtil.class );
// -------------------- DOM utils --------------------
@@ -73,7 +72,6 @@
for (Node node = first; node != null;
node = node.getNextSibling()) {
- //System.out.println("getNode: " + name + " " + node.getNodeName());
if( node.getNodeType()!=Node.ELEMENT_NODE)
continue;
if( name != null &&
@@ -207,8 +205,8 @@
String systemId)
throws SAXException, IOException
{
- if( log.isTraceEnabled())
- log.trace("ResolveEntity: " + publicId + " " + systemId);
+ if( CoyoteLogger.UTIL_LOGGER.isTraceEnabled())
+ CoyoteLogger.UTIL_LOGGER.trace("ResolveEntity: " + publicId + " " + systemId);
return new InputSource(new StringReader(""));
}
}
@@ -223,8 +221,8 @@
String name=n.getNodeName();
String value=n.getNodeValue();
- if( log.isTraceEnabled() )
- log.trace("Attribute " + parent.getNodeName() + " " +
+ if( CoyoteLogger.UTIL_LOGGER.isTraceEnabled() )
+ CoyoteLogger.UTIL_LOGGER.trace("Attribute " + parent.getNodeName() + " " +
name + "=" + value);
try {
IntrospectionUtils.setProperty(o, name, value);
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/IntrospectionUtils.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -22,6 +22,8 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import org.jboss.web.CoyoteLogger;
+
// Depends: JDK1.1
/**
@@ -31,9 +33,6 @@
public final class IntrospectionUtils {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( IntrospectionUtils.class );
-
/**
* Find a method with the right name If found, call the method ( if param is
* int or boolean we'll convert value to the right type before) - that means
@@ -138,7 +137,7 @@
}
} catch (IllegalArgumentException ex2) {
- log.warn("IAE " + o + " " + name + " " + value, ex2);
+ CoyoteLogger.UTIL_LOGGER.errorSettingProperty(name, o, value, ex2);
} catch (SecurityException ex1) {
if (dbg > 0)
d("SecurityException for " + o.getClass() + " " + name + "="
@@ -192,7 +191,7 @@
}
} catch (IllegalArgumentException ex2) {
- log.warn("IAE " + o + " " + name, ex2);
+ CoyoteLogger.UTIL_LOGGER.errorGettingProperty(name, o, ex2);
} catch (SecurityException ex1) {
if (dbg > 0)
d("SecurityException for " + o.getClass() + " " + name + ")");
@@ -289,7 +288,7 @@
static final int dbg = 0;
static void d(String s) {
- if (log.isDebugEnabled())
- log.debug("IntrospectionUtils: " + s);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled())
+ CoyoteLogger.UTIL_LOGGER.debug("IntrospectionUtils: " + s);
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -33,9 +33,6 @@
*/
public class B2CConverter {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(B2CConverter.class);
-
protected CharsetDecoder decoder = null;
protected ByteBuffer bb = null;
protected CharBuffer cb = null;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/Base64.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -18,7 +18,9 @@
package org.apache.tomcat.util.buf;
+import org.jboss.web.CoyoteLogger;
+
/**
* This class provides encode/decode for RFC 2045 Base64 as
* defined by RFC 2045, N. Freed and N. Borenstein.
@@ -33,10 +35,6 @@
public final class Base64 {
-
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( Base64.class );
-
static private final int BASELENGTH = 255;
static private final int LOOKUPLENGTH = 63;
static private final int TWENTYFOURBITGROUP = 24;
@@ -250,8 +248,8 @@
if ( v >= 64 ) {
if( chars[i] != '=' )
- if (log.isDebugEnabled())
- log.debug("Wrong char in base64: " + chars[i]);
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled())
+ CoyoteLogger.UTIL_LOGGER.debug("Wrong char in base64: " + chars[i]);
} else {
acc= ( acc << 6 ) | v;
shift += 6;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/ByteChunk.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Serializable;
@@ -443,8 +445,7 @@
{
//assert out!=null
if( out==null ) {
- throw new IOException( "Buffer overflow, no sink " + limit + " " +
- buff.length );
+ throw new IOException(MESSAGES.bufferOverflow(buff.length, limit));
}
out.realWriteBytes( buff, start, end-start );
end=start;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/C2BConverter.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -33,9 +33,6 @@
*/
public class C2BConverter {
- protected static org.jboss.logging.Logger log =
- org.jboss.logging.Logger.getLogger(C2BConverter.class);
-
protected CharsetEncoder encoder = null;
protected ByteBuffer bb = null;
protected CharBuffer cb = null;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/CharChunk.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Serializable;
@@ -463,8 +465,7 @@
{
//assert out!=null
if( out==null ) {
- throw new IOException( "Buffer overflow, no sink " + limit + " " +
- buff.length );
+ throw new IOException(MESSAGES.bufferOverflow(buff.length, limit));
}
out.realWriteChars( buff, start, end - start );
end=start;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/StringCache.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -22,6 +22,8 @@
import java.util.Iterator;
import java.util.TreeMap;
+import org.jboss.web.CoyoteLogger;
+
/**
* This class implements a String cache for ByteChunk and CharChunk.
*
@@ -30,10 +32,6 @@
public class StringCache {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger( StringCache.class );
-
-
// ------------------------------------------------------- Static Variables
@@ -278,9 +276,9 @@
bcCount = 0;
bcStats.clear();
bcCache = tempbcCache;
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
long t2 = System.currentTimeMillis();
- log.debug("ByteCache generation time: " + (t2 - t1) + "ms");
+ CoyoteLogger.UTIL_LOGGER.debug("ByteCache generation time: " + (t2 - t1) + "ms");
}
} else {
bcCount++;
@@ -392,9 +390,9 @@
ccCount = 0;
ccStats.clear();
ccCache = tempccCache;
- if (log.isDebugEnabled()) {
+ if (CoyoteLogger.UTIL_LOGGER.isDebugEnabled()) {
long t2 = System.currentTimeMillis();
- log.debug("CharCache generation time: " + (t2 - t1) + "ms");
+ CoyoteLogger.UTIL_LOGGER.debug("CharCache generation time: " + (t2 - t1) + "ms");
}
} else {
ccCount++;
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/buf/UDecoder.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.buf;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.CharConversionException;
import java.io.IOException;
@@ -30,9 +32,6 @@
*/
public final class UDecoder {
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(UDecoder.class );
-
protected static final boolean ALLOW_ENCODED_SLASH =
Boolean.valueOf(System.getProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "false")).booleanValue();
@@ -80,17 +79,17 @@
} else {
// read next 2 digits
if( j+2 >= end ) {
- throw new CharConversionException("EOF");
+ throw new CharConversionException(MESSAGES.unexpectedEof());
}
byte b1= buff[j+1];
byte b2=buff[j+2];
if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
- throw new CharConversionException( "isHexDigit");
+ throw new CharConversionException(MESSAGES.invalidHex());
j+=2;
int res=x2c( b1, b2 );
if (noSlash && (res == '/')) {
- throw new CharConversionException( "noSlash");
+ throw new CharConversionException(MESSAGES.invalidSlash());
}
buff[idx]=(byte)res;
}
@@ -143,12 +142,12 @@
// read next 2 digits
if( j+2 >= cend ) {
// invalid
- throw new CharConversionException("EOF");
+ throw new CharConversionException(MESSAGES.unexpectedEof());
}
char b1= buff[j+1];
char b2=buff[j+2];
if( !isHexDigit( b1 ) || ! isHexDigit(b2 ))
- throw new CharConversionException("isHexDigit");
+ throw new CharConversionException(MESSAGES.invalidHex());
j+=2;
int res=x2c( b1, b2 );
@@ -276,10 +275,4 @@
return digit;
}
- private final static int debug=0;
- private static void log( String s ) {
- if (log.isDebugEnabled())
- log.debug("URLDecoder: " + s );
- }
-
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/http/CookieSupport.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -19,6 +19,8 @@
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
/**
* Static constants for this package.
*/
@@ -137,8 +139,7 @@
public static final boolean isV0Separator(final char c) {
if (c < 0x20 || c >= 0x7f) {
if (c != 0x09) {
- throw new IllegalArgumentException(
- "Control character in cookie value or attribute.");
+ throw MESSAGES.invalidControlCharacter();
}
}
@@ -174,8 +175,7 @@
public static final boolean isHttpSeparator(final char c) {
if (c < 0x20 || c >= 0x7f) {
if (c != 0x09) {
- throw new IllegalArgumentException(
- "Control character in cookie value or attribute.");
+ throw MESSAGES.invalidControlCharacter();
}
}
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/util/http/ServerCookie.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -17,6 +17,8 @@
package org.apache.tomcat.util.http;
+import static org.jboss.web.CoyoteMessages.MESSAGES;
+
import java.io.Serializable;
import java.text.DateFormat;
import java.text.FieldPosition;
@@ -322,7 +324,7 @@
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
- if (++i>=endIndex) throw new IllegalArgumentException("Invalid escape character in cookie value.");
+ if (++i>=endIndex) throw MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteLogger.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -59,6 +59,11 @@
*/
CoyoteLogger AJP_LOGGER = Logger.getMessageLogger(CoyoteLogger.class, "org.apache.coyote.ajp");
+ /**
+ * A logger with the category of the package name.
+ */
+ CoyoteLogger BAYEUX_LOGGER = Logger.getMessageLogger(CoyoteLogger.class, "org.apache.tomcat.bayeux");
+
@LogMessage(level = INFO)
@Message(id = 3000, value = "Coyote HTTP/1.1 starting on: %s")
void startHttpConnector(String name);
@@ -383,4 +388,24 @@
@Message(id = 3080, value = "Error initializing socket factory")
void errorInitializingSocketFactory(@Cause Throwable t);
+ @LogMessage(level = WARN)
+ @Message(id = 3081, value = "Check Bayeux exception")
+ void errorInCheckBayeux(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3082, value = "Error processing Bayeux")
+ void errorProcessingBayeux(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 3083, value = "Message delivery error")
+ void errorDeliveringBayeux(@Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3084, value = "Failed setting property %s on object %s to %s")
+ void errorSettingProperty(String propertyName, Object object, String propertyValue, @Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 3085, value = "Failed getting property %s on object %s")
+ void errorGettingProperty(String propertyName, Object object, @Cause Throwable t);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/CoyoteMessages.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -100,4 +100,64 @@
@Message(id = 2020, value = "Invalid chunk header")
IOException invalidChunkHeader();
+ @Message(id = 2021, value = "Channel pattern must not be null")
+ NullPointerException invalidNullChannelPattern();
+
+ @Message(id = 2022, value = "Invalid message class, you can only publish messages created through the Bayeux.newMessage() method")
+ IllegalArgumentException invalidMessagePublish();
+
+ @Message(id = 2023, value = "Misconfigured server, must be configured to support Comet operations")
+ String invalidBayeuxConfiguration();
+
+ @Message(id = 2024, value = "No Bayeux message to send")
+ String noBayeuxMessage();
+
+ @Message(id = 2025, value = "Client doesn't support any appropriate connection type")
+ String noBayeuxConnectionType();
+
+ @Message(id = 2026, value = "Unable to fit %s bytes into the array. length:%s required length: %s")
+ ArrayIndexOutOfBoundsException errorGeneratingUuid(int uuidLength, int destLength, int reqLength);
+
+ @Message(id = 2027, value = "Invalid client id")
+ String invalidBayeuxClientId();
+
+ @Message(id = 2028, value = "Invalid handshake")
+ String invalidBayeuxHandshake();
+
+ @Message(id = 2029, value = "No Bayeux subscription")
+ String noBayeuxSubscription();
+
+ @Message(id = 2030, value = "Message data missing")
+ String noBayeuxMessageData();
+
+ @Message(id = 2031, value = "Invalid JSON object in data attribute")
+ String invalidBayeuxMessageData();
+
+ @Message(id = 2032, value = "Unsupported APR Version %s")
+ UnsatisfiedLinkError unsupportedAprVersion(String version);
+
+ @Message(id = 2033, value = "Missing APR threads support")
+ UnsatisfiedLinkError missingAprThreadsSupport();
+
+ @Message(id = 2034, value = "(Error on: ")
+ String aprError();
+
+ @Message(id = 2035, value = "Buffer length %s overflow with limit %s and no sink")
+ String bufferOverflow(int length, int limit);
+
+ @Message(id = 2036, value = "Unexpected EOF")
+ String unexpectedEof();
+
+ @Message(id = 2037, value = "Invalid HEX")
+ String invalidHex();
+
+ @Message(id = 2038, value = "Invalid slash")
+ String invalidSlash();
+
+ @Message(id = 2039, value = "Control character in cookie value or attribute")
+ IllegalArgumentException invalidControlCharacter();
+
+ @Message(id = 2040, value = "Invalid escape character in cookie value")
+ IllegalArgumentException invalidEscapeCharacter();
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/ELMessages.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -98,4 +98,28 @@
@Message(id = 6020, value = "Unable to find unambiguous method: %s.%s(%s)")
String ambiguousMethod(Object base, Object method, String parameters);
+ @Message(id = 6021, value = "Invalid method expression: %s")
+ String invalidMethodExpression(String expression);
+
+ @Message(id = 6022, value = "Function mapper is null")
+ NullPointerException invalidNullFunctionMapper();
+
+ @Message(id = 6023, value = "Local name is null")
+ NullPointerException invalidNullLocalName();
+
+ @Message(id = 6024, value = "Method is null")
+ NullPointerException invalidNullMethod();
+
+ @Message(id = 6025, value = "Variable mapper is null")
+ NullPointerException invalidNullVariableMapper();
+
+ @Message(id = 6026, value = "Cannot set variables on factory")
+ UnsupportedOperationException cannotSetVariablesOnFactory();
+
+ @Message(id = 6027, value = "Identity '%s' was null and was unable to invoke")
+ String invalidNullIdentity(String image);
+
+ @Message(id = 6028, value = "Identity '%s' does not reference a MethodExpression instance, returned type: %s")
+ String invalidIdentityHasWrongType(String image, String returnedType);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/JasperLogger.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -160,4 +160,36 @@
@Message(id = 5026, value = "Compilation classpath: %s")
void logCompilationClasspath(String classpath);
+ @LogMessage(level = ERROR)
+ @Message(id = 5027, value = "Error reading source file %s")
+ void errorReadingSourceFile(String sourceFile, @Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5028, value = "Error reading class file %s")
+ void errorReadingClassFile(String className, @Cause Throwable t);
+
+ @LogMessage(level = WARN)
+ @Message(id = 5029, value = "Unknown source JVM %s ignored")
+ void unknownSourceJvm(String version);
+
+ @LogMessage(level = WARN)
+ @Message(id = 5030, value = "Unknown target JVM %s ignored")
+ void unknownTargetJvm(String version);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5031, value = "Error creating compiler report")
+ void errorCreatingCompilerReport(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5032, value = "Compiler error")
+ void errorCompiling(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5033, value = "Exception initializing page context")
+ void errorInitializingPageContext(@Cause Throwable t);
+
+ @LogMessage(level = ERROR)
+ @Message(id = 5034, value = "Error loading core class")
+ void errorLoadingCoreClass(@Cause Throwable t);
+
}
Modified: branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java
===================================================================
--- branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java 2012-09-30 10:42:08 UTC (rev 2092)
+++ branches/7.2.x/src/main/java/org/jboss/web/JasperMessages.java 2012-10-01 16:46:15 UTC (rev 2093)
@@ -670,4 +670,106 @@
@Message(id = 4210, value = "Security exception for class %s")
String securityExceptionLoadingClass(String className);
+ @Message(id = 4211, value = "Stacktrace:")
+ String stacktrace();
+
+ @Message(id = 4212, value = "Background compilation failed")
+ String backgroundCompilationFailed();
+
+ @Message(id = 4213, value = "Security initialization failed")
+ String errorInitializingSecurity();
+
+ @Message(id = 4214, value = "Error unquoting attribute value")
+ String errorUnquotingAttributeValue();
+
+ @Message(id = 4215, value = "Invalid negative parameter: %s")
+ IllegalArgumentException invalidNegativeSmapPosition(int position);
+
+ @Message(id = 4216, value = "Undefined position")
+ IllegalArgumentException undefinedPosition();
+
+ @Message(id = 4217, value = "Unknown file name: %s")
+ IllegalArgumentException unknownFileName(String fileName);
+
+ @Message(id = 4218, value = "the name attribute of the attribute directive")
+ String tagFileProcessorAttrName();
+
+ @Message(id = 4219, value = "the name-given attribute of the variable directive")
+ String tagFileProcessorVarNameGiven();
+
+ @Message(id = 4220, value = "the name-from-attribute attribute of the variable directive")
+ String tagFileProcessorVarNameFrom();
+
+ @Message(id = 4221, value = "the alias attribute of the variable directive")
+ String tagFileProcessorVarAlias();
+
+ @Message(id = 4222, value = "the dynamic-attributes attribute of the tag directive")
+ String tagFileProcessorTagDynamic();
+
+ @Message(id = 4223, value = "Null context")
+ NullPointerException elResolverNullContext();
+
+ @Message(id = 4224, value = "Error resolving variable %s due to %s")
+ String errorResolvingVariable(String variable, String message);
+
+ @Message(id = 4225, value = "Legacy VariableResolver wrapped, not writable")
+ String legacyVariableResolver();
+
+ @Message(id = 4226, value = "Stream closed")
+ String streamClosed();
+
+ @Message(id = 4227, value = "Null text argument")
+ IllegalArgumentException nullCharBufferTextArgument();
+
+ @Message(id = 4228, value = "Null characters argument")
+ IllegalArgumentException nullCharBufferCharactersArgument();
+
+ @Message(id = 4229, value = "Null writer argument")
+ IllegalArgumentException nullCharBufferWriterArgument();
+
+ @Message(id = 4230, value = "Invalid start position")
+ IllegalArgumentException invalidCharBufferStartPosition();
+
+ @Message(id = 4231, value = "Invalid length")
+ IllegalArgumentException invalidCharBufferLength();
+
+ @Message(id = 4232, value = "No org.apache.tomcat.InstanceManager set in ServletContext")
+ IllegalStateException noInstanceManager();
+
+ @Message(id = 4233, value = "Null ELContextListener")
+ IllegalArgumentException nullElContextListener();
+
+ @Message(id = 4234, value = "Null ServletContext")
+ IllegalArgumentException nullServletContext();
+
+ @Message(id = 4235, value = "Null JspContext")
+ IllegalArgumentException nullJspContext();
+
+ @Message(id = 4236, value = "Null ELResolver")
+ IllegalArgumentException nullElResolver();
+
+ @Message(id = 4237, value = "Cannot add ELResolver after the first request has been made")
+ IllegalStateException cannotAddElResolver();
+
+ @Message(id = 4238, value = "Negative buffer size")
+ IllegalArgumentException invalidNegativeBufferSize();
+
+ @Message(id = 4239, value = "Page needs a session and none is available")
+ IllegalStateException pageNeedsSession();
+
+ @Message(id = 4240, value = "Null throwable")
+ NullPointerException nullThrowable();
+
+ @Message(id = 4241, value = "Invalid function mapping - no such method: %s")
+ RuntimeException invalidFunctionMapping(String message);
+
+ @Message(id = 4242, value = "Invalid request parameter %s value %s")
+ String invalidRequestParameterValue(String name, String value);
+
+ @Message(id = 4243, value = "The processing instruction target matching \"[xX][mM][lL]\" is not allowed.")
+ String reservedPiTarget();
+
+ @Message(id = 4244, value = "White space is required between the processing instruction target and data.")
+ String requiredWhiteSpaceAfterPiTarget();
+
}
12 years, 2 months