Fixes issue 15081 You cannot update from RC2 to the latest MP
authorMartin Taal <martin.taal@openbravo.com>
Mon, 01 Nov 2010 15:27:53 +0100
changeset 8784 0ead9342d172
parent 8783 beedd2ff8f70
child 8785 ea6d8848a675
Fixes issue 15081 You cannot update from RC2 to the latest MP
build.xml
src/org/openbravo/erpCommon/modules/ApplyModuleTask.java
--- a/build.xml	Thu Oct 28 16:03:36 2010 +0200
+++ b/build.xml	Mon Nov 01 15:27:53 2010 +0100
@@ -766,7 +766,7 @@
   -->
   <target name="apply.module" depends="compile.apply.module">
     <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
-      <arg line="'${base.src}'" />
+      <arg line="'${base.src}' '${friendlyWarnings}'" />
       <classpath refid="apply.module.runtime.classpath" />
     </java>
    <delete includeEmptyDirs="true"  dir="${build.apply.module}" />
--- a/src/org/openbravo/erpCommon/modules/ApplyModuleTask.java	Thu Oct 28 16:03:36 2010 +0200
+++ b/src/org/openbravo/erpCommon/modules/ApplyModuleTask.java	Mon Nov 01 15:27:53 2010 +0100
@@ -25,6 +25,7 @@
 import org.apache.tools.ant.BuildException;
 import org.openbravo.base.AntExecutor;
 import org.openbravo.base.exception.OBException;
+import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.dal.core.DalInitializingTask;
 import org.openbravo.database.CPStandAlone;
 
@@ -39,10 +40,15 @@
 
   public static void main(String[] args) {
     final String srcPath = args[0];
+    String friendlyWarnings = "false";
+    if (args.length >= 2) {
+      friendlyWarnings = args[1];
+    }
     final File srcDir = new File(srcPath);
     final File baseDir = srcDir.getParentFile();
     try {
       final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath());
+      antExecutor.setProperty("friendlyWarnings", friendlyWarnings);
       antExecutor.runTask("apply.module.forked");
     } catch (final Exception e) {
       throw new OBException(e);
@@ -50,6 +56,11 @@
   }
 
   public void execute() {
+    // always do friendly warnings for the dal layer during apply module
+    // the unfriendly warnings are shown in generate.entities anyway
+    // if the correct property is not set.
+    OBPropertiesProvider.setFriendlyWarnings(true);
+
     // Initialize DAL only in case it is needed: modules have refrence data to be loaded
     CPStandAlone pool = new CPStandAlone(propertiesFile);
     ApplyModuleData[] ds = null;
@@ -75,6 +86,14 @@
     }
   }
 
+  public boolean getFriendlyWarnings() {
+    return OBPropertiesProvider.isFriendlyWarnings();
+  }
+
+  public void setFriendlyWarnings(boolean doFriendlyWarnings) {
+    OBPropertiesProvider.setFriendlyWarnings(doFriendlyWarnings);
+  }
+
   @Override
   public void doExecute() {
     try {