<br>I&#39;m trying to use JDOM 1.1 on the Android 1.0 platform.&nbsp; <br><br>The Android platform supports most Java 5 API&#39;s.&nbsp; However, java.rmi.* classes are not part of the Android platform.<br><br>When I use JDOM 1.1 on Android, I see this error:<br>

<br><br>W/dalvikvm(&nbsp; 327): VFY: unable to resolve check-cast 98 (Ljava/rmi/RemoteException;) in Lorg/jdom/JDOMException;<br>W/dalvikvm(&nbsp; 327): VFY:&nbsp; rejecting opcode 0x1f at 0x003d<br>W/dalvikvm(&nbsp; 327): VFY:&nbsp; rejected Lorg/jdom/JDOMException;.getNestedException (Ljava/lang/Throwable;)Ljava/lang/Throwable;<br>

W/dalvikvm(&nbsp; 327): Verifier rejected class Lorg/jdom/JDOMException;<br>D/AndroidRuntime(&nbsp; 327): Shutting down VM<br>W/dalvikvm(&nbsp; 327): threadid=3: thread exiting with uncaught exception (group=0x40010e28)<br>E/AndroidRuntime(&nbsp; 327): Uncaught handler: thread main exiting due to uncaught exception<br>

E/AndroidRuntime(&nbsp; 327): java.lang.VerifyError: org.jdom.JDOMException<br><br><br>I looked at the JDOM source code and noticed that org.jdom.JDOMException uses java.rmi.RemoteException:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (parent instanceof RemoteException) {<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ((RemoteException)parent).detail;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br><br>In order for this code to run on Android, we would need to eliminate java.rmi.RemoteException from JDOMException.java<br><br>One possible fix (?) is to use reflection to retrieve the &quot;detail&quot; field:<br>

<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (parent.getClass().getName().startsWith(&quot;java.rmi.&quot;)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Field f = parent.getClass().getField(&quot;detail&quot;);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return (Throwable) f.get(parent);<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (Exception ignore) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // ignored<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>Using &#39;startsWith&#39; is a hack. The intent is to detect java.rmi.RemoteException as well as all <br>subclasses of java.rmi.RemoteException from the java.rmi pacakge.<br>

<br>&nbsp; <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/RemoteException.html" target="_blank">http://java.sun.com/j2se/1.4.2/docs/api/java/rmi/RemoteException.html</a><br><br>Is there a better way to code this?&nbsp; Any other comments? <br>
<br>Sean<br><br>