You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/08/04 15:49:31 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools ContentTool.java TemplateLink.java

henning     2003/08/04 06:49:31

  Modified:    src/java/org/apache/turbine/services/pull/tools
                        ContentTool.java TemplateLink.java
  Log:
  Argh. conf.subset() doesn't return an empty Configuration object when
  no key exists, but returns null. So if we want to call getBoolean on a
  subset, we must test for null first.
  
  IMHO, commons-configuration should never return null on subset. :-(
  
  Revision  Changes    Path
  1.3       +9 -6      jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/ContentTool.java
  
  Index: ContentTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/ContentTool.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContentTool.java	31 Jul 2003 16:29:52 -0000	1.2
  +++ ContentTool.java	4 Aug 2003 13:49:31 -0000	1.3
  @@ -142,12 +142,15 @@
   
           Configuration conf = 
                   Turbine.getConfiguration().subset(CONTENT_TOOL_PREFIX);
  -        
  -        wantRelative = conf.getBoolean(CONTENT_TOOL_RELATIVE_KEY,
  -                CONTENT_TOOL_RELATIVE_DEFAULT);
   
  -        wantEncoding = conf.getBoolean(CONTENT_TOOL_ENCODING_KEY,
  -                CONTENT_TOOL_ENCODING_DEFAULT);
  +        if (conf != null)
  +        {
  +            wantRelative = conf.getBoolean(CONTENT_TOOL_RELATIVE_KEY,
  +                    CONTENT_TOOL_RELATIVE_DEFAULT);
  +
  +            wantEncoding = conf.getBoolean(CONTENT_TOOL_ENCODING_KEY,
  +                    CONTENT_TOOL_ENCODING_DEFAULT);
  +        }
           
           if (!wantEncoding)
           {
  
  
  
  1.7       +7 -4      jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
  
  Index: TemplateLink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TemplateLink.java	31 Jul 2003 16:30:36 -0000	1.6
  +++ TemplateLink.java	4 Aug 2003 13:49:31 -0000	1.7
  @@ -149,9 +149,12 @@
   
           Configuration conf = 
                   Turbine.getConfiguration().subset(TEMPLATE_LINK_PREFIX);
  -        
  -        wantRelative = conf.getBoolean(TEMPLATE_LINK_RELATIVE_KEY,
  -                TEMPLATE_LINK_RELATIVE_DEFAULT);
  +
  +        if (conf != null)
  +        {
  +            wantRelative = conf.getBoolean(TEMPLATE_LINK_RELATIVE_KEY,
  +                    TEMPLATE_LINK_RELATIVE_DEFAULT);
  +        }
   
       }