geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r742608 - /geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
Date Mon, 09 Feb 2009 16:44:36 GMT
Author: kevan
Date: Mon Feb  9 16:44:36 2009
New Revision: 742608

URL: http://svn.apache.org/viewvc?rev=742608&view=rev
Log:
GERONIMO-4533 Default the terminal width, if the terminal width is zero. This will avoid 'This
is ridiculous' error messages

Modified:
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java?rev=742608&r1=742607&r2=742608&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/DeployUtils.java
Mon Feb  9 16:44:36 2009
@@ -95,13 +95,21 @@
         return buf.toString();
     }
 
+    private final static int DEFAULT_TERM_WIDTH = 256;
+
     public static void println(String line, int indent, ConsoleReader consoleReader) throws
IOException {
         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_TERM_WIDTH;
+        }
+
         if (endCol - indent < 10) {
             throw new IllegalArgumentException("This is ridiculous!");
         }
-//        StringBuffer buf = new StringBuffer((int)(source.length()*1.1));
         String prefix = indent == 0 ? "" : buildIndent(indent);
         int pos;
         while (line.length() > 0) {



Mime
View raw message