Geronimo
  1. Geronimo
  2. GERONIMO-6168

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.2, 3.0.0
    • Fix Version/s: 2.1.8, 2.2.2, 3.0.0
    • Component/s: commands
    • Security Level: public (Regular issues)
    • Labels:
      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

        Activity

        viola.lu created issue -
        Show
        viola.lu added a comment - http://apache-geronimo.328035.n3.nabble.com/Error-on-calling-undeploy-command-using-java-lang-Process-td2936150.html
        viola.lu made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development