summaryrefslogtreecommitdiff
path: root/java/common/src
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-08-05 20:04:55 +0000
committerRafael H. Schloming <rhs@apache.org>2008-08-05 20:04:55 +0000
commit7a3eb589b3973522771c2b40b3ba89ac9cbfdb14 (patch)
treeccff1b31d71be160a9d6e1ae63c9f7659510c534 /java/common/src
parent2c5100e6829529ea0df4463c5d914d613e45c1c8 (diff)
downloadqpid-python-7a3eb589b3973522771c2b40b3ba89ac9cbfdb14.tar.gz
QPID-1219: cleanup of prior commit (r682887)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@682915 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/codec/Validator.java177
-rw-r--r--java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java11
2 files changed, 6 insertions, 182 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/transport/codec/Validator.java b/java/common/src/main/java/org/apache/qpid/transport/codec/Validator.java
deleted file mode 100644
index c1d30eacc3..0000000000
--- a/java/common/src/main/java/org/apache/qpid/transport/codec/Validator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.transport.codec;
-
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.qpid.transport.RangeSet;
-import org.apache.qpid.transport.Struct;
-
-
-/**
- * Validator
- *
- */
-
-public class Validator
-{
-
- public static final void checkBit(boolean b)
- {
- // no illegal values
- }
-
- public static final void checkUint8(short s)
- {
- if (s > 0xFF || s < 0)
- {
- throw new IllegalArgumentException("" + s);
- }
- }
-
- public static final void checkUint16(int i)
- {
- if (i > 0xFFFF || i < 0)
- {
- throw new IllegalArgumentException("" + i);
- }
- }
-
- public static final void checkUint32(long l)
- {
- // XXX: we can't currently validate this because we do thinks
- // like pass in -1 for 0xFFFFFFFF
- // if (l > 0xFFFFFFFFL || l < 0)
- // {
- // throw new IllegalArgumentException("" + l);
- // }
- }
-
- public static final void checkSequenceNo(int s)
- {
- // no illegal values
- }
-
- public static final void checkUint64(long l)
- {
- // no illegal values
- }
-
- public static final void checkDatetime(long l)
- {
- // no illegal values
- }
-
- public static final void checkUuid(UUID u)
- {
- // no illegal values
- }
-
- public static final void checkStr8(String value)
- {
- if (value != null && value.length() > 255)
- {
- throw new IllegalArgumentException("" + value);
- }
- }
-
- public static final void checkStr16(String value)
- {
- if (value != null && value.length() > 0xFFFF)
- {
- throw new IllegalArgumentException("" + value);
- }
- }
-
- public static final void checkVbin8(byte[] value)
- {
- if (value != null && value.length > 255)
- {
- throw new IllegalArgumentException("" + value);
- }
- }
-
- public static final void checkVbin16(byte[] value)
- {
- if (value != null && value.length > 0xFFFF)
- {
- throw new IllegalArgumentException("" + value);
- }
- }
-
- public static final void checkByteRanges(RangeSet r)
- {
- // no illegal values
- }
-
- public static final void checkSequenceSet(RangeSet r)
- {
- // no illegal values
- }
-
- public static final void checkVbin32(byte[] value)
- {
- // no illegal values
- }
-
- public static final void checkStruct32(Struct s)
- {
- // no illegal values
- }
-
- public static final void checkArray(List<Object> array)
- {
- if (array == null)
- {
- return;
- }
-
- for (Object o : array)
- {
- checkObject(o);
- }
- }
-
- public static final void checkMap(Map<String,Object> map)
- {
- if (map == null || map.isEmpty())
- {
- return;
- }
-
- for (Map.Entry<String,Object> entry : map.entrySet())
- {
- checkStr8(entry.getKey());
- checkObject(entry.getValue());
- }
- }
-
- public static final void checkObject(Object o)
- {
- if (o != null && AbstractEncoder.resolve(o.getClass()) == null)
- {
- throw new IllegalArgumentException("cannot encode " + o.getClass());
- }
- }
-
-}
diff --git a/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java b/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
index 444c7d3f14..007167115b 100644
--- a/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
+++ b/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
@@ -119,12 +119,13 @@ public final class Disassembler implements Sender<ProtocolEvent>,
}
private void fragment(byte flags, SegmentType type, ProtocolEvent event,
- ByteBuffer buf, boolean first, boolean last)
+ ByteBuffer buf)
{
byte typeb = (byte) type.getValue();
byte track = event.getEncodedTrack() == Frame.L4 ? (byte) 1 : (byte) 0;
int remaining = buf.remaining();
+ boolean first = true;
while (true)
{
int size = min(maxPayload, remaining);
@@ -136,7 +137,7 @@ public final class Disassembler implements Sender<ProtocolEvent>,
newflags |= FIRST_FRAME;
first = false;
}
- if (last && remaining == 0)
+ if (remaining == 0)
{
newflags |= LAST_FRAME;
}
@@ -219,11 +220,11 @@ public final class Disassembler implements Sender<ProtocolEvent>,
synchronized (sendlock)
{
- fragment(flags, type, method, methodSeg, true, true);
+ fragment(flags, type, method, methodSeg);
if (payload)
{
- fragment((byte) 0x0, SegmentType.HEADER, method, headerSeg, true, true);
- fragment(LAST_SEG, SegmentType.BODY, method, method.getBody(), true, true);
+ fragment((byte) 0x0, SegmentType.HEADER, method, headerSeg);
+ fragment(LAST_SEG, SegmentType.BODY, method, method.getBody());
}
}
}