You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2014/01/13 20:54:00 UTC

svn commit: r1557830 - in /db/derby/code/branches/10.7: ./ java/build/org/apache/derbyPreBuild/ReleaseProperties.java

Author: rhillegas
Date: Mon Jan 13 19:54:00 2014
New Revision: 1557830

URL: http://svn.apache.org/r1557830
Log:
DERBY-5463: Port 1557823 from trunk to 10.7 branch.

Modified:
    db/derby/code/branches/10.7/   (props changed)
    db/derby/code/branches/10.7/java/build/org/apache/derbyPreBuild/ReleaseProperties.java

Propchange: db/derby/code/branches/10.7/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1557823

Modified: db/derby/code/branches/10.7/java/build/org/apache/derbyPreBuild/ReleaseProperties.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/build/org/apache/derbyPreBuild/ReleaseProperties.java?rev=1557830&r1=1557829&r2=1557830&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/build/org/apache/derbyPreBuild/ReleaseProperties.java (original)
+++ db/derby/code/branches/10.7/java/build/org/apache/derbyPreBuild/ReleaseProperties.java Mon Jan 13 19:54:00 2014
@@ -22,10 +22,12 @@
 package org.apache.derbyPreBuild;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Calendar;
+import java.util.Properties;
 import java.util.StringTokenizer;
 
 import org.apache.tools.ant.BuildException;
@@ -77,6 +79,9 @@ public class ReleaseProperties extends T
 	public final static int	MAINT_ENCODING = 1000000;
     private final static int MAINT_LENGTH = 7;
 
+    private final   static  String  DRDA_MAINT = "drdamaint";
+    private final   static  int DRDA_MAINT_ID_DEFAULT = 0;
+
     // properties to set on the way out
     private static final String NEW_RELEASE_ID = "derby.release.id.new";
 
@@ -139,6 +144,9 @@ public class ReleaseProperties extends T
         PrintWriter    propertiesPW = null;
 
         try {
+            int     drdaMaintID = readDRDAMaintID( target );
+            System.out.println( "XXX ReleaseProperties. drda maint id = " + drdaMaintID );
+            
             VersionID versionID = new VersionID( _releaseID );
             if ( _bump ) { versionID.bump(); }
             
@@ -151,7 +159,7 @@ public class ReleaseProperties extends T
 
             propertiesPW.println( APACHE_LICENSE_HEADER );
 
-            propertiesPW.println( "drdamaint=0" );
+            propertiesPW.println( DRDA_MAINT + "=" + drdaMaintID );
             propertiesPW.println( "maint=" + encodeFixpackAndPoint( versionID ) );
             propertiesPW.println( "major=" + major );
             propertiesPW.println( "minor=" + minor );
@@ -233,6 +241,25 @@ public class ReleaseProperties extends T
         pw.close();
         fw.close();
     }
+
+    /**
+     * <p>
+     * Read the DRDA maintenance id from the existing release properties.
+     * Returns 0 if the release properties file doesn't exist.
+     * </p>
+     */
+    private int readDRDAMaintID( File inputFile )
+        throws Exception
+    {
+        if ( !inputFile.exists() ) { return DRDA_MAINT_ID_DEFAULT; }
+        
+        Properties  releaseProperties = new Properties();
+        releaseProperties.load( new FileInputStream( inputFile ) );
+
+        String  stringValue = releaseProperties.getProperty( DRDA_MAINT );
+
+        return Integer.parseInt( stringValue );
+    }
     
     /////////////////////////////////////////////////////////////////////////
     //