java.bean.XMLDecoder not working in IDEA plugin !?

Hello guys,

I am using java.bean.XMLDecoder to read certain settings into my IDEA plugin. But for some reasons the following produces NULL:

XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(inputStream));
Settings settings = (Settings) decoder.readObject();

// Result is: settings == null !!!

I already checked the inputStream which is set correctly.
This technique works fine in other IDEs (like JDeveloper 10g) or in stand alone applications.
Only in IntelliJ IDEA 4.5 the method call XMLDecoder.readObject produces NULL

Does the IDEA API maybe changes the introspection of classes, so that XMLDecoder is not able to put objects back together ?


Any ideas ?

Best regards
Tobias



1 comment
Comment actions Permalink

I found a solution in Sun's Java Forum.
My problem was a ClassLoader problem. XMLDecoder was not able to find the classes from my plugin jar file because XMLDecoder uses a different ClassLoader as the classes in my plugin file.


The last message has a great solution which works fine for my IDEA plugin:

http://forum.java.sun.com/thread.jspa?threadID=344817&messageID=2735220

0

Please sign in to leave a comment.