On Mon, Jun 7, 2010 at 7:26 AM, Bernd Fondermann
<[email protected]> wrote:
>> I could not reproduce any problem with the pubsub demo with the
>> current trunk. I would be grateful if you could provide further
>> details on what problems you were seeing?
>
> Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
> org.jivesoftware.smack.packet.DefaultPacketExtension cannot be cast to
> org.jivesoftware.smackx.pubsub.Subscription
> at
> org.apache.vysper.demo.pubsub.client.PubsubClientModel.discoverSubscriptions(PubsubClientModel.java:81)
> at
> org.apache.vysper.demo.pubsub.client.PubsubClientModel.refresh(PubsubClientModel.java:136)
> at
> org.apache.vysper.demo.pubsub.client.PubsubClientGUI.run(PubsubClientGUI.java:123)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
> at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
> at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
> at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
> at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>
> I cannot see the list of nodes, nor subscribe to any as a consequence of that.
I'm afraid I can not reproduce this. Just to make sure, you're up to
date on trunk?
>> That being said, there are multiple issue with the current pubsub
>> code, but the demo seems to be work fine with them:
>> * message element created in the pubsub namespace
>> * item element published in the pubsub (not pubsub#event) namespace
>> (note that the proposed patch does not help with any of these)
>
> I wasn't aware of these. Maybe have JIRAs for them would be helpful.
The first one I've committed a fix for. The second one I've fixed but
not committed. I agree that we should have them as JIRAs, I'll make
sure to add them.
>> * create node handler only allows exactly one inner element. However,
>> the example used by Ken will send two elements since it uses a data
>> form in addition to the create element
>
> I'll look into his problem again more carefully.
I've fixed it by removing the check that there must be exactly one
inner element. Not sure if this has any further complications?
>> * The IQHandler namespace check is to lax in that it matches any
>> element with equal declared namespace (even if not applied to the
>> element at hand). This did in this case not cause any major problem
>> since the element local name did not match.
>
> Do you already have an idea how to improve this?
With the new parser, I think the following patch should be sufficient.
Index:
src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java
===================================================================
---
src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java
(revision
951378)
+++
src/main/java/org/apache/vysper/xmpp/modules/core/base/handler/IQHandler.java
(working
copy)
@@ -63,7 +63,8 @@
List<XMLElement> innerElements = stanza.getInnerElements();
XMLElement firstInnerElement = innerElements.get(0);
- return firstInnerElement.getVerifier().namespacePresent(namespace);
+
+ return firstInnerElement.getNamespaceURI().equals(namespace);
}
@SpecCompliance(compliant = {
/niklas