cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel AbstractDatatypeWidgetDefinitionBuilder.java
Date Sun, 09 Nov 2003 18:00:50 GMT
vgritsenko    2003/11/09 10:00:50

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        AbstractDatatypeWidgetDefinitionBuilder.java
  Log:
  always release components
  
  Revision  Changes    Path
  1.5       +14 -11    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java
  
  Index: AbstractDatatypeWidgetDefinitionBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/AbstractDatatypeWidgetDefinitionBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractDatatypeWidgetDefinitionBuilder.java	22 Oct 2003 20:22:07 -0000	1.4
  +++ AbstractDatatypeWidgetDefinitionBuilder.java	9 Nov 2003 18:00:50 -0000	1.5
  @@ -72,26 +72,29 @@
   
           Element selectionListElement = DomHelper.getChildElement(widgetElement, Constants.WD_NS,
"selection-list");
           if (selectionListElement != null) {
  -
               // Get an appropriate list builder
  -
               ServiceSelector builderSelector = (ServiceSelector)this.serviceManager.lookup(SelectionListBuilder.ROLE
+ "Selector");
  -
  -            // listType can be null, meaning we will use the default selection list
  -            String listType = selectionListElement.getAttribute("type");
  -            if (listType.length() == 0) listType = null;
  -            
  -            SelectionListBuilder builder = (SelectionListBuilder)builderSelector.select(listType);
  -            
  +            SelectionListBuilder builder = null;
               try {
  +                // listType can be null, meaning we will use the default selection list
  +                String listType = selectionListElement.getAttribute("type");
  +                if ("".equals(listType)) {
  +                    listType = null;
  +                }
  +
  +                builder = (SelectionListBuilder)builderSelector.select(listType);
                   SelectionList list = builder.build(selectionListElement, widget.getDatatype());
                   widget.setSelectionList(list);
               } finally {
  -                builderSelector.release(builder);
  +                if (builder != null) {
  +                    builderSelector.release(builder);
  +                }
                   this.serviceManager.release(builderSelector);
               }
  +
               return true;
  -        } else
  +        } else {
               return false;
  +        }
       }
   }
  
  
  

Mime
View raw message