fixed bug 14501
authorAsier Lostalé <asier.lostale@openbravo.com>
Mon, 13 Sep 2010 12:54:01 +0200
changeset 8385 f26df97fe120
parent 8383 08a682423cca
child 8386 21a760272789
fixed bug 14501
License restrictions file is copied to design directory so eclipse
does not delete it when rebuilding.
src/build.xml
src/org/openbravo/erpCommon/obps/ActivationKey.java
--- a/src/build.xml	Mon Sep 13 09:59:12 2010 +0200
+++ b/src/build.xml	Mon Sep 13 12:54:01 2010 +0200
@@ -502,7 +502,7 @@
     <copy todir="${build}">
       <fileset file="${base.config}/quartz.properties" />
     </copy>
-    <copy todir="${build}/org/openbravo/erpCommon/obps" file="${basedir}/org/openbravo/erpCommon/obps/licenseRestrictions"/>
+    <copy todir="${base.design}/design/org/openbravo/erpCommon/obps" file="${basedir}/org/openbravo/erpCommon/obps/licenseRestrictions"/>
     <antcall target="build.local.context" inheritAll="true" inheritrefs="true" />
   </target>
 
--- a/src/org/openbravo/erpCommon/obps/ActivationKey.java	Mon Sep 13 09:59:12 2010 +0200
+++ b/src/org/openbravo/erpCommon/obps/ActivationKey.java	Mon Sep 13 12:54:01 2010 +0200
@@ -26,7 +26,6 @@
 import java.io.InputStreamReader;
 import java.io.ObjectInputStream;
 import java.math.BigInteger;
-import java.net.URL;
 import java.security.KeyFactory;
 import java.security.PublicKey;
 import java.security.Signature;
@@ -52,6 +51,7 @@
 import org.hibernate.criterion.Order;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.dal.core.DalContextListener;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
@@ -369,10 +369,10 @@
     }
 
     try {
-      // read restriction file from this package's directory
-      URL url = this.getClass().getResource(getClass().getSimpleName() + ".class");
-      File classDir = new File(url.getPath());
-      File restrictionsFile = new File(classDir.getParent(), "licenseRestrictions");
+      // read restriction file from context directory
+      String restrictionsFilePath = DalContextListener.getServletContext().getRealPath(
+          "src-loc/design/org/openbravo/erpCommon/obps/licenseRestrictions");
+      File restrictionsFile = new File(restrictionsFilePath);
       log4j.debug("Restrictions file: " + restrictionsFile.getAbsolutePath());
 
       FileInputStream fis = new FileInputStream(restrictionsFile);