From fa26d2f2136133f85e1daa9a4d37b9293fcbaa4a Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 25 Nov 2009 20:48:22 +0000 Subject: [PATCH] configure and load methods may throw a MoteTypeCreationException --- .../se/sics/cooja/motes/AbstractApplicationMoteType.java | 9 ++++++--- .../java/se/sics/cooja/motes/DisturberMoteType.java | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java index 0652591ff..8a0168ccc 100644 --- a/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.java +++ b/tools/cooja/java/se/sics/cooja/motes/AbstractApplicationMoteType.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: AbstractApplicationMoteType.java,v 1.4 2009/10/28 14:38:02 fros4943 Exp $ + * $Id: AbstractApplicationMoteType.java,v 1.5 2009/11/25 20:48:22 fros4943 Exp $ */ package se.sics.cooja.motes; @@ -41,6 +41,7 @@ import org.apache.log4j.Logger; import org.jdom.Element; import se.sics.cooja.*; +import se.sics.cooja.MoteType.MoteTypeCreationException; import se.sics.cooja.interfaces.ApplicationRadio; import se.sics.cooja.interfaces.MoteID; import se.sics.cooja.interfaces.Position; @@ -67,7 +68,8 @@ public abstract class AbstractApplicationMoteType implements MoteType { this.description = "Application Mote Type #" + identifier; } - public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) { + public boolean configureAndInit(Container parentContainer, Simulation simulation, boolean visAvailable) + throws MoteTypeCreationException { if (identifier == null) { /* Create unique identifier */ int counter = 0; @@ -202,7 +204,8 @@ public abstract class AbstractApplicationMoteType implements MoteType { } public boolean setConfigXML(Simulation simulation, - Collection configXML, boolean visAvailable) { + Collection configXML, boolean visAvailable) + throws MoteTypeCreationException { for (Element element : configXML) { String name = element.getName(); if (name.equals("identifier")) { diff --git a/tools/cooja/java/se/sics/cooja/motes/DisturberMoteType.java b/tools/cooja/java/se/sics/cooja/motes/DisturberMoteType.java index 94fc93a85..2550e778f 100644 --- a/tools/cooja/java/se/sics/cooja/motes/DisturberMoteType.java +++ b/tools/cooja/java/se/sics/cooja/motes/DisturberMoteType.java @@ -43,6 +43,7 @@ import se.sics.cooja.MoteTimeEvent; import se.sics.cooja.MoteType; import se.sics.cooja.RadioPacket; import se.sics.cooja.Simulation; +import se.sics.cooja.MoteType.MoteTypeCreationException; import se.sics.cooja.interfaces.ApplicationRadio; import se.sics.cooja.interfaces.Radio.RadioEvent; @@ -71,7 +72,8 @@ public class DisturberMoteType extends AbstractApplicationMoteType { } public boolean configureAndInit(Container parentContainer, - Simulation simulation, boolean visAvailable) { + Simulation simulation, boolean visAvailable) + throws MoteTypeCreationException { if (!super.configureAndInit(parentContainer, simulation, visAvailable)) { return false; }