Fixed issue 22449. Load.logoimages will be forked to mitigate some problems.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Tue, 04 Dec 2012 11:08:22 +0100
changeset 18802 fd15aaac6749
parent 18801 c85d7947580f
child 18803 fe0bfbead99c
child 18965 5c42e81356ae
Fixed issue 22449. Load.logoimages will be forked to mitigate some problems.
build.xml
src/build.xml
src/org/openbravo/erpCommon/utility/ImageToDatabaseLoader.java
--- a/build.xml	Mon Dec 03 12:51:38 2012 +0100
+++ b/build.xml	Tue Dec 04 11:08:22 2012 +0100
@@ -1108,6 +1108,10 @@
   </target>
   
   
+  <target name="load.logoimages.forked">
+    <ant dir="${base.src}" target="load.logoimages.forked" inheritAll="true" inheritRefs="true" />
+  </target>
+
   <target name="load.logoimages">
     <ant dir="${base.src}" target="load.logoimages" inheritAll="true" inheritRefs="true" />
   </target>
--- a/src/build.xml	Mon Dec 03 12:51:38 2012 +0100
+++ b/src/build.xml	Tue Dec 04 11:08:22 2012 +0100
@@ -116,8 +116,8 @@
     </taskdef>
     <validateModules userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" moduleJavaPackage="${module}"/>
   </target>
-  
-  <target name="load.logoimages">
+
+  <target name="load.logoimages.forked">
     <taskdef name="imageloading" classname="org.openbravo.erpCommon.utility.ImageToDatabaseLoader">
       <classpath refid="project.class.path" />
     </taskdef>
@@ -126,6 +126,13 @@
       propertyNames="yourCompanyLoginImage,yourItServiceLoginImage,yourCompanyMenuImage,yourCompanyBigImage,yourCompanyDocumentImage"/>
   </target>
 
+  <target name="load.logoimages">
+    <java classname="org.openbravo.erpCommon.utility.ImageToDatabaseLoader" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
+      <arg line="'${base.src}'" />
+      <classpath refid="apply.module.runtime.classpath" />
+    </java>
+  </target>
+  
   <target name="trl.clean" if="translation">
     <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
       <arg line="clean '${base.config}/Openbravo.properties'" />
--- a/src/org/openbravo/erpCommon/utility/ImageToDatabaseLoader.java	Mon Dec 03 12:51:38 2012 +0100
+++ b/src/org/openbravo/erpCommon/utility/ImageToDatabaseLoader.java	Tue Dec 04 11:08:22 2012 +0100
@@ -4,6 +4,8 @@
 import java.io.FileInputStream;
 import java.io.InputStream;
 
+import org.openbravo.base.AntExecutor;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.base.provider.OBProvider;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
@@ -22,6 +24,19 @@
   private String basePath;
   private String propertyNames;
 
+  public static void main(String[] args) {
+    final String srcPath = args[0];
+    final File srcDir = new File(srcPath);
+    final File baseDir = srcDir.getParentFile();
+    try {
+      final AntExecutor antExecutor = new AntExecutor(baseDir.getAbsolutePath());
+      antExecutor.runTask("load.logoimages.forked");
+    } catch (final Exception e) {
+      e.printStackTrace();
+      throw new OBException(e);
+    }
+  }
+
   @Override
   public void doExecute() {