Coverage Report - org.apache.maven.plugin.invoker.HelpMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
HelpMojo
0%
0/206
0%
0/62
4.667
 
 1  
 package org.apache.maven.plugin.invoker;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Iterator;
 5  
 import java.util.List;
 6  
 
 7  
 import org.apache.maven.plugin.AbstractMojo;
 8  
 import org.apache.maven.plugin.MojoExecutionException;
 9  
 
 10  
 /**
 11  
  * Display help information on maven-invoker-plugin.<br/> Call <pre>  mvn invoker:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</pre> to display parameter details.
 12  
  *
 13  
  * @version generated on Thu Sep 25 22:08:39 CEST 2008
 14  
  * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.4.3)
 15  
  * @goal help
 16  
  * @requiresProject false
 17  
  */
 18  0
 public class HelpMojo
 19  
     extends AbstractMojo
 20  
 {
 21  
     /**
 22  
      * If <code>true</code>, display all settable properties for each goal.
 23  
      * 
 24  
      * @parameter expression="${detail}" default-value="false"
 25  
      */
 26  
     private boolean detail;
 27  
 
 28  
     /**
 29  
      * The name of the goal for which to show help. If unspecified, all goals will be displayed.
 30  
      * 
 31  
      * @parameter expression="${goal}"
 32  
      */
 33  
     private java.lang.String goal;
 34  
 
 35  
     /**
 36  
      * The maximum length of a display line, should be positive.
 37  
      * 
 38  
      * @parameter expression="${lineLength}" default-value="80"
 39  
      */
 40  
     private int lineLength;
 41  
 
 42  
     /**
 43  
      * The number of spaces per indentation level, should be positive.
 44  
      * 
 45  
      * @parameter expression="${indentSize}" default-value="2"
 46  
      */
 47  
     private int indentSize;
 48  
 
 49  
 
 50  
     /** {@inheritDoc} */
 51  
     public void execute()
 52  
         throws MojoExecutionException
 53  
     {
 54  0
         if ( lineLength <= 0 )
 55  
         {
 56  0
             getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
 57  0
             lineLength = 80;
 58  
         }
 59  0
         if ( indentSize <= 0 )
 60  
         {
 61  0
             getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
 62  0
             indentSize = 2;
 63  
         }
 64  
 
 65  0
         StringBuffer sb = new StringBuffer();
 66  
 
 67  0
         append( sb, "org.apache.maven.plugins:maven-invoker-plugin:1.3", 0 );
 68  0
         append( sb, "", 0 );
 69  
 
 70  0
         append( sb, "Maven Invoker Plugin 1.3", 0 );
 71  0
         append( sb, "The Maven Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution is successful, and optionally can verify the output generated from a given project execution.", 1 );
 72  0
         append( sb, "", 0 );
 73  
 
 74  0
         if ( goal == null || goal.length() <= 0 )
 75  
         {
 76  0
             append( sb, "This plugin has 3 goals:", 0 );
 77  0
             append( sb, "", 0 );
 78  
         }
 79  
 
 80  0
         if ( goal == null || goal.length() <= 0 || "help".equals( goal ) )
 81  
         {
 82  0
             append( sb, "invoker:help", 0 );
 83  0
             append( sb, "Display help information on maven-invoker-plugin.\nCall\n\u00a0\u00a0mvn\u00a0invoker:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 );
 84  0
             append( sb, "", 0 );
 85  0
             if ( detail )
 86  
             {
 87  0
                 append( sb, "Available parameters:", 1 );
 88  0
                 append( sb, "", 0 );
 89  
 
 90  0
                 append( sb, "detail (Default: false)", 2 );
 91  0
                 append( sb, "If true, display all settable properties for each goal.", 3 );
 92  0
                 append( sb, "", 0 );
 93  
 
 94  0
                 append( sb, "goal", 2 );
 95  0
                 append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
 96  0
                 append( sb, "", 0 );
 97  
 
 98  0
                 append( sb, "lineLength (Default: 80)", 2 );
 99  0
                 append( sb, "The maximum length of a display line, should be positive.", 3 );
 100  0
                 append( sb, "", 0 );
 101  
 
 102  0
                 append( sb, "indentSize (Default: 2)", 2 );
 103  0
                 append( sb, "The number of spaces per indentation level, should be positive.", 3 );
 104  0
                 append( sb, "", 0 );
 105  
             }
 106  
         }
 107  
 
 108  0
         if ( goal == null || goal.length() <= 0 || "install".equals( goal ) )
 109  
         {
 110  0
             append( sb, "invoker:install", 0 );
 111  0
             append( sb, "Installs the project artifacts of the main build into the local repository as a preparation to run the sub projects. More precisely, all artifacts of the project itself, all its locally reachable parent POMs and all its dependencies from the reactor will be installed to the local repository.", 1 );
 112  0
             append( sb, "", 0 );
 113  0
             if ( detail )
 114  
             {
 115  0
                 append( sb, "Available parameters:", 1 );
 116  0
                 append( sb, "", 0 );
 117  
 
 118  0
                 append( sb, "localRepositoryPath", 2 );
 119  0
                 append( sb, "The path to the local repository into which the project artifacts should be installed for the integration tests. If not set, the regular local repository will be used. To prevent soiling of your regular local repository with possibly broken artifacts, it is strongly recommended to use an isolated repository for the integration tests (e.g. ${project.build.directory}/it-repo).", 3 );
 120  0
                 append( sb, "", 0 );
 121  
             }
 122  
         }
 123  
 
 124  0
         if ( goal == null || goal.length() <= 0 || "run".equals( goal ) )
 125  
         {
 126  0
             append( sb, "invoker:run", 0 );
 127  0
             append( sb, "Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and outputting the results to the command line.", 1 );
 128  0
             append( sb, "", 0 );
 129  0
             if ( detail )
 130  
             {
 131  0
                 append( sb, "Available parameters:", 1 );
 132  0
                 append( sb, "", 0 );
 133  
 
 134  0
                 append( sb, "addTestClassPath (Default: false)", 2 );
 135  0
                 append( sb, "A flag whether the test class path of the project under test should be included in the class path of the pre-/post-build scripts. If set to false, the class path of script interpreter consists only of the runtime dependencies of the Maven Invoker Plugin. If set the true, the project\'s test class path will be prepended to the interpreter class path. Among others, this feature allows the scripts to access utility classes from the test sources of your project.", 3 );
 136  0
                 append( sb, "", 0 );
 137  
 
 138  0
                 append( sb, "cloneAllFiles (Default: false)", 2 );
 139  0
                 append( sb, "Some files are normally excluded when copying the IT projects from the directory specified by the parameter projectsDirectory to the directory given by cloneProjectsTo (e.g. .svn, CVS, *~, etc). Setting this parameter to true will cause all files to be copied to the cloneProjectsTo directory.", 3 );
 140  0
                 append( sb, "", 0 );
 141  
 
 142  0
                 append( sb, "cloneProjectsTo", 2 );
 143  0
                 append( sb, "Directory to which projects should be cloned prior to execution. If not specified, each integration test will be run in the directory in which the corresponding IT POM was found. In this case, you most likely want to configure your SCM to ignore target and build.log in the test\'s base directory.", 3 );
 144  0
                 append( sb, "", 0 );
 145  
 
 146  0
                 append( sb, "debug (Default: false)", 2 );
 147  0
                 append( sb, "Whether to show debug statements in the build output.", 3 );
 148  0
                 append( sb, "", 0 );
 149  
 
 150  0
                 append( sb, "encoding (Default: ${project.build.sourceEncoding})", 2 );
 151  0
                 append( sb, "The file encoding for the pre-/post-build scripts and the list files for goals and profiles.", 3 );
 152  0
                 append( sb, "", 0 );
 153  
 
 154  0
                 append( sb, "filterProperties", 2 );
 155  0
                 append( sb, "A list of additional properties which will be used to filter tokens in POMs and goal files.", 3 );
 156  0
                 append( sb, "", 0 );
 157  
 
 158  0
                 append( sb, "goals", 2 );
 159  0
                 append( sb, "The list of goals to execute on each project. Default value is: package.", 3 );
 160  0
                 append( sb, "", 0 );
 161  
 
 162  0
                 append( sb, "goalsFile (Default: goals.txt)", 2 );
 163  0
                 append( sb, "Deprecated. As of version 1.2, the key invoker.goals from the properties file specified by the parameter invokerPropertiesFile should be used instead.", 3 );
 164  0
                 append( sb, "", 0 );
 165  0
                 append( sb, "The name of the project-specific file that contains the enumeration of goals to execute for that test.", 3 );
 166  0
                 append( sb, "", 0 );
 167  
 
 168  0
                 append( sb, "ignoreFailures (Default: false)", 2 );
 169  0
                 append( sb, "A flag controlling whether failures of the sub builds should fail the main build, too. If set to true, the main build will proceed even if one or more sub builds failed.", 3 );
 170  0
                 append( sb, "", 0 );
 171  
 
 172  0
                 append( sb, "interpolationsProperties", 2 );
 173  0
                 append( sb, "Deprecated. As of version 1.3, the parameter filterProperties should be used instead.", 3 );
 174  0
                 append( sb, "", 0 );
 175  0
                 append( sb, "List of properties which will be used to interpolate goal files.", 3 );
 176  0
                 append( sb, "", 0 );
 177  
 
 178  0
                 append( sb, "invokerPropertiesFile (Default: invoker.properties)", 2 );
 179  0
                 append( sb, "The name of an optional test-specific file that contains properties used to configure the invocation of an integration test. This properties file may be used to specify settings for an individual test invocation. Any property present in the file will override the corresponding setting from the plugin configuration. The values of the properties are filtered and may use expressions like ${project.version} to reference project properties or values from the parameter filterProperties. The snippet below describes the supported properties:\n#\u00a0A\u00a0comma\u00a0or\u00a0space\u00a0separated\u00a0list\u00a0of\u00a0goals/phases\u00a0to\u00a0execute,\u00a0may\n#\u00a0specify\u00a0an\u00a0empty\u00a0list\u00a0to\u00a0execute\u00a0the\u00a0default\u00a0goal\u00a0of\u00a0the\u00a0IT\u00a0project\ninvoker.goals=clean\u00a0install\n\n#\u00a0Optionally,\u00a0a\u00a0list\u00a0of\u00a0goals\u00a0to\u00a0run\u00a0during\u00a0further\u00a0invocations\u00a0of\u00a0Maven\ninvoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run\n\n#\u00a0A\u00a0comma\u00a0or\u00a0space\u00a0separated\u00a0list\u00a0of\u00a0profiles\u00a0to\u00a0activate\ninvoker.profiles=its,jdk15\n\n#\u00a0The\u00a0value\u00a0for\u00a0the\u00a0environment\u00a0variable\u00a0MAVEN_OPTS\ninvoker.mavenOpts=-Dfile.encoding=UTF-16\u00a0-Xms32m\u00a0-Xmx256m\n\n#\u00a0Possible\u00a0values\u00a0are\u00a0\'fail-fast\'\u00a0(default),\u00a0\'fail-at-end\'\u00a0and\u00a0\'fail-never\'\ninvoker.failureBehavior=fail-never\n\n#\u00a0The\u00a0expected\u00a0result\u00a0of\u00a0the\u00a0build,\u00a0possible\u00a0values\u00a0are\u00a0\'success\'\u00a0(default)\u00a0and\u00a0\'failure\'\ninvoker.buildResult=failure\n\n#\u00a0A\u00a0boolean\u00a0value\u00a0controlling\u00a0the\u00a0-N\u00a0flag,\u00a0defaults\u00a0to\u00a0\'false\'\ninvoker.nonRecursive=false\n", 3 );
 180  0
                 append( sb, "", 0 );
 181  
 
 182  0
                 append( sb, "invokerTest", 2 );
 183  0
                 append( sb, "A comma separated list of project names to run. Specify this parameter to run individual tests by file name, overriding the setupIncludes, pomIncludes and pomExcludes parameters. Each pattern you specify here will be used to create an include pattern formatted like ${projectsDirectory}/pattern, so you can just type -Dinvoker.test=FirstTest,SecondTest to run builds in ${projectsDirectory}/FirstTest and ${projectsDirectory}/SecondTest.", 3 );
 184  0
                 append( sb, "", 0 );
 185  
 
 186  0
                 append( sb, "javaHome", 2 );
 187  0
                 append( sb, "The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java home directory.", 3 );
 188  0
                 append( sb, "", 0 );
 189  
 
 190  0
                 append( sb, "localRepositoryPath (Default: ${settings.localRepository})", 2 );
 191  0
                 append( sb, "The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated repository like ${project.build.directory}/it-repo. Otherwise, your ordinary local repository will be used, potentially soiling it with broken artifacts.", 3 );
 192  0
                 append( sb, "", 0 );
 193  
 
 194  0
                 append( sb, "mavenHome", 2 );
 195  0
                 append( sb, "The home directory of the Maven installation to use for the forked builds. Defaults to the current Maven installation.", 3 );
 196  0
                 append( sb, "", 0 );
 197  
 
 198  0
                 append( sb, "mavenOpts", 2 );
 199  0
                 append( sb, "The MAVEN_OPTS environment variable to use when invoking Maven. This value can be overridden for individual integration tests by using invokerPropertiesFile.", 3 );
 200  0
                 append( sb, "", 0 );
 201  
 
 202  0
                 append( sb, "noLog (Default: false)", 2 );
 203  0
                 append( sb, "Suppress logging to the build.log file.", 3 );
 204  0
                 append( sb, "", 0 );
 205  
 
 206  0
                 append( sb, "pom", 2 );
 207  0
                 append( sb, "A single POM to build, skipping any scanning parameters and behavior.", 3 );
 208  0
                 append( sb, "", 0 );
 209  
 
 210  0
                 append( sb, "pomExcludes", 2 );
 211  0
                 append( sb, "Exclude patterns for searching the integration test directory. This parameter is meant to be set from the POM. By default, no POM files are excluded. For the convenience of using an include pattern like *, the custom settings file specified by the parameter settingsFile will always be excluded automatically.", 3 );
 212  0
                 append( sb, "", 0 );
 213  
 
 214  0
                 append( sb, "pomIncludes", 2 );
 215  0
                 append( sb, "Include patterns for searching the integration test directory for projects. This parameter is meant to be set from the POM. If this parameter is not set, the plugin will search for all pom.xml files one directory below projectsDirectory (i.e. */pom.xml).\n\nStarting with version 1.3, mere directories can also be matched by these patterns. For example, the include pattern * will run Maven builds on all immediate sub directories of projectsDirectory, regardless if they contain a pom.xml. This allows to perform builds that need/should not depend on the existence of a POM.", 3 );
 216  0
                 append( sb, "", 0 );
 217  
 
 218  0
                 append( sb, "postBuildHookScript (Default: postbuild)", 2 );
 219  0
                 append( sb, "Relative path of a cleanup/verification hook script to run after executing the build. This script may be written with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. verify), the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. If this script exists for a particular project but returns any value different from true or throws an exception, the corresponding build is flagged as a failure.", 3 );
 220  0
                 append( sb, "", 0 );
 221  
 
 222  0
                 append( sb, "preBuildHookScript (Default: prebuild)", 2 );
 223  0
                 append( sb, "Relative path of a pre-build hook script to run prior to executing the build. This script may be written with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. prebuild), the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. If this script exists for a particular project but returns any value different from true or throws an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build hook script will be invoked.", 3 );
 224  0
                 append( sb, "", 0 );
 225  
 
 226  0
                 append( sb, "profiles", 2 );
 227  0
                 append( sb, "List of profile identifiers to explicitly trigger in the build.", 3 );
 228  0
                 append( sb, "", 0 );
 229  
 
 230  0
                 append( sb, "profilesFile (Default: profiles.txt)", 2 );
 231  0
                 append( sb, "Deprecated. As of version 1.2, the key invoker.profiles from the properties file specified by the parameter invokerPropertiesFile should be used instead.", 3 );
 232  0
                 append( sb, "", 0 );
 233  0
                 append( sb, "The name of the project-specific file that contains the enumeration of profiles to use for that test. If the file exists and is empty no profiles will be used even if the parameter profiles is set.", 3 );
 234  0
                 append( sb, "", 0 );
 235  
 
 236  0
                 append( sb, "projectsDirectory (Default: ${basedir}/src/it/)", 2 );
 237  0
                 append( sb, "Directory to search for integration tests.", 3 );
 238  0
                 append( sb, "", 0 );
 239  
 
 240  0
                 append( sb, "properties", 2 );
 241  0
                 append( sb, "Common set of properties to pass in on each project\'s command line, via -D parameters.", 3 );
 242  0
                 append( sb, "", 0 );
 243  
 
 244  0
                 append( sb, "settingsFile", 2 );
 245  0
                 append( sb, "Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the <localRepository> element of this settings file is always ignored, i.e. the path given by the parameter localRepositoryPath is dominant.", 3 );
 246  0
                 append( sb, "", 0 );
 247  
 
 248  0
                 append( sb, "setupIncludes", 2 );
 249  0
                 append( sb, "Include patterns for searching the projects directory for projects that need to be run before the other projects. This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects. Also, the exclusions defined by the parameter pomExcludes apply to the setup projects, too. Default value is: setup*/pom.xml.", 3 );
 250  0
                 append( sb, "", 0 );
 251  
 
 252  0
                 append( sb, "showErrors (Default: false)", 2 );
 253  0
                 append( sb, "Whether to show errors in the build output.", 3 );
 254  0
                 append( sb, "", 0 );
 255  
 
 256  0
                 append( sb, "skipInvocation (Default: false)", 2 );
 257  0
                 append( sb, "Flag used to suppress certain invocations. This is useful in tailoring the build using profiles.", 3 );
 258  0
                 append( sb, "", 0 );
 259  
 
 260  0
                 append( sb, "streamLogs (Default: false)", 2 );
 261  0
                 append( sb, "Flag used to determine whether the build logs should be output to the normal mojo log.", 3 );
 262  0
                 append( sb, "", 0 );
 263  
 
 264  0
                 append( sb, "suppressSummaries (Default: false)", 2 );
 265  0
                 append( sb, "Flag used to suppress the summary output notifying of successes and failures. If set to true, the only indication of the build\'s success or failure will be the effect it has on the main build (if it fails, the main build should fail as well). If streamLogs is enabled, the sub-build summary will also provide an indication.", 3 );
 266  0
                 append( sb, "", 0 );
 267  
 
 268  0
                 append( sb, "testProperties", 2 );
 269  0
                 append( sb, "Deprecated. As of version 1.1, use the properties parameter instead.", 3 );
 270  0
                 append( sb, "", 0 );
 271  0
                 append( sb, "Common set of test properties to pass in on each IT\'s command line, via -D parameters.", 3 );
 272  0
                 append( sb, "", 0 );
 273  
 
 274  0
                 append( sb, "testPropertiesFile (Default: test.properties)", 2 );
 275  0
                 append( sb, "Location of a properties file that defines CLI properties for the test.", 3 );
 276  0
                 append( sb, "", 0 );
 277  
             }
 278  
         }
 279  
 
 280  0
         if ( getLog().isInfoEnabled() )
 281  
         {
 282  0
             getLog().info( sb.toString() );
 283  
         }
 284  0
     }
 285  
 
 286  
     /**
 287  
      * <p>Repeat a String <code>n</code> times to form a new string.</p>
 288  
      *
 289  
      * @param str String to repeat
 290  
      * @param repeat number of times to repeat str
 291  
      * @return String with repeated String
 292  
      * @throws NegativeArraySizeException if <code>repeat < 0</code>
 293  
      * @throws NullPointerException if str is <code>null</code>
 294  
      */
 295  
     private static String repeat( String str, int repeat )
 296  
     {
 297  0
         StringBuffer buffer = new StringBuffer( repeat * str.length() );
 298  
 
 299  0
         for ( int i = 0; i < repeat; i++ )
 300  
         {
 301  0
             buffer.append( str );
 302  
         }
 303  
 
 304  0
         return buffer.toString();
 305  
     }
 306  
 
 307  
     /** 
 308  
      * Append a description to the buffer by respecting the indentSize and lineLength parameters.
 309  
      * <b>Note</b>: The last character is always a new line.
 310  
      * 
 311  
      * @param sb The buffer to append the description, not <code>null</code>.
 312  
      * @param description The description, not <code>null</code>.
 313  
      * @param indent The base indentation level of each line, must not be negative.
 314  
      */
 315  
     private void append( StringBuffer sb, String description, int indent )
 316  
     {
 317  0
         for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )
 318  
         {
 319  0
             sb.append( it.next().toString() ).append( '\n' );
 320  
         }
 321  0
     }
 322  
 
 323  
     /** 
 324  
      * Splits the specified text into lines of convenient display length.
 325  
      * 
 326  
      * @param text The text to split into lines, must not be <code>null</code>.
 327  
      * @param indent The base indentation level of each line, must not be negative.
 328  
      * @param indentSize The size of each indentation, must not be negative.
 329  
      * @param lineLength The length of the line, must not be negative.
 330  
      * @return The sequence of display lines, never <code>null</code>.
 331  
      * @throws NegativeArraySizeException if <code>indent < 0</code>
 332  
      */
 333  
     private static List toLines( String text, int indent, int indentSize, int lineLength )
 334  
     {
 335  0
         List lines = new ArrayList();
 336  
 
 337  0
         String ind = repeat( "\t", indent );
 338  0
         String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
 339  0
         for ( int i = 0; i < plainLines.length; i++ )
 340  
         {
 341  0
             toLines( lines, ind + plainLines[i], indentSize, lineLength );
 342  
         }
 343  
 
 344  0
         return lines;
 345  
     }
 346  
 
 347  
     /** 
 348  
      * Adds the specified line to the output sequence, performing line wrapping if necessary.
 349  
      * 
 350  
      * @param lines The sequence of display lines, must not be <code>null</code>.
 351  
      * @param line The line to add, must not be <code>null</code>.
 352  
      * @param indentSize The size of each indentation, must not be negative.
 353  
      * @param lineLength The length of the line, must not be negative.
 354  
      */
 355  
     private static void toLines( List lines, String line, int indentSize, int lineLength )
 356  
     {
 357  0
         int lineIndent = getIndentLevel( line );
 358  0
         StringBuffer buf = new StringBuffer( 256 );
 359  0
         String[] tokens = line.split( " +" );
 360  0
         for ( int i = 0; i < tokens.length; i++ )
 361  
         {
 362  0
             String token = tokens[i];
 363  0
             if ( i > 0 )
 364  
             {
 365  0
                 if ( buf.length() + token.length() >= lineLength )
 366  
                 {
 367  0
                     lines.add( buf.toString() );
 368  0
                     buf.setLength( 0 );
 369  0
                     buf.append( repeat( " ", lineIndent * indentSize ) );
 370  
                 }
 371  
                 else
 372  
                 {
 373  0
                     buf.append( ' ' );
 374  
                 }
 375  
             }
 376  0
             for ( int j = 0; j < token.length(); j++ )
 377  
             {
 378  0
                 char c = token.charAt( j );
 379  0
                 if ( c == '\t' )
 380  
                 {
 381  0
                     buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
 382  
                 }
 383  0
                 else if ( c == '\u00A0' )
 384  
                 {
 385  0
                     buf.append( ' ' );
 386  
                 }
 387  
                 else
 388  
                 {
 389  0
                     buf.append( c );
 390  
                 }
 391  
             }
 392  
         }
 393  0
         lines.add( buf.toString() );
 394  0
     }
 395  
 
 396  
     /** 
 397  
      * Gets the indentation level of the specified line.
 398  
      * 
 399  
      * @param line The line whose indentation level should be retrieved, must not be <code>null</code>.
 400  
      * @return The indentation level of the line.
 401  
      */
 402  
     private static int getIndentLevel( String line )
 403  
     {
 404  0
         int level = 0;
 405  0
         for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
 406  
         {
 407  0
             level++;
 408  
         }
 409  0
         for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
 410  
         {
 411  0
             if ( line.charAt( i ) == '\t' )
 412  
             {
 413  0
                 level++;
 414  0
                 break;
 415  
             }
 416  
         }
 417  0
         return level;
 418  
     }
 419  
 }