Fixes Issue 20623 : Modifications made to ant task
authorShankar Balachandran <shankar.balachandran@openbravo.com>
Thu, 18 Jul 2013 18:46:02 +0530
changeset 20765 091b2c16deaf
parent 20764 78ca177ad70d
child 20767 da03f922c584
Fixes Issue 20623 : Modifications made to ant task

The ant task definition has been modified from java type to taskdef to enable execution without main method.
build.xml
src/org/openbravo/erpCommon/utility/MigrateAttachments.java
--- a/build.xml	Thu Jul 18 09:31:04 2013 +0530
+++ b/build.xml	Thu Jul 18 18:46:02 2013 +0530
@@ -372,9 +372,10 @@
   </target>
 
   <target name="migrate.attachments" depends="init">
-    <java classname="org.openbravo.erpCommon.utility.MigrateAttachments" fork="true" failonerror="yes" jvm="${env.JAVA_HOME}/bin/java">
+    <taskdef name="MigrateAttachments" classname="org.openbravo.erpCommon.utility.MigrateAttachments" >
       <classpath refid="project.class.path" />
-    </java>
+    </taskdef>
+    <MigrateAttachments/>
   </target>
 
   <target name="smartbuild" depends="init">
--- a/src/org/openbravo/erpCommon/utility/MigrateAttachments.java	Thu Jul 18 09:31:04 2013 +0530
+++ b/src/org/openbravo/erpCommon/utility/MigrateAttachments.java	Thu Jul 18 18:46:02 2013 +0530
@@ -41,11 +41,16 @@
 
   private static Logger log = LoggerFactory.getLogger(MigrateAttachments.class);
 
-  public static void execute(String[] args) throws Exception {
+  @Override
+  public void execute() {
     String attachPath = OBPropertiesProvider.getInstance().getOpenbravoProperties()
         .getProperty("attach.path");
     log.info("Migrating Attachments");
-    migrateAttachments(attachPath);
+    try {
+      migrateAttachments(attachPath);
+    } catch (Exception e) {
+      log.error(e.getMessage(), e);
+    }
     log.info("Migration Successful");
   }