Buddy listing problem

Hi,

I have a problem listing the contact list…

this is my code :

private void RosterDisco(){

for (Iterator i = roster.getEntries(); i.hasNext(); ) {

entries = i.next().toString();

// System.out.println(entries);

//System.out.println(entries.substring(0, entries.indexOf(": ")));

contacts.add(new DefaultMutableTreeNode(this.getContacts()));

buddyList.setModel(new DefaultTreeModel(contacts));

}

}

private String getContacts(){

String name = new String(“No name”);

int indexEnd = entries.indexOf(":");

System.out.println(entries);

if( indexEnd > 0 ){

name = entries.substring(0, indexEnd);

}

else{

int i = -1;

if( i != entries.indexOf("%")){

name = entries.substring(0, entries.indexOf("%")) + “@” + entries.substring((entries.indexOf("%") + 1) , entries.indexOf("@"));

}

else{

name = entries.substring(0, entries.indexOf("@"));

}

}

return name;

}

and this is the error :

  • Transformation error

org.xml.sax.SAXParseException: Blanc requis avant des attributs.

org.xml.sax.SAXParseException: Blanc requis avant des attributs.

at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)

at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1372)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)

at org.apache.crimson.parser.Parser2.content(Parser2.java:1779)

at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507)

at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)

at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)

at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)

at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdent ityImpl.java:452)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.formatXML(EnhancedDebugger.ja va:756)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.addReadPacketToTable(Enhanced Debugger.java:676)

at org.jivesoftware.smackx.debugger.EnhancedDebugger.access$000(EnhancedDebugger.j ava:83)

at org.jivesoftware.smackx.debugger.EnhancedDebugger$1.processPacket(EnhancedDebug ger.java:193)

at org.jivesoftware.smack.PacketReader$ListenerWrapper.notifyListener(PacketReader .java:847)

at org.jivesoftware.smack.PacketReader.processListeners(PacketReader.java:253)

at org.jivesoftware.smack.PacketReader.access$100(PacketReader.java:77)

at org.jivesoftware.smack.PacketReader$2.run(PacketReader.java:111)

any idea ?

Nahuel,

Sorry for the late reply. This is a problem related to the debugger while trying to pretty print an XML packet. Could you post the XML that is generating this problem?

Thanks,

– Gato

Nahuel,

You can use the “Raw received/sent packets” to get that info.

Thanks,

– Gato

i find from where the bug comes from.

It’'s importing the ICQ Rosters that have a nickname malformatted, and the XML Parser does not support them.

because the nicknames have ~, ‘’, @, `, and others chars.

so i deleted them from my contact list and it’'s work !