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 2013/03/17 19:03:43 UTC

svn commit: r1457505 [5/14] - in /qpid/trunk/qpid/java: amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/ amqp-1-0-client/example/src/main/java/org/apache/qpid/amqp_1_0/client/ amqp-1-0-client/src/main/java/org/apache/qpid/amqp_1_0/c...

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/LongWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/LongWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/LongWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/LongWriter.java Sun Mar 17 18:03:37 2013
@@ -1,111 +1,111 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.nio.ByteBuffer;
-
-public class LongWriter implements ValueWriter<Long>
-{
-    private static final byte EIGHT_BYTE_FORMAT_CODE = (byte) 0x81;
-
-
-    private static final byte ONE_BYTE_FORMAT_CODE = (byte) 0x55;
-
-    private ValueWriter<Long> _delegate;
-
-    private final FixedEightWriter<Long> _eightByteWriter = new FixedEightWriter<Long>()
-    {
-
-        @Override
-        byte getFormatCode()
-        {
-            return EIGHT_BYTE_FORMAT_CODE;
-        }
-
-        @Override
-        long convertValueToLong(Long value)
-        {
-            return value;
-        }
-
-    };
-
-    private final ValueWriter<Long> _oneByteWriter = new FixedOneWriter<Long>()
-    {
-
-        @Override protected byte getFormatCode()
-        {
-            return ONE_BYTE_FORMAT_CODE;
-        }
-
-        @Override protected byte convertToByte(final Long value)
-        {
-            return value.byteValue();
-        }
-    };
-
-    public int writeToBuffer(final ByteBuffer buffer)
-    {
-        return _delegate.writeToBuffer(buffer);
-    }
-
-    public void setValue(final Long l)
-    {
-        if(l >= -128 && l <= 127)
-        {
-            _delegate = _oneByteWriter;
-        }
-        else
-        {
-            _delegate = _eightByteWriter;
-        }
-        _delegate.setValue(l);
-    }
-
-    public boolean isComplete()
-    {
-        return _delegate.isComplete();
-    }
-
-    public boolean isCacheable()
-    {
-        return false;
-    }
-
-
-
-
-    private static Factory<Long> FACTORY = new Factory<Long>()
-                                            {
-
-                                                public ValueWriter<Long> newInstance(Registry registry)
-                                                {
-                                                    return new LongWriter();
-                                                }
-                                            };
-
-    public static void register(ValueWriter.Registry registry)
-    {
-        registry.register(Long.class, FACTORY);
-    }
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.nio.ByteBuffer;
+
+public class LongWriter implements ValueWriter<Long>
+{
+    private static final byte EIGHT_BYTE_FORMAT_CODE = (byte) 0x81;
+
+
+    private static final byte ONE_BYTE_FORMAT_CODE = (byte) 0x55;
+
+    private ValueWriter<Long> _delegate;
+
+    private final FixedEightWriter<Long> _eightByteWriter = new FixedEightWriter<Long>()
+    {
+
+        @Override
+        byte getFormatCode()
+        {
+            return EIGHT_BYTE_FORMAT_CODE;
+        }
+
+        @Override
+        long convertValueToLong(Long value)
+        {
+            return value;
+        }
+
+    };
+
+    private final ValueWriter<Long> _oneByteWriter = new FixedOneWriter<Long>()
+    {
+
+        @Override protected byte getFormatCode()
+        {
+            return ONE_BYTE_FORMAT_CODE;
+        }
+
+        @Override protected byte convertToByte(final Long value)
+        {
+            return value.byteValue();
+        }
+    };
+
+    public int writeToBuffer(final ByteBuffer buffer)
+    {
+        return _delegate.writeToBuffer(buffer);
+    }
+
+    public void setValue(final Long l)
+    {
+        if(l >= -128 && l <= 127)
+        {
+            _delegate = _oneByteWriter;
+        }
+        else
+        {
+            _delegate = _eightByteWriter;
+        }
+        _delegate.setValue(l);
+    }
+
+    public boolean isComplete()
+    {
+        return _delegate.isComplete();
+    }
+
+    public boolean isCacheable()
+    {
+        return false;
+    }
+
+
+
+
+    private static Factory<Long> FACTORY = new Factory<Long>()
+                                            {
+
+                                                public ValueWriter<Long> newInstance(Registry registry)
+                                                {
+                                                    return new LongWriter();
+                                                }
+                                            };
+
+    public static void register(ValueWriter.Registry registry)
+    {
+        registry.register(Long.class, FACTORY);
+    }
+
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/LongWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/MapWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/MapWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/MapWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/MapWriter.java Sun Mar 17 18:03:37 2013
@@ -1,102 +1,102 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.util.Iterator;
-import java.util.Map;
-
-public class MapWriter extends AbstractMapWriter<Map>
-{
-    private Map _map;
-    private Object _value;
-    private Iterator<Map.Entry> _iterator;
-
-    public MapWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected void onSetValue(final Map value)
-    {
-        _map = value;
-        _iterator = value.entrySet().iterator();
-    }
-
-    @Override
-    protected int getMapCount()
-    {
-        return _map.size();
-    }
-
-    @Override
-    protected boolean hasMapNext()
-    {
-        return _iterator.hasNext();
-    }
-
-    @Override
-    protected Object nextKey()
-    {
-        Map.Entry entry = _iterator.next();
-        _value = entry.getValue();
-        return entry.getKey();
-    }
-    @Override
-    protected Object nextValue()
-    {
-        Object value = _value;
-        _value = null;
-        return value;
-    }
-
-
-    @Override
-    protected void onClear()
-    {
-        _map = null;
-        _iterator = null;
-        _value = null;
-    }
-
-    @Override
-    protected void onReset()
-    {
-        _iterator = _map.entrySet().iterator();
-        _value = null;
-    }
-
-
-    private static Factory<Map> FACTORY = new Factory<Map>()
-                                            {
-
-                                                public ValueWriter<Map> newInstance(Registry registry)
-                                                {
-                                                    return new MapWriter(registry);
-                                                }
-                                            };
-
-    public static void register(ValueWriter.Registry registry)
-    {
-        registry.register(Map.class, FACTORY);
-    }
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.util.Iterator;
+import java.util.Map;
+
+public class MapWriter extends AbstractMapWriter<Map>
+{
+    private Map _map;
+    private Object _value;
+    private Iterator<Map.Entry> _iterator;
+
+    public MapWriter(final Registry registry)
+    {
+        super(registry);
+    }
+
+    @Override
+    protected void onSetValue(final Map value)
+    {
+        _map = value;
+        _iterator = value.entrySet().iterator();
+    }
+
+    @Override
+    protected int getMapCount()
+    {
+        return _map.size();
+    }
+
+    @Override
+    protected boolean hasMapNext()
+    {
+        return _iterator.hasNext();
+    }
+
+    @Override
+    protected Object nextKey()
+    {
+        Map.Entry entry = _iterator.next();
+        _value = entry.getValue();
+        return entry.getKey();
+    }
+    @Override
+    protected Object nextValue()
+    {
+        Object value = _value;
+        _value = null;
+        return value;
+    }
+
+
+    @Override
+    protected void onClear()
+    {
+        _map = null;
+        _iterator = null;
+        _value = null;
+    }
+
+    @Override
+    protected void onReset()
+    {
+        _iterator = _map.entrySet().iterator();
+        _value = null;
+    }
+
+
+    private static Factory<Map> FACTORY = new Factory<Map>()
+                                            {
+
+                                                public ValueWriter<Map> newInstance(Registry registry)
+                                                {
+                                                    return new MapWriter(registry);
+                                                }
+                                            };
+
+    public static void register(ValueWriter.Registry registry)
+    {
+        registry.register(Map.class, FACTORY);
+    }
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/MapWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullTypeConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullWriter.java Sun Mar 17 18:03:37 2013
@@ -1,70 +1,70 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.nio.ByteBuffer;
-
-public class NullWriter implements ValueWriter<Void>
-{
-    private boolean _complete = true;
-
-    public int writeToBuffer(ByteBuffer buffer)
-    {
-
-        if(!_complete && buffer.hasRemaining())
-        {
-            buffer.put((byte)0x40);
-            _complete = true;
-        }
-
-        return 1;
-    }
-
-    public void setValue(Void frameBody)
-    {
-        _complete = false;
-    }
-
-    public boolean isCacheable()
-    {
-        return true;
-    }
-
-    public boolean isComplete()
-    {
-        return _complete;
-    }
-
-    private static Factory<Void> FACTORY = new Factory<Void>()
-                                            {
-
-                                                public ValueWriter<Void> newInstance(Registry registry)
-                                                {
-                                                    return new NullWriter();
-                                                }
-                                            };
-
-    public static void register(ValueWriter.Registry registry)
-    {
-        registry.register(Void.TYPE, FACTORY);
-    }
-}
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.nio.ByteBuffer;
+
+public class NullWriter implements ValueWriter<Void>
+{
+    private boolean _complete = true;
+
+    public int writeToBuffer(ByteBuffer buffer)
+    {
+
+        if(!_complete && buffer.hasRemaining())
+        {
+            buffer.put((byte)0x40);
+            _complete = true;
+        }
+
+        return 1;
+    }
+
+    public void setValue(Void frameBody)
+    {
+        _complete = false;
+    }
+
+    public boolean isCacheable()
+    {
+        return true;
+    }
+
+    public boolean isComplete()
+    {
+        return _complete;
+    }
+
+    private static Factory<Void> FACTORY = new Factory<Void>()
+                                            {
+
+                                                public ValueWriter<Void> newInstance(Registry registry)
+                                                {
+                                                    return new NullWriter();
+                                                }
+                                            };
+
+    public static void register(ValueWriter.Registry registry)
+    {
+        registry.register(Void.TYPE, FACTORY);
+    }
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/NullWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHandler.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHandler.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHandler.java Sun Mar 17 18:03:37 2013
@@ -1,30 +1,30 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.nio.ByteBuffer;
-
-public interface ProtocolHandler
-{
-    ProtocolHandler parse(ByteBuffer in);
-
-    boolean isDone();
-}
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.nio.ByteBuffer;
+
+public interface ProtocolHandler
+{
+    ProtocolHandler parse(ByteBuffer in);
+
+    boolean isDone();
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHeaderHandler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHeaderHandler.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHeaderHandler.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHeaderHandler.java Sun Mar 17 18:03:37 2013
@@ -1,146 +1,146 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.framing.AMQPProtocolHeaderHandler;
-import org.apache.qpid.amqp_1_0.framing.SASLProtocolHeaderHandler;
-
-import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
-
-import java.nio.ByteBuffer;
-
-public class ProtocolHeaderHandler implements ProtocolHandler
-{
-    private final ConnectionEndpoint _connection;
-    private ProtocolHandler[] _protocolHandlers = new ProtocolHandler[4];
-    private boolean _done;
-
-    enum State {
-        AWAITING_A,
-        AWAITING_M,
-        AWAITING_Q,
-        AWAITING_P,
-        AWAITING_PROTOCOL_ID,
-        ERROR
-    }
-
-    private State _state = State.AWAITING_A;
-
-    public ProtocolHeaderHandler(final ConnectionEndpoint connection)
-    {
-        _connection = connection;
-        _protocolHandlers[0] = new AMQPProtocolHeaderHandler(connection);
-        _protocolHandlers[1] = null ; // historic apache.qpid.amqp_1_0
-        _protocolHandlers[2] = null ; // TLS
-        _protocolHandlers[3] = new SASLProtocolHeaderHandler(connection); // SASL
-
-
-    }
-
-    public ProtocolHandler parse(final ByteBuffer in)
-    {
-        if(!in.hasRemaining())
-        {
-            return this;
-        }
-
-        switch(_state)
-        {
-            case AWAITING_A:
-                if(transition(in, (byte)'A', State.AWAITING_M))
-                {
-                    break;
-                }
-            case AWAITING_M:
-                if(transition(in, (byte)'M', State.AWAITING_Q))
-                {
-                    break;
-                }
-            case AWAITING_Q:
-                if(transition(in, (byte)'Q', State.AWAITING_P))
-                {
-                    break;
-                }
-
-            case AWAITING_P:
-                if(transition(in, (byte)'P', State.AWAITING_PROTOCOL_ID))
-                {
-                    break;
-                }
-            case AWAITING_PROTOCOL_ID:
-                int protocolId = ((int) in.get()) & 0xff;
-                ProtocolHandler delegate;
-
-                try
-                {
-                    delegate = _protocolHandlers[protocolId];
-                }
-                catch(IndexOutOfBoundsException e)
-                {
-                    delegate = null;
-                }
-
-                if(delegate == null)
-                {
-                    _state = State.ERROR;
-                }
-                else
-                {
-                    return delegate.parse(in);
-                }
-        }
-        if(_state == State.ERROR)
-        {
-            _connection.invalidHeaderReceived();
-            _done = true;
-        }
-        return this;
-
-    }
-
-    boolean transition(ByteBuffer in, byte expected, State next)
-    {
-        byte b = in.get();
-        if(b == expected)
-        {
-            if(!in.hasRemaining())
-            {
-                _state =  next;
-                return true;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        else
-        {
-            _state = State.ERROR;
-            return true;
-        }
-    }
-
-
-    public boolean isDone()
-    {
-        return _done;
-    }
-}
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.framing.AMQPProtocolHeaderHandler;
+import org.apache.qpid.amqp_1_0.framing.SASLProtocolHeaderHandler;
+
+import org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint;
+
+import java.nio.ByteBuffer;
+
+public class ProtocolHeaderHandler implements ProtocolHandler
+{
+    private final ConnectionEndpoint _connection;
+    private ProtocolHandler[] _protocolHandlers = new ProtocolHandler[4];
+    private boolean _done;
+
+    enum State {
+        AWAITING_A,
+        AWAITING_M,
+        AWAITING_Q,
+        AWAITING_P,
+        AWAITING_PROTOCOL_ID,
+        ERROR
+    }
+
+    private State _state = State.AWAITING_A;
+
+    public ProtocolHeaderHandler(final ConnectionEndpoint connection)
+    {
+        _connection = connection;
+        _protocolHandlers[0] = new AMQPProtocolHeaderHandler(connection);
+        _protocolHandlers[1] = null ; // historic apache.qpid.amqp_1_0
+        _protocolHandlers[2] = null ; // TLS
+        _protocolHandlers[3] = new SASLProtocolHeaderHandler(connection); // SASL
+
+
+    }
+
+    public ProtocolHandler parse(final ByteBuffer in)
+    {
+        if(!in.hasRemaining())
+        {
+            return this;
+        }
+
+        switch(_state)
+        {
+            case AWAITING_A:
+                if(transition(in, (byte)'A', State.AWAITING_M))
+                {
+                    break;
+                }
+            case AWAITING_M:
+                if(transition(in, (byte)'M', State.AWAITING_Q))
+                {
+                    break;
+                }
+            case AWAITING_Q:
+                if(transition(in, (byte)'Q', State.AWAITING_P))
+                {
+                    break;
+                }
+
+            case AWAITING_P:
+                if(transition(in, (byte)'P', State.AWAITING_PROTOCOL_ID))
+                {
+                    break;
+                }
+            case AWAITING_PROTOCOL_ID:
+                int protocolId = ((int) in.get()) & 0xff;
+                ProtocolHandler delegate;
+
+                try
+                {
+                    delegate = _protocolHandlers[protocolId];
+                }
+                catch(IndexOutOfBoundsException e)
+                {
+                    delegate = null;
+                }
+
+                if(delegate == null)
+                {
+                    _state = State.ERROR;
+                }
+                else
+                {
+                    return delegate.parse(in);
+                }
+        }
+        if(_state == State.ERROR)
+        {
+            _connection.invalidHeaderReceived();
+            _done = true;
+        }
+        return this;
+
+    }
+
+    boolean transition(ByteBuffer in, byte expected, State next)
+    {
+        byte b = in.get();
+        if(b == expected)
+        {
+            if(!in.hasRemaining())
+            {
+                _state =  next;
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else
+        {
+            _state = State.ERROR;
+            return true;
+        }
+    }
+
+
+    public boolean isDone()
+    {
+        return _done;
+    }
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ProtocolHeaderHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/RestrictedTypeValueWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/RestrictedTypeValueWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/RestrictedTypeValueWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/RestrictedTypeValueWriter.java Sun Mar 17 18:03:37 2013
@@ -1,55 +1,55 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.RestrictedType;
-
-public class RestrictedTypeValueWriter<V> extends DelegatingValueWriter<RestrictedType<V>>
-{
-    public RestrictedTypeValueWriter(final Registry registry)
-    {
-        super(registry);
-    }
-
-    @Override
-    protected Object getUnderlyingValue(final RestrictedType<V> restrictedType)
-    {
-        return restrictedType.getValue();
-    }
-
-    private static Factory FACTORY = new Factory()
-    {
-
-        public ValueWriter newInstance(Registry registry)
-        {
-            return new RestrictedTypeValueWriter(registry);
-        }
-    };
-
-    public boolean isCacheable()
-    {
-        return true;
-    }
-
-    public static void register(ValueWriter.Registry registry, Class clazz)
-    {
-        registry.register(clazz, FACTORY);
-    }}
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.RestrictedType;
+
+public class RestrictedTypeValueWriter<V> extends DelegatingValueWriter<RestrictedType<V>>
+{
+    public RestrictedTypeValueWriter(final Registry registry)
+    {
+        super(registry);
+    }
+
+    @Override
+    protected Object getUnderlyingValue(final RestrictedType<V> restrictedType)
+    {
+        return restrictedType.getValue();
+    }
+
+    private static Factory FACTORY = new Factory()
+    {
+
+        public ValueWriter newInstance(Registry registry)
+        {
+            return new RestrictedTypeValueWriter(registry);
+        }
+    };
+
+    public boolean isCacheable()
+    {
+        return true;
+    }
+
+    public static void register(ValueWriter.Registry registry, Class clazz)
+    {
+        registry.register(clazz, FACTORY);
+    }}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/RestrictedTypeValueWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortTypeConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortTypeConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortTypeConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortTypeConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,58 +1,58 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.*;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-
-import java.nio.ByteBuffer;
-
-public class ShortTypeConstructor implements TypeConstructor
-{
-    private static final ShortTypeConstructor INSTANCE = new ShortTypeConstructor();
-
-
-    public static ShortTypeConstructor getInstance()
-    {
-        return INSTANCE;
-    }
-
-    private ShortTypeConstructor()
-    {
-    }
-
-    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
-    {
-        if(in.remaining()>=2)
-        {
-            return in.getShort();
-        }
-        else
-        {
-            org.apache.qpid.amqp_1_0.type.transport.Error error = new org.apache.qpid.amqp_1_0.type.transport.Error();
-            error.setCondition(ConnectionError.FRAMING_ERROR);
-            error.setDescription("Cannot construct short: insufficient input data");
-            throw new AmqpErrorException(error);
-
-        }
-    }
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.*;
+import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
+
+import java.nio.ByteBuffer;
+
+public class ShortTypeConstructor implements TypeConstructor
+{
+    private static final ShortTypeConstructor INSTANCE = new ShortTypeConstructor();
+
+
+    public static ShortTypeConstructor getInstance()
+    {
+        return INSTANCE;
+    }
+
+    private ShortTypeConstructor()
+    {
+    }
+
+    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
+    {
+        if(in.remaining()>=2)
+        {
+            return in.getShort();
+        }
+        else
+        {
+            org.apache.qpid.amqp_1_0.type.transport.Error error = new org.apache.qpid.amqp_1_0.type.transport.Error();
+            error.setCondition(ConnectionError.FRAMING_ERROR);
+            error.setDescription("Cannot construct short: insufficient input data");
+            throw new AmqpErrorException(error);
+
+        }
+    }
+
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortTypeConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortWriter.java Sun Mar 17 18:03:37 2013
@@ -1,55 +1,55 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-public class ShortWriter extends FixedTwoWriter<Short>
-{
-
-    private static final byte FORMAT_CODE = (byte)0x61;
-
-
-    @Override
-    short convertValueToShort(Short value)
-    {
-        return value.shortValue();
-    }
-
-    @Override
-    byte getFormatCode()
-    {
-        return FORMAT_CODE;
-    }
-
-    private static Factory<Short> FACTORY = new Factory<Short>()
-                                            {
-
-                                                public ValueWriter<Short> newInstance(Registry registry)
-                                                {
-                                                    return new ShortWriter();
-                                                }
-                                            };
-
-    public static void register(ValueWriter.Registry registry)
-    {
-        registry.register(Short.class, FACTORY);
-    }
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+public class ShortWriter extends FixedTwoWriter<Short>
+{
+
+    private static final byte FORMAT_CODE = (byte)0x61;
+
+
+    @Override
+    short convertValueToShort(Short value)
+    {
+        return value.shortValue();
+    }
+
+    @Override
+    byte getFormatCode()
+    {
+        return FORMAT_CODE;
+    }
+
+    private static Factory<Short> FACTORY = new Factory<Short>()
+                                            {
+
+                                                public ValueWriter<Short> newInstance(Registry registry)
+                                                {
+                                                    return new ShortWriter();
+                                                }
+                                            };
+
+    public static void register(ValueWriter.Registry registry)
+    {
+        registry.register(Short.class, FACTORY);
+    }
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/ShortWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SimpleVariableWidthWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SimpleVariableWidthWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SimpleVariableWidthWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SimpleVariableWidthWriter.java Sun Mar 17 18:03:37 2013
@@ -1,68 +1,68 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.nio.ByteBuffer;
-
-public abstract class SimpleVariableWidthWriter<V> extends VariableWidthWriter<V>
-{
-    private byte[] _buf;
-
-
-    public void setValue(V value)
-    {
-        _buf = getByteArray(value);
-        super.setValue(value);
-    }
-
-    protected int getLength()
-    {
-        return _buf.length;
-    }
-
-    protected void writeBytes(ByteBuffer buf, int offset, int length)
-    {
-        buf.put(_buf, getOffset()+offset, length);
-    }
-
-    @Override
-    protected void clearValue()
-    {
-        _buf = null;
-    }
-
-    @Override
-    protected boolean hasValue()
-    {
-        return _buf != null;
-    }
-
-    public boolean isCacheable()
-    {
-        return true;
-    }
-
-    protected abstract byte[] getByteArray(V value);
-
-    protected abstract int getOffset();
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.nio.ByteBuffer;
+
+public abstract class SimpleVariableWidthWriter<V> extends VariableWidthWriter<V>
+{
+    private byte[] _buf;
+
+
+    public void setValue(V value)
+    {
+        _buf = getByteArray(value);
+        super.setValue(value);
+    }
+
+    protected int getLength()
+    {
+        return _buf.length;
+    }
+
+    protected void writeBytes(ByteBuffer buf, int offset, int length)
+    {
+        buf.put(_buf, getOffset()+offset, length);
+    }
+
+    @Override
+    protected void clearValue()
+    {
+        _buf = null;
+    }
+
+    @Override
+    protected boolean hasValue()
+    {
+        return _buf != null;
+    }
+
+    public boolean isCacheable()
+    {
+        return true;
+    }
+
+    protected abstract byte[] getByteArray(V value);
+
+    protected abstract int getOffset();
+
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SimpleVariableWidthWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallIntConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallIntConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallIntConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallIntConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-import java.nio.ByteBuffer;
-
-public class SmallIntConstructor implements TypeConstructor
-{
-    private static final SmallIntConstructor INSTANCE = new SmallIntConstructor();
-
-
-    public static SmallIntConstructor getInstance()
-    {
-        return INSTANCE;
-    }
-
-    private SmallIntConstructor()
-    {
-    }
-
-    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
-    {
-        if(in.hasRemaining())
-        {
-            byte b = in.get();
-            return (int) b;
-        }
-        else
-        {
-            Error error = new Error();
-            error.setCondition(ConnectionError.FRAMING_ERROR);
-            error.setDescription("Cannot construct int: insufficient input data");
-            throw new AmqpErrorException(error);
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
+import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
+
+import java.nio.ByteBuffer;
+
+public class SmallIntConstructor implements TypeConstructor
+{
+    private static final SmallIntConstructor INSTANCE = new SmallIntConstructor();
+
+
+    public static SmallIntConstructor getInstance()
+    {
+        return INSTANCE;
+    }
+
+    private SmallIntConstructor()
+    {
+    }
+
+    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
+    {
+        if(in.hasRemaining())
+        {
+            byte b = in.get();
+            return (int) b;
+        }
+        else
+        {
+            Error error = new Error();
+            error.setCondition(ConnectionError.FRAMING_ERROR);
+            error.setDescription("Cannot construct int: insufficient input data");
+            throw new AmqpErrorException(error);
+        }
+    }
+
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallIntConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallLongConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallLongConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallLongConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallLongConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-import java.nio.ByteBuffer;
-
-public class SmallLongConstructor implements TypeConstructor
-{
-    private static final SmallLongConstructor INSTANCE = new SmallLongConstructor();
-
-
-    public static SmallLongConstructor getInstance()
-    {
-        return INSTANCE;
-    }
-
-    private SmallLongConstructor()
-    {
-    }
-
-    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
-    {
-        if(in.hasRemaining())
-        {
-            byte b = in.get();
-            return (long) b;
-        }
-        else
-        {
-            Error error = new Error();
-            error.setCondition(ConnectionError.FRAMING_ERROR);
-            error.setDescription("Cannot construct long: insufficient input data");
-            throw new AmqpErrorException(error);
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
+import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
+
+import java.nio.ByteBuffer;
+
+public class SmallLongConstructor implements TypeConstructor
+{
+    private static final SmallLongConstructor INSTANCE = new SmallLongConstructor();
+
+
+    public static SmallLongConstructor getInstance()
+    {
+        return INSTANCE;
+    }
+
+    private SmallLongConstructor()
+    {
+    }
+
+    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
+    {
+        if(in.hasRemaining())
+        {
+            byte b = in.get();
+            return (long) b;
+        }
+        else
+        {
+            Error error = new Error();
+            error.setCondition(ConnectionError.FRAMING_ERROR);
+            error.setDescription("Cannot construct long: insufficient input data");
+            throw new AmqpErrorException(error);
+        }
+    }
+
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallLongConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallUIntConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallUIntConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallUIntConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallUIntConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
-import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-import java.nio.ByteBuffer;
-
-public class SmallUIntConstructor implements TypeConstructor
-{
-    private static final SmallUIntConstructor INSTANCE = new SmallUIntConstructor();
-
-
-    public static SmallUIntConstructor getInstance()
-    {
-        return INSTANCE;
-    }
-
-    private SmallUIntConstructor()
-    {
-    }
-
-    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
-    {
-        if(in.hasRemaining())
-        {
-            byte b = in.get();
-            return UnsignedInteger.valueOf(((int) b) & 0xff);
-        }
-        else
-        {
-            Error error = new Error();
-            error.setCondition(ConnectionError.FRAMING_ERROR);
-            error.setDescription("Cannot construct uint: insufficient input data");
-            throw new AmqpErrorException(error);
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
+import org.apache.qpid.amqp_1_0.type.UnsignedInteger;
+import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
+
+import java.nio.ByteBuffer;
+
+public class SmallUIntConstructor implements TypeConstructor
+{
+    private static final SmallUIntConstructor INSTANCE = new SmallUIntConstructor();
+
+
+    public static SmallUIntConstructor getInstance()
+    {
+        return INSTANCE;
+    }
+
+    private SmallUIntConstructor()
+    {
+    }
+
+    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
+    {
+        if(in.hasRemaining())
+        {
+            byte b = in.get();
+            return UnsignedInteger.valueOf(((int) b) & 0xff);
+        }
+        else
+        {
+            Error error = new Error();
+            error.setCondition(ConnectionError.FRAMING_ERROR);
+            error.setDescription("Cannot construct uint: insufficient input data");
+            throw new AmqpErrorException(error);
+        }
+    }
+
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallUIntConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallULongConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallULongConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallULongConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallULongConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
-import org.apache.qpid.amqp_1_0.type.UnsignedLong;
-import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
-import org.apache.qpid.amqp_1_0.type.transport.Error;
-
-import java.nio.ByteBuffer;
-
-public class SmallULongConstructor implements TypeConstructor
-{
-    private static final SmallULongConstructor INSTANCE = new SmallULongConstructor();
-
-
-    public static SmallULongConstructor getInstance()
-    {
-        return INSTANCE;
-    }
-
-    private SmallULongConstructor()
-    {
-    }
-
-    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
-    {
-        if(in.hasRemaining())
-        {
-            byte b = in.get();
-            return UnsignedLong.valueOf(((long) b) & 0xffL);
-        }
-        else
-        {
-            Error error = new Error();
-            error.setCondition(ConnectionError.FRAMING_ERROR);
-            error.setDescription("Cannot construct ulong: insufficient input data");
-            throw new AmqpErrorException(error);
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
+import org.apache.qpid.amqp_1_0.type.UnsignedLong;
+import org.apache.qpid.amqp_1_0.type.transport.ConnectionError;
+import org.apache.qpid.amqp_1_0.type.transport.Error;
+
+import java.nio.ByteBuffer;
+
+public class SmallULongConstructor implements TypeConstructor
+{
+    private static final SmallULongConstructor INSTANCE = new SmallULongConstructor();
+
+
+    public static SmallULongConstructor getInstance()
+    {
+        return INSTANCE;
+    }
+
+    private SmallULongConstructor()
+    {
+    }
+
+    public Object construct(final ByteBuffer in, ValueHandler handler) throws AmqpErrorException
+    {
+        if(in.hasRemaining())
+        {
+            byte b = in.get();
+            return UnsignedLong.valueOf(((long) b) & 0xffL);
+        }
+        else
+        {
+            Error error = new Error();
+            error.setCondition(ConnectionError.FRAMING_ERROR);
+            error.setDescription("Cannot construct ulong: insufficient input data");
+            throw new AmqpErrorException(error);
+        }
+    }
+
+}

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SmallULongConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringTypeConstructor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringTypeConstructor.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringTypeConstructor.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringTypeConstructor.java Sun Mar 17 18:03:37 2013
@@ -1,132 +1,132 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.amqp_1_0.codec;
-
-import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class StringTypeConstructor extends VariableWidthTypeConstructor
-{
-    private Charset _charSet;
-
-    private BinaryString _defaultBinaryString = new BinaryString();
-    private ValueCache<BinaryString, String> _cachedValues = new ValueCache<BinaryString, String>(10);
-
-    private static final class ValueCache<K,V> extends LinkedHashMap<K,V>
-    {
-        private final int _cacheSize;
-
-        public ValueCache(int cacheSize)
-        {
-            _cacheSize = cacheSize;
-        }
-
-        @Override
-        protected boolean removeEldestEntry(Map.Entry<K, V> eldest)
-        {
-            return size() > _cacheSize;
-        }
-
-        public boolean isFull()
-        {
-            return size() == _cacheSize;
-        }
-    }
-
-
-    public static StringTypeConstructor getInstance(int i, Charset c)
-    {
-        return new StringTypeConstructor(i, c);
-    }
-
-
-    private StringTypeConstructor(int size, Charset c)
-    {
-        super(size);
-        _charSet = c;
-    }
-
-    @Override
-    public Object construct(final ByteBuffer in, boolean isCopy, ValueHandler handler) throws AmqpErrorException
-    {
-        int size;
-
-        if(getSize() == 1)
-        {
-            size = in.get() & 0xFF;
-        }
-        else
-        {
-            size = in.getInt();
-        }
-
-        int origPosition = in.position();
-        _defaultBinaryString.setData(in.array(), in.arrayOffset()+ origPosition, size);
-
-        BinaryString binaryStr = _defaultBinaryString;
-
-        boolean isFull = _cachedValues.isFull();
-
-        String str = isFull ? _cachedValues.remove(binaryStr) : _cachedValues.get(binaryStr);
-
-        if(str == null)
-        {
-
-            ByteBuffer dup = in.duplicate();
-            try
-            {
-                dup.limit(dup.position()+size);
-            }
-            catch(IllegalArgumentException e)
-            {
-                throw new IllegalArgumentException("position: " + dup.position() + "size: " + size + " capacity: " + dup.capacity());
-            }
-            CharBuffer charBuf = _charSet.decode(dup);
-
-            str = charBuf.toString();
-
-            byte[] data = new byte[size];
-            in.get(data);
-            binaryStr = new BinaryString(data, 0, size);
-
-            _cachedValues.put(binaryStr, str);
-        }
-        else if(isFull)
-        {
-            byte[] data = new byte[size];
-            in.get(data);
-            binaryStr = new BinaryString(data, 0, size);
-
-            _cachedValues.put(binaryStr, str);
-        }
-
-        in.position(origPosition+size);
-
-        return str;
-
-    }
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.amqp_1_0.codec;
+
+import org.apache.qpid.amqp_1_0.type.AmqpErrorException;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class StringTypeConstructor extends VariableWidthTypeConstructor
+{
+    private Charset _charSet;
+
+    private BinaryString _defaultBinaryString = new BinaryString();
+    private ValueCache<BinaryString, String> _cachedValues = new ValueCache<BinaryString, String>(10);
+
+    private static final class ValueCache<K,V> extends LinkedHashMap<K,V>
+    {
+        private final int _cacheSize;
+
+        public ValueCache(int cacheSize)
+        {
+            _cacheSize = cacheSize;
+        }
+
+        @Override
+        protected boolean removeEldestEntry(Map.Entry<K, V> eldest)
+        {
+            return size() > _cacheSize;
+        }
+
+        public boolean isFull()
+        {
+            return size() == _cacheSize;
+        }
+    }
+
+
+    public static StringTypeConstructor getInstance(int i, Charset c)
+    {
+        return new StringTypeConstructor(i, c);
+    }
+
+
+    private StringTypeConstructor(int size, Charset c)
+    {
+        super(size);
+        _charSet = c;
+    }
+
+    @Override
+    public Object construct(final ByteBuffer in, boolean isCopy, ValueHandler handler) throws AmqpErrorException
+    {
+        int size;
+
+        if(getSize() == 1)
+        {
+            size = in.get() & 0xFF;
+        }
+        else
+        {
+            size = in.getInt();
+        }
+
+        int origPosition = in.position();
+        _defaultBinaryString.setData(in.array(), in.arrayOffset()+ origPosition, size);
+
+        BinaryString binaryStr = _defaultBinaryString;
+
+        boolean isFull = _cachedValues.isFull();
+
+        String str = isFull ? _cachedValues.remove(binaryStr) : _cachedValues.get(binaryStr);
+
+        if(str == null)
+        {
+
+            ByteBuffer dup = in.duplicate();
+            try
+            {
+                dup.limit(dup.position()+size);
+            }
+            catch(IllegalArgumentException e)
+            {
+                throw new IllegalArgumentException("position: " + dup.position() + "size: " + size + " capacity: " + dup.capacity());
+            }
+            CharBuffer charBuf = _charSet.decode(dup);
+
+            str = charBuf.toString();
+
+            byte[] data = new byte[size];
+            in.get(data);
+            binaryStr = new BinaryString(data, 0, size);
+
+            _cachedValues.put(binaryStr, str);
+        }
+        else if(isFull)
+        {
+            byte[] data = new byte[size];
+            in.get(data);
+            binaryStr = new BinaryString(data, 0, size);
+
+            _cachedValues.put(binaryStr, str);
+        }
+
+        in.position(origPosition+size);
+
+        return str;
+
+    }
+
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringTypeConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringWriter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringWriter.java?rev=1457505&r1=1457504&r2=1457505&view=diff
==============================================================================
--- qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringWriter.java (original)
+++ qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringWriter.java Sun Mar 17 18:03:37 2013
@@ -1,146 +1,146 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.qpid.amqp_1_0.codec;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class StringWriter extends SimpleVariableWidthWriter<String>
-{
-    private static final Charset ENCODING_CHARSET;
-    private static final byte ONE_BYTE_CODE;
-    private static final byte FOUR_BYTE_CODE;
-    static
-    {
-        Charset defaultCharset = Charset.defaultCharset();
-        if(defaultCharset.name().equals("UTF-16") || defaultCharset.name().equals("UTF-16BE"))
-        {
-            ENCODING_CHARSET = defaultCharset;
-            ONE_BYTE_CODE = (byte) 0xa2;
-            FOUR_BYTE_CODE = (byte) 0xb2;
-        }
-        else
-        {
-            ENCODING_CHARSET = Charset.forName("UTF-8");
-            ONE_BYTE_CODE = (byte) 0xa1;
-            FOUR_BYTE_CODE = (byte) 0xb1;
-        }
-    }
-
-    private static final class ValueCache<K,V> extends LinkedHashMap<K,V>
-    {
-        private final int _cacheSize;
-
-        public ValueCache(int cacheSize)
-        {
-            _cacheSize = cacheSize;
-        }
-
-        @Override
-        protected boolean removeEldestEntry(Map.Entry<K, V> eldest)
-        {
-            return size() > _cacheSize;
-        }
-
-        public boolean isFull()
-        {
-            return size() == _cacheSize;
-        }
-    }
-
-    private final ValueCache<String, byte[]> _cachedEncodings = new ValueCache<String, byte[]>(10);
-
-
-    @Override
-    protected byte getFourOctetEncodingCode()
-    {
-        return FOUR_BYTE_CODE;
-    }
-
-    @Override
-    protected byte getSingleOctetEncodingCode()
-    {
-        return ONE_BYTE_CODE;
-    }
-
-    @Override
-    protected byte[] getByteArray(String value)
-    {
-
-        byte[] encoding;
-        boolean isFull = _cachedEncodings.isFull();
-        if(isFull)
-        {
-            encoding = _cachedEncodings.remove(value);
-        }
-        else
-        {
-            encoding = _cachedEncodings.get(value);
-        }
-
-
-        if(encoding == null)
-        {
-            ByteBuffer buf = ENCODING_CHARSET.encode(value);
-            if(buf.hasArray() && buf.arrayOffset() == 0 && buf.limit()==buf.capacity())
-            {
-                encoding = buf.array();
-            }
-            else
-            {
-                byte[] bufArray = new byte[buf.limit()-buf.position()];
-                buf.get(bufArray);
-                encoding = bufArray;
-            }
-            _cachedEncodings.put(value,encoding);
-
-        }
-        else if(isFull)
-        {
-            _cachedEncodings.put(value,encoding);
-        }
-
-        return encoding;
-    }
-
-    @Override
-    protected int getOffset()
-    {
-        return 0;
-    }
-
-    private static Factory<String> FACTORY = new Factory<String>()
-                                            {
-
-                                                public ValueWriter<String> newInstance(Registry registry)
-                                                {
-                                                    return new StringWriter();
-                                                }
-                                            };
-
-    public static void register(ValueWriter.Registry registry)
-    {
-        registry.register(String.class, FACTORY);
-    }
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.amqp_1_0.codec;
+
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class StringWriter extends SimpleVariableWidthWriter<String>
+{
+    private static final Charset ENCODING_CHARSET;
+    private static final byte ONE_BYTE_CODE;
+    private static final byte FOUR_BYTE_CODE;
+    static
+    {
+        Charset defaultCharset = Charset.defaultCharset();
+        if(defaultCharset.name().equals("UTF-16") || defaultCharset.name().equals("UTF-16BE"))
+        {
+            ENCODING_CHARSET = defaultCharset;
+            ONE_BYTE_CODE = (byte) 0xa2;
+            FOUR_BYTE_CODE = (byte) 0xb2;
+        }
+        else
+        {
+            ENCODING_CHARSET = Charset.forName("UTF-8");
+            ONE_BYTE_CODE = (byte) 0xa1;
+            FOUR_BYTE_CODE = (byte) 0xb1;
+        }
+    }
+
+    private static final class ValueCache<K,V> extends LinkedHashMap<K,V>
+    {
+        private final int _cacheSize;
+
+        public ValueCache(int cacheSize)
+        {
+            _cacheSize = cacheSize;
+        }
+
+        @Override
+        protected boolean removeEldestEntry(Map.Entry<K, V> eldest)
+        {
+            return size() > _cacheSize;
+        }
+
+        public boolean isFull()
+        {
+            return size() == _cacheSize;
+        }
+    }
+
+    private final ValueCache<String, byte[]> _cachedEncodings = new ValueCache<String, byte[]>(10);
+
+
+    @Override
+    protected byte getFourOctetEncodingCode()
+    {
+        return FOUR_BYTE_CODE;
+    }
+
+    @Override
+    protected byte getSingleOctetEncodingCode()
+    {
+        return ONE_BYTE_CODE;
+    }
+
+    @Override
+    protected byte[] getByteArray(String value)
+    {
+
+        byte[] encoding;
+        boolean isFull = _cachedEncodings.isFull();
+        if(isFull)
+        {
+            encoding = _cachedEncodings.remove(value);
+        }
+        else
+        {
+            encoding = _cachedEncodings.get(value);
+        }
+
+
+        if(encoding == null)
+        {
+            ByteBuffer buf = ENCODING_CHARSET.encode(value);
+            if(buf.hasArray() && buf.arrayOffset() == 0 && buf.limit()==buf.capacity())
+            {
+                encoding = buf.array();
+            }
+            else
+            {
+                byte[] bufArray = new byte[buf.limit()-buf.position()];
+                buf.get(bufArray);
+                encoding = bufArray;
+            }
+            _cachedEncodings.put(value,encoding);
+
+        }
+        else if(isFull)
+        {
+            _cachedEncodings.put(value,encoding);
+        }
+
+        return encoding;
+    }
+
+    @Override
+    protected int getOffset()
+    {
+        return 0;
+    }
+
+    private static Factory<String> FACTORY = new Factory<String>()
+                                            {
+
+                                                public ValueWriter<String> newInstance(Registry registry)
+                                                {
+                                                    return new StringWriter();
+                                                }
+                                            };
+
+    public static void register(ValueWriter.Registry registry)
+    {
+        registry.register(String.class, FACTORY);
+    }
 }
\ No newline at end of file

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/StringWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: qpid/trunk/qpid/java/amqp-1-0-common/src/main/java/org/apache/qpid/amqp_1_0/codec/SymbolArrayWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org