Package org.jdom

Examples of org.jdom.JDOMException


        // -----------------------
        Byte result;
        try {
            result = new Byte(cellElement.getTextTrim());
        } catch ( NumberFormatException e ) {
            throw new JDOMException("Unable to parse the value for " + cellElement.getName() + //$NON-NLS-1$
                                    " element: " + cellElement.getTextTrim(), e); //$NON-NLS-1$
        }
        return result;
    }
View Full Code Here


        // -----------------------
        Integer result;
        try {
            result = Integer.valueOf(cellElement.getTextTrim());
        } catch ( NumberFormatException e ) {
            throw new JDOMException("Unable to parse the value for " + cellElement.getName() + //$NON-NLS-1$
                                    " element: " + cellElement.getTextTrim(), e); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
        }
        return result;
    }
View Full Code Here

        // -----------------------
        Long result;
        try {
            result = Long.valueOf(cellElement.getTextTrim());
        } catch ( NumberFormatException e ) {
            throw new JDOMException("Unable to parse the value for " + cellElement.getName() + //$NON-NLS-1$
                                    " element: " + cellElement.getTextTrim(), e); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
        }
        return result;
    }
View Full Code Here

        // -----------------------
        Short result;
        try {
            result = Short.valueOf(cellElement.getTextTrim());
        } catch ( NumberFormatException e ) {
            throw new JDOMException("Unable to parse the value for " + cellElement.getName() + //$NON-NLS-1$
                                    " element: " + cellElement.getTextTrim(), e); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
        }
        return result;
    }
View Full Code Here

        super();

        // 'name' - Property name. Required
        name = element.getAttributeValue("name");
        if (name == null || name.equals("")) {
            throw new JDOMException("Missing or empty name attribute in <parameter>");
        }

        // 'type' - Property type. Required
        try {
            type = Integer.parseInt(element.getAttributeValue("type"));
        } catch (Exception e) {
            throw new JDOMException("Missing or invalid type attribute in <parameter>");
        }

        // 'sortOrder' - Property sort order. Optional
        try {
            sortOrder = Integer.parseInt(element.getAttributeValue("sortOrder"));
        } catch (Exception e) {
            sortOrder = 0;
        }

        // 'typeMeta' - Property type meta information Optional.
        typeMeta = Util.trimmedOrBlank(element.getAttributeValue("typeMeta"));

        // 'validation' - Property validation string
        validationString = element.getAttributeValue("validation");

        // 'hidden' - Hidden property
        hidden = "true".equalsIgnoreCase(element.getAttributeValue("hidden"));

        // 'category' - Property category
        try {
            String c = element.getAttributeValue("category");
            if (c != null) {
                category = Integer.parseInt(c);
            }
        } catch (Exception e) {
            throw new JDOMException("Invalid category attribute in <parameter>");
        }

        // restart required
        restartRequired = "true".equalsIgnoreCase(element.getAttributeValue("restartRequired"));
View Full Code Here

            "META-INF/" + getName() + "-categories.xml"); e.hasMoreElements(); ) {
            URL u = e.nextElement();
            log.info("Loading categories for class "  + getName() + " from " + u);
            Element root = build.build(u).getRootElement();
            if(!root.getName().equals("categories")) {
                throw new JDOMException("Root element in " + u + " should be <categories>");
            }
            for(Iterator i = root.getChildren().iterator(); i.hasNext(); ) {
                Element c = (Element)i.next();
                if(c.getName().equals("category")) {
                    addCategories(c, null);
                }
                else {
                    throw new JDOMException("Expect root element of <categories> with child elements of <category>. Got <" + c.getName() + ">.");
                }
            }
        }
    }
View Full Code Here

            "META-INF/" + getName() + "-definitions.xml"); e.hasMoreElements(); ) {
            URL u = e.nextElement();
            log.info("Loading property definitions for class "  + getName() + " from " + u);
            Element root = build.build(u).getRootElement();
            if(!root.getName().equals("definitions")) {
                throw new JDOMException("Root element in " + u + " should be <definitions>");
            }
            for(Iterator i = root.getChildren().iterator(); i.hasNext(); ) {
                Element c = (Element)i.next();
                if(c.getName().equals("definition")) {
                    registerPropertyDefinition(createDefinition(c));
                }
                else {
                    throw new JDOMException("Expect root element of <definitions> with child elements of <definition>. Got <" + c.getName() + ">.");
                }
            }
        }
    }
View Full Code Here

            Element element = (Element) itr.next();
            if (element.getName().equalsIgnoreCase("install") || element.getName().equalsIgnoreCase("configure")) {

                ExtensionBundle extensionBundle = buildExtensionBundle(element);
                if(applicationBundles.containsKey(extensionBundle.getId())) {
                    throw new JDOMException("Duplicate application bundle id.");
                }
               
                // If supported operating system
                if(extensionBundle.getPlatform()!=null && !extensionBundle.getPlatform().equals("")) {
                  StringTokenizer tokens = new StringTokenizer(extensionBundle.getPlatform(), ",");
                  while(tokens.hasMoreTokens()) {
                    String platform = tokens.nextToken();
                    if(Utils.isSupportedPlatform(platform) && Utils.isSupportedArch(extensionBundle.getArch())) {
                      applicationBundles.put(extensionBundle.getId(), extensionBundle);
                      applicationBundlesList.add(extensionBundle);
                      break;
                    }
                  }
                } else {
                  applicationBundles.put(extensionBundle.getId(), extensionBundle);
                  applicationBundlesList.add(extensionBundle);
                }
                // End if
            } else {
                throw new JDOMException("Unknown element '" + element.getName() + "'.");
            }
        }

        Collections.sort(applicationBundlesList);
    }
View Full Code Here

           
            SAXBuilder sax = new SAXBuilder();
            document = sax.build(in);

            if (!document.getRootElement().getName().equalsIgnoreCase("applications")) {
                throw new JDOMException("Application root element must be <applications>");
            }

            store = document.getRootElement().getAttribute("store").getValue();
            if (store == null) {
                throw new JDOMException("<applications> element requires attribute 'store'");
            }
        }
        finally {
            Util.closeStream(in);
        }
View Full Code Here

    super(factory, config, true);
    locales = new HashMap();
    for(Iterator i = element.getChildren().iterator(); i.hasNext(); ) {
      Element el = (Element)i.next();
      if(!el.getName().equals("message")) {
        throw new JDOMException("<messages> element may only contain <message> elements.");       
      }
      String key = el.getAttributeValue("key");
      if(key == null) {
        throw new JDOMException("<message> element must have a key attribute.");
      }
      String localeName = el.getAttributeValue("locale");
      if(localeName == null) {
        localeName = "";
      }
View Full Code Here

TOP

Related Classes of org.jdom.JDOMException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.