cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon Main.java
Date Mon, 21 Jul 2003 09:37:41 GMT
jefft       2003/07/21 02:37:40

  Modified:    src/java/org/apache/cocoon Main.java
  Log:
  Changes to make CLI output more cron-friendly:
   - Exit status set to 1 if any broken links are encountered
   - Lines longer than 70 chars are not wrapped
   - Broken links are reported with a line starting with 'X' instead of '*'
  
  Revision  Changes    Path
  1.11      +7 -16     cocoon-2.1/src/java/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Main.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Main.java	19 Jul 2003 12:40:44 -0000	1.10
  +++ Main.java	21 Jul 2003 09:37:40 -0000	1.11
  @@ -379,7 +379,9 @@
   
           long duration = System.currentTimeMillis() - startTimeMillis;
           System.out.println("Total time: " + (duration / 60000) + " minutes " + (duration
% 60000)/1000 + " seconds");
  -        System.exit(0);
  +
  +        int exitCode = (brokenLinks.size() == 0 ? 0 : 1);
  +        System.exit(exitCode);
       }
   
       private static boolean yesno(String in) {
  @@ -692,6 +694,7 @@
           }
   
           public void brokenLinkFound(String uri, String message) {
  +            this.print("X [0] "+uri+"\tBROKEN: "+message);
               brokenLinks.add(uri + "\t" + message);
           }
   
  @@ -739,21 +742,9 @@
                   this.print("Could not create broken link file: " + brokenLinkReportFile);
               }
           }
  -        private void print(String message) {
  -            int screenWidth = 67;
  -            int messageWidth = screenWidth - 6;
  -
  -            int messageLength = message.length(), currentStart = -messageWidth, currentEnd
= 0;
  -            do {
  -                currentStart += messageWidth;
  -                currentEnd   += messageWidth;
   
  -                if (currentEnd>messageLength) {
  -                    currentEnd=messageLength;
  -                }
  -
  -                System.out.println(message.substring(currentStart, currentEnd));
  -            } while(currentEnd < messageLength);
  +        private void print(String message) {
  +            System.out.println(message);
           }
       }
   }
  
  
  

Mime
View raw message