sbailliez    2002/08/28 06:08:00

  Modified:    src/main/org/apache/tools/ant/taskdefs/cvslib Tag:
                        ANT_15_BRANCH ChangeLogParser.java
                        ChangeLogWriter.java
  Log:
  Backport  PR 11582 fix from HEAD related to 24 hours date/time format
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.14.2.1  +13 -7     
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
  
  Index: ChangeLogParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java,v
  retrieving revision 1.14
  retrieving revision 1.14.2.1
  diff -u -r1.14 -r1.14.2.1
  --- ChangeLogParser.java      15 Apr 2002 23:53:14 -0000      1.14
  +++ ChangeLogParser.java      28 Aug 2002 13:08:00 -0000      1.14.2.1
  @@ -58,6 +58,7 @@
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.util.TimeZone;
   
   /**
    * A class used to parse the output of the CVS log command.
  @@ -74,8 +75,13 @@
       private static final int GET_PREVIOUS_REV = 5;
   
       /** input format for dates read in from cvs log */
  -    private static final SimpleDateFormat c_inputDate 
  -        = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
  +    private static final SimpleDateFormat c_inputDate
  +        = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
  +
  +    static {
  +        TimeZone utc = TimeZone.getTimeZone("UTC");
  +        c_inputDate.setTimeZone(utc);
  +    }
   
       //The following is data used while processing stdout of CVS command
       private String m_file;
  @@ -142,13 +148,13 @@
           if (line.startsWith("======")) {
               //We have ended changelog for that particular file
               //so we can save it
  -            final int end 
  +            final int end
                   = m_comment.length() - lineSeparator.length(); //was -1
               m_comment = m_comment.substring(0, end);
               saveEntry();
               m_status = GET_FILE;
           } else if (line.startsWith("----------------------------")) {
  -            final int end 
  +            final int end
                   = m_comment.length() - lineSeparator.length(); //was -1
               m_comment = m_comment.substring(0, end);
               m_status = GET_PREVIOUS_REV;
  @@ -211,7 +217,7 @@
        */
       private void processGetPreviousRevision(final String line) {
           if (!line.startsWith("revision")) {
  -            throw new IllegalStateException("Unexpected line from CVS: " 
  +            throw new IllegalStateException("Unexpected line from CVS: "
                   + line);
           }
           m_previousRevision = line.substring(9);
  @@ -253,4 +259,4 @@
               return null;
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  
  1.6.2.1   +8 -2      
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
  
  Index: ChangeLogWriter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- ChangeLogWriter.java      15 Apr 2002 15:33:11 -0000      1.6
  +++ ChangeLogWriter.java      28 Aug 2002 13:08:00 -0000      1.6.2.1
  @@ -56,6 +56,7 @@
   import java.io.PrintWriter;
   import java.text.SimpleDateFormat;
   import java.util.Enumeration;
  +import java.util.TimeZone;
   
   /**
    * Class used to generate an XML changelog.
  @@ -69,8 +70,13 @@
           = new SimpleDateFormat("yyyy-MM-dd");
       /** output format for times writtn to xml file */
       private static final SimpleDateFormat c_outputTime 
  -        = new SimpleDateFormat("hh:mm");
  +        = new SimpleDateFormat("HH:mm");
   
  +    static {
  +        TimeZone utc = TimeZone.getTimeZone("UTC");
  +        c_outputDate.setTimeZone(utc);
  +        c_outputTime.setTimeZone(utc);
  +    }
   
       /**
        * Print out the specifed entrys.
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to