List of usage examples for org.jdom2 IllegalDataException IllegalDataException
public IllegalDataException(String reason)
From source file:model.advertisement.AbstractAdvertisement.java
License:Open Source License
/** * Initialize this advertisement with the root element handle by JXTA. * @param root//from w ww . j av a 2 s . c o m */ @SuppressWarnings("rawtypes") protected void initialize(net.jxta.document.Element root) { if (!TextElement.class.isInstance(root)) { throw new IllegalArgumentException(getClass().getName() + "initialize needs a TextElement."); } TextElement doc = (TextElement) root; //create the doc. if (!doc.getName().equals(getAdvType())) { throw new IllegalArgumentException("Error : " + getClass().getName() + " isn't " + doc.getName()); //Jxta didn't call the right advertisement to construct. Unexpected error. } Enumeration elements = doc.getChildren(); while (elements.hasMoreElements()) { TextElement elem = (TextElement) elements.nextElement(); Element e = new Element(elem.getName()); //convert into a Jdom element. e.addContent(elem.getValue()); if (!superHandleElement(e)) { throw new IllegalDataException(elem.getName()); //this element is unknown for this advertisement. } } }
From source file:model.advertisement.AbstractAdvertisement.java
License:Open Source License
/** * Initialize this advertisement with a Jdom root element * @param root // w w w .ja va 2 s . c om */ protected void initialize(Element root) { for (Element e : root.getChildren()) { if (!superHandleElement(e)) { throw new IllegalDataException(e.getName()); //this element is unknown for this advertisement. } } }