Update of /cvsroot/openamf/openamf/src/java/org/openamf/io
In directory sc8-pr-cvs1:/tmp/cvs-serv28953/src/java/org/openamf/io
Modified Files:
AMFDeserializer.java
Log Message:
added fix for Object ref's data type 7
Index: AMFDeserializer.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/io/AMFDeserializer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** AMFDeserializer.java 24 Apr 2003 22:48:43 -0000 1.13
--- AMFDeserializer.java 13 May 2003 17:56:15 -0000 1.14
***************
*** 19,23 ****
public class AMFDeserializer {
! protected static Log log = LogFactory.getLog(AMFDeserializer.class);
// The AMF input stream
--- 19,25 ----
public class AMFDeserializer {
! private static Log log = LogFactory.getLog(AMFDeserializer.class);
!
! private ArrayList storedObjects;
// The AMF input stream
***************
*** 45,52 ****
this.inputStream = inputStream;
// Read the binary header
! readHeader();
log.debug("readHeader");
// Read the binary body
! readBody();
log.debug("readBody");
}
--- 47,54 ----
this.inputStream = inputStream;
// Read the binary header
! readHeaders();
log.debug("readHeader");
// Read the binary body
! readBodies();
log.debug("readBody");
}
***************
*** 56,60 ****
}
! protected void readHeader() throws IOException {
// Ignore the first two bytes - version or something
inputStream.readUnsignedShort();
--- 58,62 ----
}
! protected void readHeaders() throws IOException {
// Ignore the first two bytes - version or something
inputStream.readUnsignedShort();
***************
*** 65,68 ****
--- 67,72 ----
// Loop over all the header elements
for (int i = 0; i < headerCount; i++) {
+ //clear storedObjects
+ storedObjects = new ArrayList();
String name = inputStream.readUTF();
// Find the must understand flag
***************
*** 79,83 ****
}
! protected void readBody() throws IOException {
// Find the total number of body elements
bodyCount = inputStream.readUnsignedShort();
--- 83,87 ----
}
! protected void readBodies() throws IOException {
// Find the total number of body elements
bodyCount = inputStream.readUnsignedShort();
***************
*** 86,89 ****
--- 90,95 ----
// Loop over all the body elements
for (int i = 0; i < bodyCount; i++) {
+ //clear storedObjects
+ storedObjects = new ArrayList();
String method = readString();
// The target that the client understands
***************
*** 122,125 ****
--- 128,134 ----
// Reads an object and converts the binary data into an ArrayList
protected ASObject readObject(ASObject aso) throws IOException {
+
+ storeObject(aso);
+
// Init the array
log.debug("reading object");
***************
*** 155,158 ****
--- 164,170 ----
// Init the array
ArrayList array = new ArrayList();
+
+ storeObject(array);
+
log.debug("reading array");
// Grab the length of the array
***************
*** 164,175 ****
// Grab the type for each element
byte type = inputStream.readByte();
- log.debug("type = " + type);
// Grab the element
array.add(readData(type));
}
// Return the data
return array;
}
protected double readNumber() throws IOException {
--- 176,192 ----
// Grab the type for each element
byte type = inputStream.readByte();
// Grab the element
array.add(readData(type));
}
+
// Return the data
return array;
}
+
+ private void storeObject(Object o) {
+ storedObjects.add(o);
+ log.debug("storedObjects.size: " + storedObjects.size());
+ }
protected double readNumber() throws IOException {
***************
*** 221,226 ****
}
! protected int readFlushedSO() throws IOException {
! return inputStream.readInt();
}
--- 238,245 ----
}
! protected Object readFlushedSO() throws IOException {
! int index = inputStream.readUnsignedShort();
! log.debug("Object Index: " + index);
! return storedObjects.get(index);
}
***************
*** 232,235 ****
--- 251,256 ----
Object data = null;
+ log.debug("Reding data of type: " + type);
+
switch (type) {
case AMFBody.DATA_TYPE_NUMBER :
***************
*** 249,253 ****
break;
case AMFBody.DATA_TYPE_FLUSHED_SHARED_OBJECT :
! data = new Integer(readFlushedSO());
break;
case AMFBody.DATA_TYPE_ARRAY_SHARED_OBJECT :
--- 270,274 ----
break;
case AMFBody.DATA_TYPE_FLUSHED_SHARED_OBJECT :
! data = readFlushedSO();
break;
case AMFBody.DATA_TYPE_ARRAY_SHARED_OBJECT :
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.