abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r656931 - /incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
Date Fri, 16 May 2008 04:29:14 GMT
Author: jmsnell
Date: Thu May 15 21:29:13 2008
New Revision: 656931

URL: http://svn.apache.org/viewvc?rev=656931&view=rev
Log:
https://issues.apache.org/jira/browse/ABDERA-160 - NPE in AbstractProvider when building service
doc for WorkspaceInfo with null CollectionInfo collection

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java?rev=656931&r1=656930&r2=656931&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
Thu May 15 21:29:13 2008
@@ -19,6 +19,7 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -300,33 +301,36 @@
             for (WorkspaceInfo wi : getWorkspaceManager(request).getWorkspaces(request))
{
               sw.startWorkspace()
                 .writeTitle(wi.getTitle(request));
-              for (CollectionInfo ci : wi.getCollections(request)) {
-                sw.startCollection(ci.getHref(request))
-                  .writeTitle(ci.getTitle(request))
-                  .writeAccepts(ci.getAccepts(request));
-                CategoriesInfo[] catinfos = ci.getCategoriesInfo(request);
-                if (catinfos != null) {
-                  for (CategoriesInfo catinfo : catinfos) {
-                    String cathref = catinfo.getHref(request);
-                    if (cathref != null) {
-                      sw.startCategories()
-                        .writeAttribute("href", request.getTargetBasePath() + cathref)
-                        .endCategories();
-                    } else {
-                      sw.startCategories(
-                        catinfo.isFixed(request), 
-                        catinfo.getScheme(request));
-                      for (CategoryInfo cat : catinfo) {
-                        sw.writeCategory(
-                          cat.getTerm(request), 
-                          cat.getScheme(request), 
-                          cat.getLabel(request));
+              Collection<CollectionInfo> collections = wi.getCollections(request);
+              if (collections != null) {
+                for (CollectionInfo ci : collections) {
+                  sw.startCollection(ci.getHref(request))
+                    .writeTitle(ci.getTitle(request))
+                    .writeAccepts(ci.getAccepts(request));
+                  CategoriesInfo[] catinfos = ci.getCategoriesInfo(request);
+                  if (catinfos != null) {
+                    for (CategoriesInfo catinfo : catinfos) {
+                      String cathref = catinfo.getHref(request);
+                      if (cathref != null) {
+                        sw.startCategories()
+                          .writeAttribute("href", request.getTargetBasePath() + cathref)
+                          .endCategories();
+                      } else {
+                        sw.startCategories(
+                          catinfo.isFixed(request), 
+                          catinfo.getScheme(request));
+                        for (CategoryInfo cat : catinfo) {
+                          sw.writeCategory(
+                            cat.getTerm(request), 
+                            cat.getScheme(request), 
+                            cat.getLabel(request));
+                        }
+                        sw.endCategories();
                       }
-                      sw.endCategories();
                     }
                   }
+                  sw.endCollection();
                 }
-                sw.endCollection();
               }
               sw.endWorkspace();
             }



Mime
View raw message