sylvain 2002/06/30 13:45:54
Modified: src/java/org/apache/cocoon/components/treeprocessor/sitemap
Tag: cocoon_2_0_3_branch SitemapLanguage.java
Log:
Re-fix bug #7196
Revision Changes Path
No revision
No revision
1.4.2.2 +18 -20
xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java
Index: SitemapLanguage.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/SitemapLanguage.java,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- SitemapLanguage.java 7 Jun 2002 10:22:43 -0000 1.4.2.1
+++ SitemapLanguage.java 30 Jun 2002 20:45:54 -0000 1.4.2.2
@@ -176,7 +176,7 @@
public void recycle() {
super.recycle();
-
+
// Go back to initial state
this.labelViews.clear();
this.viewsNode = null;
@@ -226,10 +226,6 @@
*/
public Collection getViewsForStatement(String role, String hint, Configuration
statement) throws Exception {
- if ( role == null || role.trim().equals("") ) {
- // FIXME !!
- return null;
- }
String statementLabels = statement.getAttribute("label", null);
if (this.isBuildingView) {
@@ -251,20 +247,22 @@
Set labels = new HashSet();
// 1 - labels defined on the component
- SitemapComponentSelector selector = null;
- try {
- selector = (SitemapComponentSelector)this.manager.lookup(role +
"Selector");
- String[] compLabels = selector.getLabels(hint);
- if (compLabels != null) {
- for (int i = 0; i < compLabels.length; i++) {
- labels.add(compLabels[i]);
+ if (role != null && role.length() > 0) {
+ SitemapComponentSelector selector = null;
+ try {
+ selector = (SitemapComponentSelector)this.manager.lookup(role +
"Selector");
+ String[] compLabels = selector.getLabels(hint);
+ if (compLabels != null) {
+ for (int i = 0; i < compLabels.length; i++) {
+ labels.add(compLabels[i]);
+ }
}
+ } catch(Exception e) {
+ // Ignore (no selector for this role)
+ getLogger().debug("No selector for role " + role);
+ } finally {
+ this.manager.release( selector );
}
- } catch(Exception e) {
- // Ignore (no selector for this role)
- getLogger().debug("No selector for role " + role);
- } finally {
- this.manager.release( selector );
}
// 2 - labels defined on this statement
@@ -273,9 +271,9 @@
}
// 3 - pseudo-label depending on the role
- if (role.equals(Generator.ROLE)) {
+ if (Generator.ROLE.equals(role)) {
labels.add("!first!");
- } else if (role.equals(Serializer.ROLE)) {
+ } else if (Serializer.ROLE.equals(role)) {
labels.add("!last!");
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]