summaryrefslogtreecommitdiff
path: root/java/common
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-04-09 11:25:32 +0000
committerRobert Greig <rgreig@apache.org>2007-04-09 11:25:32 +0000
commitb8b2e032a4a6a6ad796ce6247c581a0498b5c264 (patch)
tree88a0d86fd30edcae6f50ad96e857b939d4ada67c /java/common
parentda5b82c87e2487c1e3beb9260bad5b8e39f1639f (diff)
downloadqpid-python-b8b2e032a4a6a6ad796ce6247c581a0498b5c264.tar.gz
Purged logging from exception constructors.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@526714 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
-rw-r--r--java/common/src/main/java/org/apache/qpid/AMQException.java27
-rw-r--r--java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java20
-rw-r--r--java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java16
-rw-r--r--java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java71
4 files changed, 43 insertions, 91 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/AMQException.java b/java/common/src/main/java/org/apache/qpid/AMQException.java
index 0222fd9b4e..32c1e76a39 100644
--- a/java/common/src/main/java/org/apache/qpid/AMQException.java
+++ b/java/common/src/main/java/org/apache/qpid/AMQException.java
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
*/
package org.apache.qpid;
-import org.apache.log4j.Logger;
import org.apache.qpid.protocol.AMQConstant;
/** Generic AMQ exception. */
@@ -31,14 +30,14 @@ public class AMQException extends Exception
public AMQException(String message)
{
super(message);
- //fixme This method needs removed and all AMQExceptions need a valid error code
+ // fixme This method needs removed and all AMQExceptions need a valid error code
_errorCode = AMQConstant.getConstant(-1);
}
public AMQException(String msg, Throwable t)
{
super(msg, t);
- //fixme This method needs removed and all AMQExceptions need a valid error code
+ // fixme This method needs removed and all AMQExceptions need a valid error code
_errorCode = AMQConstant.getConstant(-1);
}
@@ -54,24 +53,6 @@ public class AMQException extends Exception
_errorCode = errorCode;
}
- public AMQException(Logger logger, String msg, Throwable t)
- {
- this(msg, t);
- logger.error(getMessage(), this);
- }
-
- public AMQException(Logger logger, String msg)
- {
- this(msg);
- logger.error(getMessage(), this);
- }
-
- public AMQException(Logger logger, AMQConstant errorCode, String msg)
- {
- this(errorCode, msg);
- logger.error(getMessage(), this);
- }
-
public AMQConstant getErrorCode()
{
return _errorCode;
diff --git a/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java b/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
index 958f59191f..022e7b8a76 100644
--- a/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
+++ b/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.configuration;
-import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
@@ -48,19 +47,4 @@ public class PropertyException extends AMQException
{
super(errorCode, msg);
}
-
- public PropertyException(Logger logger, String msg, Throwable t)
- {
- super(logger, msg, t);
- }
-
- public PropertyException(Logger logger, String msg)
- {
- super(logger, msg);
- }
-
- public PropertyException(Logger logger, AMQConstant errorCode, String msg)
- {
- super(logger, errorCode, msg);
- }
}
diff --git a/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java b/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
index a24bd6aaa9..a3d4513240 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
@@ -7,9 +7,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.framing;
-import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
public class AMQFrameDecodingException extends AMQException
@@ -34,15 +33,4 @@ public class AMQFrameDecodingException extends AMQException
{
super(message, t);
}
-
- public AMQFrameDecodingException(Logger log, String message)
- {
- super(log, message);
- }
-
- public AMQFrameDecodingException(Logger log, String message, Throwable t)
- {
- super(log, message, t);
- }
-
}
diff --git a/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java b/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
index ec371453aa..fcd8d47d32 100644
--- a/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
+++ b/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
@@ -20,16 +20,16 @@
*/
package org.apache.qpid.framing;
-import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
-
import org.apache.log4j.Logger;
+
import org.apache.mina.common.ByteBuffer;
+import org.apache.qpid.framing.abstraction.ProtocolVersionMethodConverter;
+
public class VersionSpecificRegistry
{
private static final Logger _log = Logger.getLogger(VersionSpecificRegistry.class);
-
private final byte _protocolMajorVersion;
private final byte _protocolMinorVersion;
@@ -48,26 +48,31 @@ public class VersionSpecificRegistry
_protocolVersionConverter = loadProtocolVersionConverters(major, minor);
}
- private static ProtocolVersionMethodConverter loadProtocolVersionConverters(byte protocolMajorVersion, byte protocolMinorVersion)
+ private static ProtocolVersionMethodConverter loadProtocolVersionConverters(byte protocolMajorVersion,
+ byte protocolMinorVersion)
{
try
{
Class<ProtocolVersionMethodConverter> versionMethodConverterClass =
- (Class<ProtocolVersionMethodConverter>) Class.forName("org.apache.qpid.framing.MethodConverter_"+protocolMajorVersion + "_" + protocolMinorVersion);
+ (Class<ProtocolVersionMethodConverter>) Class.forName("org.apache.qpid.framing.MethodConverter_"
+ + protocolMajorVersion + "_" + protocolMinorVersion);
+
return versionMethodConverterClass.newInstance();
}
catch (ClassNotFoundException e)
{
_log.warn("Could not find protocol conversion classes for " + protocolMajorVersion + "-" + protocolMinorVersion);
- if(protocolMinorVersion != 0)
+ if (protocolMinorVersion != 0)
{
protocolMinorVersion--;
+
return loadProtocolVersionConverters(protocolMajorVersion, protocolMinorVersion);
}
else if (protocolMajorVersion != 0)
{
protocolMajorVersion--;
+
return loadProtocolVersionConverters(protocolMajorVersion, protocolMinorVersion);
}
else
@@ -75,7 +80,6 @@ public class VersionSpecificRegistry
return null;
}
-
}
catch (IllegalAccessException e)
{
@@ -83,7 +87,7 @@ public class VersionSpecificRegistry
}
catch (InstantiationException e)
{
- throw new IllegalStateException("Unable to load protocol version converter: ", e);
+ throw new IllegalStateException("Unable to load protocol version converter: ", e);
}
}
@@ -115,73 +119,68 @@ public class VersionSpecificRegistry
public void registerMethod(final short classID, final short methodID, final AMQMethodBodyInstanceFactory instanceFactory)
{
- if(_registry.length <= classID)
+ if (_registry.length <= classID)
{
AMQMethodBodyInstanceFactory[][] oldRegistry = _registry;
- _registry = new AMQMethodBodyInstanceFactory[classID+1][];
+ _registry = new AMQMethodBodyInstanceFactory[classID + 1][];
System.arraycopy(oldRegistry, 0, _registry, 0, oldRegistry.length);
}
- if(_registry[classID] == null)
+ if (_registry[classID] == null)
{
- _registry[classID] = new AMQMethodBodyInstanceFactory[methodID > DEFAULT_MAX_METHOD_ID ? methodID + 1 : DEFAULT_MAX_METHOD_ID + 1];
+ _registry[classID] =
+ new AMQMethodBodyInstanceFactory[(methodID > DEFAULT_MAX_METHOD_ID) ? (methodID + 1)
+ : (DEFAULT_MAX_METHOD_ID + 1)];
}
- else if(_registry[classID].length <= methodID)
+ else if (_registry[classID].length <= methodID)
{
AMQMethodBodyInstanceFactory[] oldMethods = _registry[classID];
- _registry[classID] = new AMQMethodBodyInstanceFactory[methodID+1];
- System.arraycopy(oldMethods,0,_registry[classID],0,oldMethods.length);
+ _registry[classID] = new AMQMethodBodyInstanceFactory[methodID + 1];
+ System.arraycopy(oldMethods, 0, _registry[classID], 0, oldMethods.length);
}
_registry[classID][methodID] = instanceFactory;
}
-
- public AMQMethodBody get(short classID, short methodID, ByteBuffer in, long size)
- throws AMQFrameDecodingException
+ public AMQMethodBody get(short classID, short methodID, ByteBuffer in, long size) throws AMQFrameDecodingException
{
AMQMethodBodyInstanceFactory bodyFactory;
try
{
bodyFactory = _registry[classID][methodID];
}
- catch(NullPointerException e)
+ catch (NullPointerException e)
{
- throw new AMQFrameDecodingException(_log,
- "Class " + classID + " unknown in AMQP version " + _protocolMajorVersion + "-" + _protocolMinorVersion
- + " (while trying to decode class " + classID + " method " + methodID + ".");
+ throw new AMQFrameDecodingException("Class " + classID + " unknown in AMQP version " + _protocolMajorVersion
+ + "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID + ".");
}
- catch(IndexOutOfBoundsException e)
+ catch (IndexOutOfBoundsException e)
{
- if(classID >= _registry.length)
+ if (classID >= _registry.length)
{
- throw new AMQFrameDecodingException(_log,
- "Class " + classID + " unknown in AMQP version " + _protocolMajorVersion + "-" + _protocolMinorVersion
- + " (while trying to decode class " + classID + " method " + methodID + ".");
+ throw new AMQFrameDecodingException("Class " + classID + " unknown in AMQP version " + _protocolMajorVersion
+ + "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID
+ + ".");
}
else
{
- throw new AMQFrameDecodingException(_log,
- "Method " + methodID + " unknown in AMQP version " + _protocolMajorVersion + "-" + _protocolMinorVersion
- + " (while trying to decode class " + classID + " method " + methodID + ".");
+ throw new AMQFrameDecodingException("Method " + methodID + " unknown in AMQP version "
+ + _protocolMajorVersion + "-" + _protocolMinorVersion + " (while trying to decode class " + classID
+ + " method " + methodID + ".");
}
}
-
if (bodyFactory == null)
{
- throw new AMQFrameDecodingException(_log,
- "Method " + methodID + " unknown in AMQP version " + _protocolMajorVersion + "-" + _protocolMinorVersion
- + " (while trying to decode class " + classID + " method " + methodID + ".");
+ throw new AMQFrameDecodingException("Method " + methodID + " unknown in AMQP version " + _protocolMajorVersion
+ + "-" + _protocolMinorVersion + " (while trying to decode class " + classID + " method " + methodID + ".");
}
-
return bodyFactory.newInstance(_protocolMajorVersion, _protocolMinorVersion, classID, methodID, in, size);
-
}
public ProtocolVersionMethodConverter getProtocolVersionMethodConverter()