Package com.sun.syndication.io

Examples of com.sun.syndication.io.FeedException


        Attribute version = new Attribute("version", VERSION);
        root.setAttribute(version);

        if (feed == null) {
            throw new FeedException("invalid Atom Feed - missing required feed element");
        }

        if (feed.getTitle() != null) {
            root.addContent(generateSimpleElement("title", feed.getTitle()));
        }
View Full Code Here


                try {
                    SAXBuilder saxBuilder = new SAXBuilder();
                    tmpDoc = saxBuilder.build(tmpDocReader);
                }
                catch (Exception ex) {
                    throw new FeedException("Invalid XML",ex);
                }

                List children = tmpDoc.getRootElement().removeContent();
                contentElement.addContent(children);
            }
View Full Code Here

    // maxLen == -1 means unlimited.
    protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child == null) {
            throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName);
        }
        checkLength(parent,childName,minLen,maxLen);
    }
View Full Code Here

    // maxLen == -1 means unlimited.
    protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child != null) {
            if (minLen>0 && child.getText().length()<minLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length");
            }
            if (maxLen>-1 && child.getText().length()>maxLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length");
            }
        }
    }
View Full Code Here

    }

    protected void checkItemsConstraints(Element parent) throws FeedException {
        int count = parent.getChildren("item",getFeedNamespace()).size();
        if (count<1 || count>15) {
            throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15");
        }
    }
View Full Code Here

       
        String baseURI = null;
        try {
            baseURI = findBaseURI(eFeed);
        } catch (Exception e) {
            throw new FeedException("ERROR while finding base URI of feed", e);
        }
       
        Feed feed = parseFeedMetadata(baseURI, eFeed);

        String xmlBase = eFeed.getAttributeValue("base", Namespace.XML_NAMESPACE);
View Full Code Here

            for (int i=0;i<hours.size();i++) {
                Element hour = (Element) hours.get(i);
                int value = Integer.parseInt(hour.getText());
                if (isHourFormat24()) {
                    if (value<1 || value>24) {
                        throw new FeedException("Invalid hour value "+value+", it must be between 1 and 24");
                    }
                }
                else {
                    if (value<0 || value>23) {
                        throw new FeedException("Invalid hour value "+value+", it must be between 0 and 23");
                    }
                }
            }
        }
    }
View Full Code Here

    // maxLen == -1 means unlimited.
    protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child == null) {
            throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName);
        }
        checkLength(parent,childName,minLen,maxLen);
    }
View Full Code Here

    // maxLen == -1 means unlimited.
    protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
        Element  child = parent.getChild(childName,getFeedNamespace());
        if (child != null) {
            if (minLen>0 && child.getText().length()<minLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length");
            }
            if (maxLen>-1 && child.getText().length()>maxLen) {
                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length");
            }
        }
    }
View Full Code Here

    }

    protected void checkItemsConstraints(Element parent) throws FeedException {
        int count = parent.getChildren("item",getFeedNamespace()).size();
        if (count<1 || count>15) {
            throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15");
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.io.FeedException

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.