Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-6168

Got IllegalArgumentException when redirect undeploy output to a file on windows if server folder name is very long

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.1, 2.2, 3.0.0
    • 2.1.8, 2.2.2, 3.0.0
    • commands
    • Security Level: public (Regular issues)
    • None

    Description

      C:\Program Files\ISS\SiteProtector>"C:\Program Files\ISS\SiteProtector\JRE1.6.0_SR9\bin\java.exe" -jar "C:\Program Files\ISS\SiteProtector\JavaEE\Geronimo2.1.7\bin\deployer.jar" --offline undeploy "iss/HelpServer/1.0/war" > trunk.txt
      There will be an IllegalArgumentException exception as below:

      Exception in thread "main" java.lang.IllegalArgumentException: Need at least 10 spaces for printing, but indent=4 and endCol=1
      at org.apache.geronimo.deployment.cli.DeployUtils.println(DeployUtils.java:116)
      at org.apache.geronimo.deployment.cli.CommandStart.execute(CommandStart.java:66)
      at org.apache.geronimo.deployment.cli.DeployTool.execute(DeployTool.java:171)
      at org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main(MainConfigurationBootstrapper.java:45)
      at org.apache.geronimo.cli.AbstractCLI.executeMain(AbstractCLI.java:67)
      at org.apache.geronimo.cli.deployer.DeployerCLI.main(DeployerCLI.java:31)
      ----- End of batch file output --------

      Error: The process returned 1.

      In deploy command, we are using ConsoleReader.printString, no this kind of error.

      But in undeploy command, we are using DeployUtil.println, which has some terminal width check, this will make error on windows if server folder and command is too long

      int endCol = consoleReader.getTermwidth();
      int start = consoleReader.getCursorBuffer().cursor;

      // some terminals will give a terminal width of zero (e.g. emacs shell).
      // in that case, default to a reasonable term width value.
      if (endCol == 0)

      { endCol = DEFAULT_WIDTH; }

      if (endCol - indent < 10)

      { throw new IllegalArgumentException("Need at least 10 spaces for " + "printing, but indent=" + indent + " and endCol=" + endCol); }

      Change DeployUtil.println method to ConsoleReader.printString

      Attachments

        Activity

          People

            viola.lu viola.lu
            viola.lu viola.lu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: