Author: dkulp
Date: Thu Jun 20 14:04:09 2013
New Revision: 1495009
URL: http://svn.apache.org/r1495009
Log:
ALso need to check the includes in the hasCode() call
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=1495009&r1=1495008&r2=1495009&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 Thu Jun 20 14:04:09
2013
@@ -344,7 +344,22 @@ public class Page extends AbstractPage i
}
public boolean hasCode() {
- return codeTypes == null ? false : !codeTypes.isEmpty();
+ if (codeTypes != null && !codeTypes.isEmpty()) {
+ return true;
+ }
+ if (includes != null) {
+ for (String i : includes) {
+ try {
+ Page p = exporter.findPage(i);
+ if (p != null && p.hasCode()) {
+ return true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return false;
}
public Set<String> getCodeScripts() throws Exception {
@@ -368,6 +383,8 @@ public class Page extends AbstractPage i
Page p = exporter.findPage(i);
if (p != null && p.hasCode()) {
scripts.addAll(p.getCodeScripts());
+ } else if (p == null) {
+ System.out.println(" Did not find page " + i);
}
} catch (Exception e) {
e.printStackTrace();
@@ -465,12 +482,21 @@ public class Page extends AbstractPage i
state = State.NONE;
break;
}
- case INCLUDE:
+ case INCLUDE: {
if (page.includes == null) {
page.includes = new CopyOnWriteArraySet<String>();
}
- page.includes.add(params.get("default-parameter"));
+ String inc = params.get("default-parameter");
+ if (inc == null) {
+ inc = params.get("title");
+ }
+ if (inc == null) {
+ System.out.println(page.title + ": Did not find an
include name " + params);
+ } else {
+ page.includes.add(inc);
+ }
break;
+ }
case BLOG_POSTS:
page.hasBlog = true;
break;