Trying setClassLoader in SwingEngine, I could not get it to work until changing the Class.forName line|| in Parser.java

Class initClass = Class.forName( classname , true, this.engine.getClassLoader() ); // load update type

--kept getting ClassNotFoundException there. It looks like the classloader "cl" field is not getting fully propagated.


Also, I have a custom component using initclass. The component takes an Object argrument in its constructor. It wouldn't initialize until I changed the argument checking in DefaultFactory.java

        for (int j = 0; ctor != null && j < cParams.length; j++) {
          //if (cParams[j].equals( Object.class )) {
          // if (!cParams[j].equals( pTypes[j] )) {
          //   ctor = null; //dismissed
          //  }
          //} else {
            if (!cParams[j].isAssignableFrom( pTypes[j] )) {
              ctor = null; //dismissed
            }
          //}
        } // end for j - loop Ctor's parameter

I am using the getInstance of initclass to aquire an already-instantiated singleton, but my custom component doesn't know or need to know the type. That's why I'm giving it a subclass of Object even though it takes Object. Only the method isAssignableFrom is needed, because it also includes the "equals" case.

By the way, I'll be giving a talk including SWIX in the upcoming ADASS conference on astronomical data reduction, and just yesterday my application using SWIX was released, see

http://ssc.spitzer.caltech.edu/postbcd/spice.html

Ted Hesselroth


Reply via email to