RSS 2.0 Parsing error

Help
ben
2007-04-27
2013-04-25
  • ben
    ben
    2007-04-27

    Hi,

    I'm using informa (with Hibernate) and I met an error when parsing an RSS 2.0 file which have items with category:

    org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of de.nava.informa.impl.hibernate.Category.id
        at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
        at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
        at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3585)
        at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3301)
        at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
        at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:218)
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
        at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:78)
        at org.hibernate.persister.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:755)
        at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1143)
        at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:26)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
        at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
        at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
        at de.nava.informa.impl.hibernate.ChannelBuilder.createItem(ChannelBuilder.java:322)
        at de.nava.informa.parsers.RSS_2_0_Parser.parse(RSS_2_0_Parser.java:202)
        at de.nava.informa.parsers.FeedParser.parse(FeedParser.java:266)
        at de.nava.informa.parsers.FeedParser.parse(FeedParser.java:221)
        at de.nava.informa.parsers.FeedParser.parse(FeedParser.java:141)

    Do you have an idea of this issue?

    Thanks for all.

     
    • ben
      ben
      2007-04-27

      I found a solution by adding a method in RSS_2_0_Parser.java which is then called by the parse one:

      private CategoryIF getCategoryList(ChannelBuilderIF cBuilder, CategoryIF parent, String title,
                Hashtable children) {
              // Assuming category hierarchy for each category element
              // is already mapped out into Hashtable tree;  Hense the children Hashtable

              // create current CategoryIF object; Parent may be null if at top level
              CategoryIF cat = cBuilder.createCategory(parent, title);
              // iterate off list of keys from children list
              Enumeration itChild = children.keys();
              while (itChild.hasMoreElements()) {
                String childKey = (String) itChild.nextElement();
                // don't need to keep track of return CategoryIF since it will be added as child of another instance
                getCategoryList(cat, childKey, (Hashtable) children.get(childKey));
              }
              return cat;
            }

      Hope it will be helpfull.