You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2007/04/09 13:45:50 UTC
svn commit: r526720 - in /incubator/qpid/trunk/qpid: ./
java/broker/src/main/java/org/apache/qpid/server/exchange/
java/client/example/src/main/java/org/apache/qpid/example/publisher/
java/client/example/src/main/java/org/apache/qpid/example/shared/ ja...
Author: rgreig
Date: Mon Apr 9 04:45:48 2007
New Revision: 526720
URL: http://svn.apache.org/viewvc?view=rev&rev=526720
Log:
Merged revisions 526714 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r526714 | rgreig | 2007-04-09 12:25:32 +0100 (Mon, 09 Apr 2007) | 1 line
Purged logging from exception constructors.
........
Modified:
incubator/qpid/trunk/qpid/ (props changed)
incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java
incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java
incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java
incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java
incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/InitialContextHelper.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java
incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
Propchange: incubator/qpid/trunk/qpid/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeFactory.java Mon Apr 9 04:45:48 2007
@@ -65,11 +65,11 @@
}
catch (InstantiationException e)
{
- throw new AMQException(_logger, "Unable to create exchange: " + e, e);
+ throw new AMQException("Unable to create exchange: " + e, e);
}
catch (IllegalAccessException e)
{
- throw new AMQException(_logger, "Unable to create exchange: " + e, e);
+ throw new AMQException("Unable to create exchange: " + e, e);
}
}
}
Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/MessageFactoryException.java Mon Apr 9 04:45:48 2007
@@ -1,4 +1,5 @@
/*
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -6,21 +7,21 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
package org.apache.qpid.example.publisher;
-import org.apache.log4j.Logger;
-
-public class MessageFactoryException extends Exception {
+public class MessageFactoryException extends Exception
+{
private int _errorCode;
@@ -46,27 +47,8 @@
_errorCode = errorCode;
}
- public MessageFactoryException(Logger logger, String msg, Throwable t)
- {
- this(msg, t);
- logger.error(getMessage(), this);
- }
-
- public MessageFactoryException(Logger logger, String msg)
- {
- this(msg);
- logger.error(getMessage(), this);
- }
-
- public MessageFactoryException(Logger logger, int errorCode, String msg)
- {
- this(errorCode, msg);
- logger.error(getMessage(), this);
- }
-
public int getErrorCode()
{
return _errorCode;
}
}
-
Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/publisher/UndeliveredMessageException.java Mon Apr 9 04:45:48 2007
@@ -1,4 +1,5 @@
/*
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -6,24 +7,24 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
package org.apache.qpid.example.publisher;
-import org.apache.log4j.Logger;
-
/**
* Exception thrown by monitor when cannot send a message marked for immediate delivery
*/
-public class UndeliveredMessageException extends Exception {
+public class UndeliveredMessageException extends Exception
+{
private int _errorCode;
@@ -47,24 +48,6 @@
{
super(msg + " [error code " + errorCode + ']');
_errorCode = errorCode;
- }
-
- public UndeliveredMessageException(Logger logger, String msg, Throwable t)
- {
- this(msg, t);
- logger.error(getMessage(), this);
- }
-
- public UndeliveredMessageException(Logger logger, String msg)
- {
- this(msg);
- logger.error(getMessage(), this);
- }
-
- public UndeliveredMessageException(Logger logger, int errorCode, String msg)
- {
- this(errorCode, msg);
- logger.error(getMessage(), this);
}
public int getErrorCode()
Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ConnectionException.java Mon Apr 9 04:45:48 2007
@@ -1,4 +1,5 @@
/*
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -6,21 +7,21 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
+ *
*/
package org.apache.qpid.example.shared;
-import org.apache.log4j.Logger;
-
-public class ConnectionException extends Exception {
+public class ConnectionException extends Exception
+{
private int _errorCode;
@@ -44,24 +45,6 @@
{
super(msg + " [error code " + errorCode + ']');
_errorCode = errorCode;
- }
-
- public ConnectionException(Logger logger, String msg, Throwable t)
- {
- this(msg, t);
- logger.error(getMessage(), this);
- }
-
- public ConnectionException(Logger logger, String msg)
- {
- this(msg);
- logger.error(getMessage(), this);
- }
-
- public ConnectionException(Logger logger, int errorCode, String msg)
- {
- this(errorCode, msg);
- logger.error(getMessage(), this);
}
public int getErrorCode()
Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/ContextException.java Mon Apr 9 04:45:48 2007
@@ -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,9 +20,8 @@
*/
package org.apache.qpid.example.shared;
-import org.apache.log4j.Logger;
-
-public class ContextException extends Exception {
+public class ContextException extends Exception
+{
private int _errorCode;
@@ -46,24 +45,6 @@
{
super(msg + " [error code " + errorCode + ']');
_errorCode = errorCode;
- }
-
- public ContextException(Logger logger, String msg, Throwable t)
- {
- this(msg, t);
- logger.error(getMessage(), this);
- }
-
- public ContextException(Logger logger, String msg)
- {
- this(msg);
- logger.error(getMessage(), this);
- }
-
- public ContextException(Logger logger, int errorCode, String msg)
- {
- this(errorCode, msg);
- logger.error(getMessage(), this);
}
public int getErrorCode()
Modified: incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/InitialContextHelper.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/InitialContextHelper.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/InitialContextHelper.java (original)
+++ incubator/qpid/trunk/qpid/java/client/example/src/main/java/org/apache/qpid/example/shared/InitialContextHelper.java Mon Apr 9 04:45:48 2007
@@ -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,18 +20,20 @@
*/
package org.apache.qpid.example.shared;
-import org.apache.log4j.Logger;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import java.util.Properties;
-import java.io.InputStream;
-import java.io.IOException;
+
+import org.apache.log4j.Logger;
/**
* Class that provides helper methods for JNDI
*/
-public class InitialContextHelper {
+public class InitialContextHelper
+{
public static final String _defaultPropertiesName = "example.properties";
protected static Properties _fileProperties;
@@ -42,7 +44,7 @@
{
try
{
- if (propertiesName == null || propertiesName.length() == 0)
+ if ((propertiesName == null) || (propertiesName.length() == 0))
{
propertiesName = _defaultPropertiesName;
}
@@ -50,18 +52,18 @@
_fileProperties = new Properties();
ClassLoader cl = this.getClass().getClassLoader();
- //NB: Need to change path to reflect package if moving classes around !
+ // NB: Need to change path to reflect package if moving classes around !
InputStream is = cl.getResourceAsStream("org/apache/qpid/example/shared/" + propertiesName);
_fileProperties.load(is);
_initialContext = new InitialContext(_fileProperties);
}
catch (IOException e)
{
- throw new ContextException(_log, e.toString());
+ throw new ContextException(e.toString());
}
catch (NamingException n)
{
- throw new ContextException(_log, n.toString());
+ throw new ContextException(n.toString());
}
}
Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Mon Apr 9 04:45:48 2007
@@ -769,7 +769,7 @@
}
else
{
- amqe = new AMQException(_logger, "Closing session forcibly", e);
+ amqe = new AMQException("Closing session forcibly", e);
}
_connection.deregisterSession(_channelId);
closeProducersAndConsumers(amqe);
Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java Mon Apr 9 04:45:48 2007
@@ -170,7 +170,7 @@
}
catch (UnsupportedEncodingException e)
{
- throw new AMQException(_log, "Unable to decode data: " + e, e);
+ throw new AMQException("Unable to decode data: " + e, e);
}
}
else
Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/UnexpectedBodyReceivedException.java Mon Apr 9 04:45:48 2007
@@ -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,25 +20,23 @@
*/
package org.apache.qpid.client.message;
-import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
import org.apache.qpid.protocol.AMQConstant;
public class UnexpectedBodyReceivedException extends AMQException
{
-
- public UnexpectedBodyReceivedException(Logger logger, String msg, Throwable t)
+ public UnexpectedBodyReceivedException(String msg, Throwable t)
{
- super(logger, msg, t);
+ super(msg, t);
}
- public UnexpectedBodyReceivedException(Logger logger, String msg)
+ public UnexpectedBodyReceivedException(String msg)
{
- super(logger, msg);
+ super(msg);
}
- public UnexpectedBodyReceivedException(Logger logger, AMQConstant errorCode, String msg)
+ public UnexpectedBodyReceivedException(AMQConstant errorCode, String msg)
{
- super(logger, errorCode, msg);
+ super(errorCode, msg);
}
}
Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java Mon Apr 9 04:45:48 2007
@@ -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
@@ -27,11 +27,14 @@
import javax.security.sasl.SaslClient;
import org.apache.commons.lang.StringUtils;
+
import org.apache.log4j.Logger;
+
import org.apache.mina.common.CloseFuture;
import org.apache.mina.common.IdleStatus;
import org.apache.mina.common.IoSession;
import org.apache.mina.common.WriteFuture;
+
import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
@@ -45,10 +48,10 @@
import org.apache.qpid.framing.ContentHeaderBody;
import org.apache.qpid.framing.MainRegistry;
import org.apache.qpid.framing.ProtocolInitiation;
-import org.apache.qpid.framing.VersionSpecificRegistry;
import org.apache.qpid.framing.ProtocolVersion;
-import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
+import org.apache.qpid.framing.VersionSpecificRegistry;
import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.AMQVersionAwareProtocolSession;
/**
* Wrapper for protocol session that provides type-safe access to session attributes. <p/> The underlying protocol
@@ -98,8 +101,8 @@
private byte _protocolMinorVersion;
private byte _protocolMajorVersion;
- private VersionSpecificRegistry _registry = MainRegistry.getVersionSpecificRegistry(ProtocolVersion.getLatestSupportedVersion());
-
+ private VersionSpecificRegistry _registry =
+ MainRegistry.getVersionSpecificRegistry(ProtocolVersion.getLatestSupportedVersion());
/**
* No-arg constructor for use by test subclass - has to initialise final vars NOT intended for use other then for
@@ -118,19 +121,20 @@
_minaProtocolSession = protocolSession;
// properties of the connection are made available to the event handlers
_minaProtocolSession.setAttribute(AMQ_CONNECTION, connection);
- //fixme - real value needed
+ // fixme - real value needed
_minaProtocolSession.setWriteTimeout(LAST_WRITE_FUTURE_JOIN_TIMEOUT);
_stateManager = new AMQStateManager(this);
}
- public AMQProtocolSession(AMQProtocolHandler protocolHandler, IoSession protocolSession, AMQConnection connection, AMQStateManager stateManager)
+ public AMQProtocolSession(AMQProtocolHandler protocolHandler, IoSession protocolSession, AMQConnection connection,
+ AMQStateManager stateManager)
{
_protocolHandler = protocolHandler;
_minaProtocolSession = protocolSession;
_minaProtocolSession.setAttachment(this);
// properties of the connection are made available to the event handlers
_minaProtocolSession.setAttribute(AMQ_CONNECTION, connection);
- //fixme - real value needed
+ // fixme - real value needed
_minaProtocolSession.setWriteTimeout(LAST_WRITE_FUTURE_JOIN_TIMEOUT);
_stateManager = stateManager;
_stateManager.setProtocolSession(this);
@@ -242,18 +246,20 @@
_channelId2UnprocessedMsgMap.put(message.getChannelId(), message);
}
- public void messageContentHeaderReceived(int channelId, ContentHeaderBody contentHeader)
- throws AMQException
+ public void messageContentHeaderReceived(int channelId, ContentHeaderBody contentHeader) throws AMQException
{
UnprocessedMessage msg = (UnprocessedMessage) _channelId2UnprocessedMsgMap.get(channelId);
if (msg == null)
{
throw new AMQException("Error: received content header without having received a BasicDeliver frame first");
}
+
if (msg.getContentHeader() != null)
{
- throw new AMQException("Error: received duplicate content header or did not receive correct number of content body frames");
+ throw new AMQException(
+ "Error: received duplicate content header or did not receive correct number of content body frames");
}
+
msg.setContentHeader(contentHeader);
if (contentHeader.bodySize == 0)
{
@@ -268,11 +274,13 @@
{
throw new AMQException("Error: received content body without having received a JMSDeliver frame first");
}
+
if (msg.getContentHeader() == null)
{
_channelId2UnprocessedMsgMap.remove(channelId);
throw new AMQException("Error: received content body without having received a ContentHeader frame first");
}
+
try
{
msg.receiveBody(contentBody);
@@ -282,6 +290,7 @@
_channelId2UnprocessedMsgMap.remove(channelId);
throw e;
}
+
if (msg.isAllBodyDataReceived())
{
deliverMessageToAMQSession(channelId, msg);
@@ -317,7 +326,7 @@
WriteFuture f = _minaProtocolSession.write(frame);
if (wait)
{
- //fixme -- time out?
+ // fixme -- time out?
f.join();
}
else
@@ -332,10 +341,12 @@
{
throw new IllegalArgumentException("Attempt to register a session with a channel id <= zero");
}
+
if (session == null)
{
throw new IllegalArgumentException("Attempt to register a null session");
}
+
_logger.debug("Add session with channel id " + channelId);
_channelId2SessionMap.put(channelId, session);
}
@@ -346,6 +357,7 @@
{
throw new IllegalArgumentException("Attempt to deregister a session with a channel id <= zero");
}
+
_logger.debug("Removing session with channelId " + channelId);
_channelId2SessionMap.remove(channelId);
}
@@ -388,12 +400,13 @@
final AMQSession session = (AMQSession) _channelId2SessionMap.get(chId);
try
{
- session.closed(new AMQException(_logger, code, text));
+ session.closed(new AMQException(code, text));
}
catch (JMSException e)
{
throw new AMQException("JMSException received while closing session", e);
}
+
return true;
}
else
@@ -415,7 +428,7 @@
public void closeProtocolSession(boolean waitLast)
{
_logger.debug("Waiting for last write to join.");
- if (waitLast && _lastWriteFuture != null)
+ if (waitLast && (_lastWriteFuture != null))
{
_lastWriteFuture.join(LAST_WRITE_FUTURE_JOIN_TIMEOUT);
}
@@ -437,8 +450,9 @@
{
id = _queueId++;
}
- //get rid of / and : and ; from address for spec conformance
+ // get rid of / and : and ; from address for spec conformance
String localAddress = StringUtils.replaceChars(_minaProtocolSession.getLocalAddress().toString(), "/;:", "");
+
return new AMQShortString("tmp_" + localAddress + "_" + id);
}
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/AMQException.java Mon Apr 9 04:45:48 2007
@@ -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 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);
}
@@ -52,24 +51,6 @@
{
super(msg + " [error code " + errorCode + ']');
_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()
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/configuration/PropertyException.java Mon Apr 9 04:45:48 2007
@@ -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;
@@ -47,20 +46,5 @@
public PropertyException(AMQConstant errorCode, String msg)
{
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);
}
}
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/AMQFrameDecodingException.java Mon Apr 9 04:45:48 2007
@@ -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 @@
{
super(message, t);
}
-
- public AMQFrameDecodingException(Logger log, String message)
- {
- super(log, message);
- }
-
- public AMQFrameDecodingException(Logger log, String message, Throwable t)
- {
- super(log, message, t);
- }
-
}
Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java?view=diff&rev=526720&r1=526719&r2=526720
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java Mon Apr 9 04:45:48 2007
@@ -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 @@
_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 @@
return null;
}
-
}
catch (IllegalAccessException e)
{
@@ -83,7 +87,7 @@
}
catch (InstantiationException e)
{
- throw new IllegalStateException("Unable to load protocol version converter: ", e);
+ throw new IllegalStateException("Unable to load protocol version converter: ", e);
}
}
@@ -115,72 +119,67 @@
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(in, size);
-
}