krysalis-version/src/java/org/krysalis/version/formatting/format DatestampedVersionFormat.java,1.1,1.2 VersionFormatImpl.java,1.5,1.6

[email protected] Tue, 25 Mar 2003 13:26:20 -0800
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/formatting/format
In directory sc8-pr-cvs1:/tmp/cvs-serv30568/src/java/org/krysalis/version/formatting/format

Modified Files:
	DatestampedVersionFormat.java VersionFormatImpl.java 
Log Message:
buildDate

Index: DatestampedVersionFormat.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/formatting/format/DatestampedVersionFormat.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DatestampedVersionFormat.java	25 Mar 2003 16:01:09 -0000	1.1
--- DatestampedVersionFormat.java	25 Mar 2003 21:26:14 -0000	1.2
***************
*** 56,63 ****
  package org.krysalis.version.formatting.format;
  
  import org.krysalis.version.formatting.exception.VersionFormatException;
  import org.krysalis.version.impl.data.VersionData;
  import org.krysalis.version.impl.data.VersionDataElement;
- import org.krysalis.version.impl.data.VersionDataElementSet;
  
  /**
--- 56,66 ----
  package org.krysalis.version.formatting.format;
  
+ import java.text.ParseException;
+ import java.util.Date;
+ 
  import org.krysalis.version.formatting.exception.VersionFormatException;
+ import org.krysalis.version.impl.VersionImplementationConstants;
  import org.krysalis.version.impl.data.VersionData;
  import org.krysalis.version.impl.data.VersionDataElement;
  
  /**
***************
*** 65,68 ****
--- 68,72 ----
   */
  public class DatestampedVersionFormat extends VersionFormatImpl {
+ 
      public DatestampedVersionFormat() {
      }
***************
*** 91,115 ****
      public VersionData parseVersion(String versionString)
          throws VersionFormatException {
-         VersionData data = null;
- 
-         int elements = VersionDataElement.ELEMENT_BUILD_NUMBER;
  
!         int buildNumber =
!             parseInt(
!                 versionString,
!                 VersionDataElement.BUILD_NUMBER,
!                 versionString);
  
!         data =
!             new VersionData(
!                 new VersionDataElementSet(elements),
!                 VersionDataElement.UNSET_MAJOR,
!                 VersionDataElement.UNSET_MINOR,
!                 VersionDataElement.UNSET_RELEASE_LEVEL,
!                 VersionDataElement.UNSET_RELEASE_QUALIFIER,
!                 VersionDataElement.UNSET_POINT,
!                 buildNumber);
  
!         return data;
      }
  
--- 95,118 ----
      public VersionData parseVersion(String versionString)
          throws VersionFormatException {
  
!         Date value = null;
  
!         try {
!             value = VersionImplementationConstants.DATE_FORMAT.parse(versionString);
!         }
!         catch (ParseException pe) {
!             throw new VersionFormatException(
!                 this,
!                 "Bad Date Value ["
!                     + versionString
!                     + "] in ["
!                     + versionString
!                     + "] for ["
!                     + VersionDataElement.ELEMENT_BUILD_DATE
!                     + "]",
!                 pe);
!         }
  
!         return new VersionData(value);
      }
  
***************
*** 117,121 ****
          StringBuffer output = new StringBuffer();
  
!         output.append(Integer.toString(data.getBuildNumber()));
  
          return output.toString();
--- 120,124 ----
          StringBuffer output = new StringBuffer();
  
!         output.append(VersionImplementationConstants.DATE_FORMAT.format(data.getBuildDate()));
  
          return output.toString();

Index: VersionFormatImpl.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/formatting/format/VersionFormatImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** VersionFormatImpl.java	24 Mar 2003 01:25:45 -0000	1.5
--- VersionFormatImpl.java	25 Mar 2003 21:26:15 -0000	1.6
***************
*** 57,60 ****
--- 57,64 ----
  
  import java.io.PrintWriter;
+ import java.text.DateFormat;
+ import java.text.ParseException;
+ import java.text.SimpleDateFormat;
+ import java.util.Date;
  
  import org.krysalis.version.exception.VersionException;
***************
*** 85,92 ****
          String data)
          throws VersionFormatException {
!         int value = -1;
  
          try {
!             value = Integer.parseInt(data);
          }
          catch (NumberFormatException nfe) {
--- 89,96 ----
          String data)
          throws VersionFormatException {
!         int value = (int)-1;
  
          try {
!             value = Integer.parseInt(data, 10);
          }
          catch (NumberFormatException nfe) {
***************
*** 105,108 ****
--- 109,113 ----
          return value;
      }
+     
  
      public ReleaseLevel parseReleaseLevel(




-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en