Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5032603

(prop) No way to prevent date stamp in java.util.Properties.store()

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • None
    • 1.4.2
    • core-libs
    • Fix Understood
    • x86
    • linux

    Description

      Name: rmT116609 Date: 04/15/2004


      A DESCRIPTION OF THE REQUEST :
      Every time a properties file is written with the provided methods a date stamp comment is added at the top. While this is a cool feature, desireable in many applications, it would be helpful if an alternate version of the store method could be added.(perhaps public void store(OutputStream, String, boolean) where the boolean indicates if the date stamp should be applied).

      JUSTIFICATION :
      This becomes important if the Properties file is being stored in version control systems, since a simple change of date stamp requires a new check in for the file.

      This specifically impacts the use of the <symlink> task (to be released in Ant 1.6) which will store a list of symlinks in a properties file and recreate them. Among other uses, this task allows one to store both the pages and the structure of a website in CVS, and use the <cvs> task to check out and build the web site. (compiling/javadocing/jaring and jar signing as needed) from the repository. Currently however this functioality is marred by the fact that writing a new file changes the date stamp and forces CVS check in even if there is no change in the data being stored.

        To avoid writing files except when data is changed would incur the overhad of reading in and comparing the contents of the any previously existing properties file. This is not otherwise neccessary and more expensive than simply re-writing the file.

      Please note, that this has nothing to do with java.util.Preferences. It makes no sense to represent this data as preferences, and other than this comment line Properties is ideal for storing key/value data. The issue is storagae of key value data being separated from timestamping of the file (often available at the OS level, and no API is provided for reading back the time stamp from the comment)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A properties file with no Date Stamp.
      ACTUAL -
      All Properties files currently are written with the date stamp.

      ---------- BEGIN SOURCE ----------
      any and all invocations of java.util.Properties.store().
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      1) Write a custom class of your own trying really really hard not to peek at Sun's Source which does 99.9% of what you want already, and hope it doesn't look the same when you are done :) (aside from the lack of a Date stamp).

      2) create your own file format and your own classes for writing and reading it or adopt another less convenient format that requires a monster sized Parser that moves like lighting :)
      (Incident Review ID: 209604)
      ======================================================================
      ###@###.### 2004-11-17 20:53:23 GMT

      Attachments

        Issue Links

          Activity

            People

              sherman Xueming Shen
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: