Author: tyrell
Date: Wed Apr 30 03:39:33 2008
New Revision: 16380

Log:

Fixing MASHUP-778

Modified:
   
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/Entry.java

Modified: 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/Entry.java
==============================================================================
--- 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/Entry.java
       (original)
+++ 
trunk/mashup/java/modules/hostobjects/src/org/wso2/mashup/hostobjects/feed/Entry.java
       Wed Apr 30 03:39:33 2008
@@ -74,8 +74,13 @@
     }
 
     public String jsGet_description() {
-        SyndContent description = entry.getDescription();
-        return description.getValue();
+        if (entry.getDescription() != null) {
+            SyndContent description = entry.getDescription();
+            return description.getValue();
+        } else {
+            return null;
+        }
+
     }
 
     public void jsSet_category(String category) {
@@ -103,18 +108,22 @@
         entry.setContents(cont);
     }
 
-    public String jsGet_content() {
-        ArrayList contents = (ArrayList) entry.getContents();
-        Iterator iterator = contents.iterator();
-
-        String retContent = "";
-        SyndContent currentContent;
-        while (iterator.hasNext()) {
-            currentContent = (SyndContent) iterator.next();
-            retContent = retContent + " " + currentContent.getValue();
-        }
+    public String jsGet_content() {  
+        if (entry.getContents() != null) {
+            ArrayList contents = (ArrayList) entry.getContents();
+            Iterator iterator = contents.iterator();
+
+            String retContent = "";
+            SyndContent currentContent;
+            while (iterator.hasNext()) {
+                currentContent = (SyndContent) iterator.next();
+                retContent = retContent + " " + currentContent.getValue();
+            }
 
-        return retContent;
+            return retContent;
+        }else{
+            return null;
+        }
     }
 
     public void jsSet_contributor(String contributor) {
@@ -124,11 +133,12 @@
     }
 
     public String jsGet_contributor() {
-        ArrayList contributors = (ArrayList) entry.getContributors();
-        if (contributors.get(0) != null) {
+        if (entry.getContributors() != null) {
+            ArrayList contributors = (ArrayList) entry.getContributors();
             return (String) contributors.get(0);
+        } else {
+            return null;
         }
-        return null;
     }
 
     public void jsSet_link(String link) throws IRISyntaxException {
@@ -136,23 +146,22 @@
     }
 
     public String[] jsGet_link() throws IRISyntaxException {
-        if (entry != null) {
-            String[] links;
-            if (entry.getLinks().size() > 0) {
-                List list = entry.getLinks();
-                int size = list.size();
-                links = new String[size];
-                for (int i = 0; i < size; i++) {
-                    SyndLink element = (SyndLink) list.get(i);
-                    links[i] = element.getHref();
-                }
-                return links;
-            } else if (entry.getLink().compareTo("") != 0) {
-                links = new String[1];
-                links[0] = entry.getLink();
-                return links;
+        String[] links;
+        if (entry.getLinks() != null) {
+            List list = entry.getLinks();
+            int size = list.size();
+            links = new String[size];
+            for (int i = 0; i < size; i++) {
+                SyndLink element = (SyndLink) list.get(i);
+                links[i] = element.getHref();
             }
+            return links;
+        } else if (entry.getLink() != null) {
+            links = new String[1];
+            links[0] = entry.getLink();
+            return links;
         }
+
         return null;
     }
 
@@ -277,7 +286,7 @@
 
                         for (int y = 0; y < content.length; y++) {
                             MediaModule mediaModule = new MediaModule();
-                            mediaModule.module = currMediaModule;              
               
+                            mediaModule.module = currMediaModule;
                             tempMediaModules.add(mediaModule);
                         }
                     }

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to