abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r418373 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Date Fri, 30 Jun 2006 20:56:20 GMT
Author: jmsnell
Date: Fri Jun 30 13:56:19 2006
New Revision: 418373

URL: http://svn.apache.org/viewvc?rev=418373&view=rev
Log:
Fixing an infinite loop that occurs when the feed that contains an entry is set as it's source..

e.g. 

  Feed parent = Factory.INSTANCE.newFeed();
  Entry entry = Factory.INSTANCE.newEntry(parent);
  
  // this line is what causes the loop
  entry.setSource(parent);


Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=418373&r1=418372&r2=418373&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
Fri Jun 30 13:56:19 2006
@@ -37,6 +37,7 @@
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Entry;
 import org.apache.abdera.model.ExtensionElement;
+import org.apache.abdera.model.Feed;
 import org.apache.abdera.model.IRI;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.model.Person;
@@ -622,10 +623,13 @@
   }
 
   public void setSource(Source source) {
-    if (source != null)
+    if (source != null) {
+      if (source instanceof Feed)
+        source = ((Feed)source).getAsSource();
       _setChild(SOURCE, (OMElement)source);
-    else
+    } else {
       _removeElement(SOURCE, false);
+    }
   }
 
   @SuppressWarnings("unchecked")



Mime
View raw message