Coverage report

  %line %branch
org.apache.commons.jelly.util.TagUtils
85% 
100% 

 1  
 /*
 2  
  * Copyright 2002,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.commons.jelly.util;
 17  
 
 18  
 import org.apache.commons.jelly.JellyTagException;
 19  
 import org.apache.commons.jelly.Script;
 20  
 import org.apache.commons.jelly.impl.CompositeTextScriptBlock;
 21  
 import org.apache.commons.jelly.impl.ScriptBlock;
 22  
 import org.apache.commons.jelly.impl.TextScript;
 23  
 import org.apache.commons.jelly.impl.WeakReferenceWrapperScript;
 24  
 
 25  
 /** Contains static methods to help tag developers.
 26  
  * @author Hans Gilde
 27  
  *
 28  
  */
 29  
 public class TagUtils {
 30  0
     private TagUtils() {
 31  
         
 32  0
     }
 33  
 
 34  
     /** Trims the whitespace from a script and its children.
 35  
      * 
 36  
      */
 37  
     public static void trimScript(Script body) {
 38  2880
         synchronized(body) {
 39  2880
             if (body instanceof WeakReferenceWrapperScript) {
 40  1416
                 WeakReferenceWrapperScript wrrs = (WeakReferenceWrapperScript) body;
 41  
                 try {
 42  1416
                     wrrs.trimWhitespace();
 43  1416
                 } catch (JellyTagException e) {
 44  
                     //TODO handle this exception once the Tag interface allows JellyTagException to be thrown
 45  0
                     return;
 46  1416
                 }
 47  1464
             } else if ( body instanceof CompositeTextScriptBlock ) {
 48  15
                 CompositeTextScriptBlock block = (CompositeTextScriptBlock) body;
 49  15
                 block.trimWhitespace();
 50  
             }
 51  
             else
 52  1449
             if ( body instanceof ScriptBlock ) {
 53  1275
                 ScriptBlock block = (ScriptBlock) body;
 54  1275
                 block.trimWhitespace();
 55  
             }
 56  174
             else if ( body instanceof TextScript ) {
 57  57
                 TextScript textScript = (TextScript) body;
 58  57
                 textScript.trimWhitespace();
 59  
             }
 60  2880
         }
 61  2880
     }
 62  
 
 63  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.