Zmingxu / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

Package javax.xml.transform not present on Android SDK #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What are you doing to produce the error?
1. I am using the LeafNode.unsubscribe() method from pubsub extension.
2. It makes a call to the XmlUtils class which imports classes from
javax.xml.transform package.
3. This package does not exist in the Android JDK. Here is the message that
I get :

05-07 12:45:27.361: ERROR/dalvikvm(2618): Could not find method
javax.xml.transform.TransformerFactory.newInstance, referenced from method
org.jivesoftware.smackx.pubsub.util.XmlUtils.prettyPrint
05-07 12:45:27.361: WARN/dalvikvm(2618): VFY: unable to resolve static
method 1190: Ljavax/xml/transform/TransformerFactory;.newInstance
()Ljavax/xml/transform/TransformerFactory;
05-07 12:45:27.361: WARN/dalvikvm(2618): VFY:  rejecting opcode 0x71 at 0x0000
05-07 12:45:27.361: WARN/dalvikvm(2618): VFY:  rejected
Lorg/jivesoftware/smackx/pubsub/util/XmlUtils;.prettyPrint
(Ljava/lang/String;Ljava/lang/String;)V
05-07 12:45:27.361: WARN/dalvikvm(2618): Verifier rejected class
Lorg/jivesoftware/smackx/pubsub/util/XmlUtils;
05-07 12:45:27.361: WARN/dalvikvm(2618): threadid=19: thread exiting with
uncaught exception (group=0xb0099cf8)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618): Uncaught handler: thread
Smack Packet Writer (0) exiting due to uncaught exception
05-07 12:45:27.361: ERROR/AndroidRuntime(2618): java.lang.VerifyError:
org.jivesoftware.smackx.pubsub.util.XmlUtils
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smackx.pubsub.UnsubscribeExtension.toXML(UnsubscribeExtension.j
ava:61)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smack.packet.Packet.getExtensionsXML(Packet.java:364)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smackx.pubsub.packet.PubSub.getChildElementXML(PubSub.java:101)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smack.packet.IQ.toXML(IQ.java:88)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smack.PacketWriter.writePackets(PacketWriter.java:194)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smack.PacketWriter.access$000(PacketWriter.java:42)
05-07 12:45:27.361: ERROR/AndroidRuntime(2618):     at
org.jivesoftware.smack.PacketWriter$1.run(PacketWriter.java:78)

What is the expected output?
All but a such exception :)

What do you see instead? (Please attach a debug enabled logcat)
see the logcat attached

What version of aSmack / Android / Device do you use?
aSmack: from the  rtreffer/asmack trunk on github
Android: SDK 1.6 (API 4)
Device: an Androidx86 running on a VM

What server do you use? Is there a public server to reproduce the problem?
It is a local server not accessible from the web.
Openfire, trunk version

What else might help us to reproduce and hunt down the problem?
The problem is that the package javax.xml.transform is not part of the
Android SDK. Actually, we can fix the bug by removing the part of the code
which uses javax.xml.transform, I checked that it is never used today (the
method called by "LeafNode.unsubscribe()" is in the same class but does not
use the javax.xml.transform package), but smack's developers could use it
soon, so there is probably a better solution.

I attach the source I used to get the bud, and the logcat.

Kind Regards,

Paulo

Original issue reported on code.google.com by pg.ens...@gmail.com on 7 May 2010 at 11:10

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by rtreffer@gmail.com on 7 May 2010 at 11:34

GoogleCodeExporter commented 9 years ago
I'm sorry about that.
http://github.com/rtreffer/asmack/commit/3dcf8608c67dd1af509fda69482e131d6bc790b
7
should fix it.

Could you rebuild your asmack version after a git pull and report the result? 
I'd be
happy to publish a fixed version....

Original comment by rtreffer@gmail.com on 7 May 2010 at 12:21

GoogleCodeExporter commented 9 years ago
It works very well, thank you very much !

I think you should remove the imports too, but it works like that.

Kind Regards,

Paulo

Original comment by pg.ens...@gmail.com on 7 May 2010 at 2:50

GoogleCodeExporter commented 9 years ago
Imports are invisible in the .class file, and not worth the hassle (at the 
moment).

Anyway, thanks for testing!

Original comment by rtreffer@gmail.com on 7 May 2010 at 3:31