cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1688260 - /cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java
Date Mon, 29 Jun 2015 16:44:40 GMT
Author: dkulp
Date: Mon Jun 29 16:44:40 2015
New Revision: 1688260

URL: http://svn.apache.org/r1688260
Log:
More fixe


Modified:
    cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java?rev=1688260&r1=1688259&r2=1688260&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/Page.java Mon Jun 29 16:44:40 2015
@@ -397,22 +397,29 @@ public class Page extends AbstractPage i
     }
     
     public boolean getHasCode() {
-        return hasCode();
+        return hasCode(new HashMap<String, Boolean>());
     }
 
-    public boolean hasCode() {
+    public boolean hasCode(Map<String, Boolean> done) {
+        if (done.containsKey(getTitle())) {
+            return done.get(getTitle());
+        }
         if (codeTypes != null && !codeTypes.isEmpty()) {
+            done.put(this.getTitle(), true);
             return true;
         }
         if (includes != null) {
+            done.put(getTitle(), false);
             for (String i : includes) {
                 try {
                     Page p = exporter.findPage(i);
-                    if (p != null && p.hasCode()) {
+                    if (p != null && p.hasCode(done)) {
+                        done.put(this.getTitle(), true);
                         return true;
                     }
-                } catch (Exception e) {
+                } catch (Throwable e) {
                     e.printStackTrace();
+                    System.out.println(done);
                 }
             }
         }
@@ -439,7 +446,7 @@ public class Page extends AbstractPage i
             for (String i : includes) {
                 try {
                     Page p = exporter.findPage(i);
-                    if (p != null && p.hasCode()) {
+                    if (p != null && p.getHasCode()) {
                         scripts.addAll(p.getCodeScripts());
                     } else if (p == null) {
                         System.out.println("    Did not find page " + i);
@@ -524,6 +531,14 @@ public class Page extends AbstractPage i
                 paramName = atts.getValue(uri, "name");
             } else if ("default-parameter".equals(localName)) {
                 paramName = "default-parameter";
+            } else if ("page".equals(localName) && state == State.INCLUDE) {
+                for (int x = 0; x < atts.getLength(); x++) {
+                    if (atts.getLocalName(x).equals("content-title")) {
+                        if (paramName != null) {
+                            params.put(paramName, atts.getValue(x));
+                        }
+                    }
+                }
             }
         }
 
@@ -557,14 +572,19 @@ public class Page extends AbstractPage i
                         inc = params.get("title");
                     }
                     if (inc == null) {
+                        inc = params.get("");
+                    }
+                    if (inc == null) {
                         System.out.println(page.title + ": Did not find an include name "
+ params);
                     } else {
                         page.includes.add(inc);
                     }
+                    state = State.NONE;
                     break;
                 }
                 case BLOG_POSTS:
                     page.hasBlog = true;
+                    state = State.NONE;
                     break;
                 case CODE: {
                     if (page.codeTypes == null) {
@@ -600,6 +620,7 @@ public class Page extends AbstractPage i
                         lang = "java";
                     }
                     page.codeTypes.add(lang);
+                    state = State.NONE;
                     break;
                 }                    
                 default:



Mime
View raw message