From 115ee7b9364db3aea73af435bbd0ea12038a3a0d Mon Sep 17 00:00:00 2001 From: nifi Date: Sun, 24 Jan 2010 20:10:57 +0000 Subject: [PATCH] Changed mote creation to always be done by the MoteType (allows application motes to be loaded with the right class loader) --- tools/cooja/java/se/sics/cooja/Simulation.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/Simulation.java b/tools/cooja/java/se/sics/cooja/Simulation.java index bc0ebef36..80c68f98b 100644 --- a/tools/cooja/java/se/sics/cooja/Simulation.java +++ b/tools/cooja/java/se/sics/cooja/Simulation.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: Simulation.java,v 1.57 2010/01/15 14:00:06 fros4943 Exp $ + * $Id: Simulation.java,v 1.58 2010/01/24 20:10:57 nifi Exp $ */ package se.sics.cooja; @@ -633,15 +633,9 @@ public class Simulation extends Observable implements Runnable { if (moteType == null) { throw new Exception("No mote type for mote: " + moteClassName); } - - /* Load mote class using mote type's class loader */ - Class moteClass = myGUI.tryLoadClass(moteType, Mote.class, moteClassName); - if (moteClass == null) { - throw new Exception("Could not load mote class: " + element.getText().trim()); - } - - Mote mote = moteClass.getConstructor((Class[]) null).newInstance((Object[]) null); - mote.setType(moteType); + + /* Create mote using mote type */ + Mote mote = moteType.generateMote(this); if (mote.setConfigXML(this, element.getChildren(), visAvailable)) { addMote(mote); } else {