Hi,

> Rafael mentioned last night that AbastractDecoder does not know it so we 
> added another method i.e. readBin128() in AbstractDecoder.java (under 
> org.apache.qpidity.transport.codec) for decoding 16 bytes of opaque binary 
> data. It produced some unknown characters (e.g. output: Schema hash is: 
> �\�W�p�`؞??V�?) as schema hash is 
> an md5 digest and md5 hashes are binary data so in this case I was 
> converting to a string like this System.out.println("Schema hash is " + new 
> String(decoder.readBin128()));
> 
> So I converted this non printable characters to hex (with Rafael's advice 
> just to get rid off these some unknown character) by using 
> org.apache.qpidity.transport.util.Functions.str(decoder.readBin128()) 
> method. so the schema hash printed as (Schema is: 
> "\x85\x5c\xea\x96W\xe3p\xcc`\xd8\x9e\x1a\x08V\xa4\x0e")...
> 
> 1) I want to see the Schema hash in the correct way ? How would I print it?

I don't think you want to print the hash, you only need it for sending
further requests. So, the hash is only 16 bytes of opaque binary, that's
all. 

> -----
> 
> As i was ignoring what i was getting for "schema hash" field (hax value) 
> and moving on to next field... i.e. propCnt (properties content), i am 
> doing this
>   int propCnt = decoder.readUint16();
> System.out.println("Property content: " + propCnt);
> 
> for( int i = 0; i < propCnt; i++ )
> {
> Map<String,Object> map = decoder.readMap();
> printMap(map);
> }
>   public void printMap(Map mapnew)
> {
> Set s=mapnew.entrySet();
> Iterator it=s.iterator();
> for (Iterator iterator = s.iterator(); iterator.hasNext();) {
> Object object = (Object) iterator.next();
> System.out.println(object.toString());
> 
> }
>   
> BUT, getting an exception here
> A
> M
> 1
> s
> 15
> Package Name: qpid
> Class Name: vhost
> Schema is: "\x85\x5c\xea\x96W\xe3p\xcc`\xd8\x9e\x1a\x08V\xa4\x0e"
> Property content:   2
> code is : 6
> 
> Error reading messagejava.lang.IllegalArgumentException: unknown code: 6
>          at 
> org.apache.qpidity.transport.codec.AbstractDecoder.getType(AbstractDecoder.java:302)
>          at 
> org.apache.qpidity.transport.codec.AbstractDecoder.readMap(AbstractDecoder.java:253)
>       at apache.qpid.client.ListenerReply.onMessage(ListenerReply.java:109)
>          at 
> org.apache.qpidity.nclient.util.MessagePartListenerAdapter.messageReceived(MessagePartListenerAdapter.java:56)
>          at 
> org.apache.qpidity.nclient.impl.ClientSessionDelegate.data(ClientSessionDelegate.java:41)
>          at 
> org.apache.qpidity.transport.SessionDelegate.data(SessionDelegate.java:1)
>       at org.apache.qpidity.transport.Data.delegate(Data.java:78)
>       at org.apache.qpidity.transport.Channel.data(Channel.java:114)
>       at org.apache.qpidity.transport.Channel.data(Channel.java:1)
>       at org.apache.qpidity.transport.Data.delegate(Data.java:78)
>       at org.apache.qpidity.transport.Channel.received(Channel.java:75)
>       at org.apache.qpidity.transport.Connection.received(Connection.java:84)
>       at org.apache.qpidity.transport.Connection.received(Connection.java:1)
>       at 
> org.apache.qpidity.transport.network.Assembler.emit(Assembler.java:92)
>       at 
> org.apache.qpidity.transport.network.Assembler.emit(Assembler.java:97)
>       at 
> org.apache.qpidity.transport.network.Assembler.frame(Assembler.java:125)
>       at org.apache.qpidity.transport.network.Frame.delegate(Frame.java:145)
>          at 
> org.apache.qpidity.transport.network.Assembler.received(Assembler.java:102)
>          at 
> org.apache.qpidity.transport.network.Assembler.received(Assembler.java:1)
>          at 
> org.apache.qpidity.transport.network.InputHandler.frame(InputHandler.java:103)
>          at 
> org.apache.qpidity.transport.network.InputHandler.next(InputHandler.java:204)
>          at 
> org.apache.qpidity.transport.network.InputHandler.received(InputHandler.java:116)
>          at 
> org.apache.qpidity.transport.network.InputHandler.received(InputHandler.java:1)
>          at 
> org.apache.qpidity.transport.network.mina.MinaHandler.messageReceived(MinaHandler.java:87)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived(AbstractIoFilterChain.java:617)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
>          at 
> org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(AbstractIoFilterChain.java:353)
>          at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:281)
>          at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:241)
>          at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProcessor.java:44)
>          at 
> org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:559)
>          at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:43)
>       at java.lang.Thread.run(Thread.java:619)
> 
> 
> I have just an idea why it is raising but how to mitigate it I dont know.
> 
> 2) How to fix it? Can anyone help me?

Looking at http://cwiki.apache.org/qpid/management-design-notes.html,
the message format is as follows: 
        +-----+-----+-----+-----+-----------------------+
        | 'A' | 'M' | '1' | 's' |          seq          |
        +-----+-----+-----+-----+-----------------------+----------+
        |                packageName (short string)                |
        +----------------------------------------------------------+
        |                className (short string)                  |
        +----------------------------------------------------------+
        |                schema-hash (bin128)                      |
        +-----------+-----------+-----------+-----------+----------+
        | propCnt   | statCnt   | methodCnt | eventCnt  |
        
+-----------+-----------+-----------+-----------+----------------------------+
        | propCnt property records                                              
     |
        
+----------------------------------------------------------------------------+
        | statCnt statistic records                                             
     |
        
+----------------------------------------------------------------------------+
        | methodCnt method records                                              
     |
        
+----------------------------------------------------------------------------+
        | eventCnt event records                                                
     |
        
+----------------------------------------------------------------------------+

This means that you need to read propCnt, statCnt, methodCnt and then
eventCnt before you can read propCnt maps. statCnt maps, methodCnt maps
and then eventCnt maps. You are currently not reading statCnt, methodCnt
and eventCnt. 


Arnaud


Reply via email to