Got IllegalArgumentException when redirect undeploy output to a file on windows
if server folder name is very long
------------------------------------------------------------------------------------------------------------------
Key: GERONIMO-6168
URL: https://issues.apache.org/jira/browse/GERONIMO-6168
Project: Geronimo
Issue Type: Bug
Security Level: public (Regular issues)
Components: commands
Affects Versions: 2.2, 2.1, 3.0
Reporter: viola.lu
Assignee: viola.lu
Priority: Minor
Fix For: 2.1.8, 2.2.2, 3.0
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
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira