From d79c6de5e580f10a4d933ec094224bbf749ac0d5 Mon Sep 17 00:00:00 2001 From: hengsin Date: Tue, 10 Mar 2020 18:20:04 +0800 Subject: [PATCH] IDEMPIERE-4202 Remove java web start code and libraries --- org.adempiere.base/.classpath | 1 - org.adempiere.base/META-INF/MANIFEST.MF | 2 - org.adempiere.base/build.properties | 3 +- org.adempiere.base/pom.xml | 5 - .../src/org/compiere/util/Ini.java | 179 ++---------------- org.adempiere.server/.classpath | 2 - org.adempiere.server/META-INF/MANIFEST.MF | 4 +- org.adempiere.server/WEB-INF/web.xml | 26 --- org.adempiere.server/build.properties | 4 +- org.adempiere.server/pom.xml | 32 +--- 10 files changed, 23 insertions(+), 235 deletions(-) diff --git a/org.adempiere.base/.classpath b/org.adempiere.base/.classpath index 8d5c8a1a04..9db4307152 100644 --- a/org.adempiere.base/.classpath +++ b/org.adempiere.base/.classpath @@ -10,7 +10,6 @@ - diff --git a/org.adempiere.base/META-INF/MANIFEST.MF b/org.adempiere.base/META-INF/MANIFEST.MF index a160efbdc7..b01ef627ce 100644 --- a/org.adempiere.base/META-INF/MANIFEST.MF +++ b/org.adempiere.base/META-INF/MANIFEST.MF @@ -7,7 +7,6 @@ Bundle-ClassPath: ., lib/bsh.jar, lib/commons-validator.jar, lib/cron4j.jar, - lib/jnlp.jar, lib/avalon-framework-api.jar Export-Package: bsh, bsh.classpath, @@ -20,7 +19,6 @@ Export-Package: bsh, bsh.util, com.akunagroup.uk.postcode, it.sauronsoftware.cron4j, - javax.jnlp, org.adempiere.apps.graph, org.adempiere.base, org.adempiere.base.equinox, diff --git a/org.adempiere.base/build.properties b/org.adempiere.base/build.properties index 1d59175748..8cf631453b 100644 --- a/org.adempiere.base/build.properties +++ b/org.adempiere.base/build.properties @@ -23,8 +23,7 @@ bin.includes = plugin.xml,\ lib/avalon-framework-api.jar,\ lib/bsh.jar,\ lib/commons-validator.jar,\ - lib/cron4j.jar,\ - lib/jnlp.jar + lib/cron4j.jar src.includes = schema/ source.. = src/ output.. = target/classes/ diff --git a/org.adempiere.base/pom.xml b/org.adempiere.base/pom.xml index 89997e8bc1..5ecf2d14c4 100644 --- a/org.adempiere.base/pom.xml +++ b/org.adempiere.base/pom.xml @@ -38,11 +38,6 @@ commons-validator 1.6 - - javax.jnlp - jnlp - 1.5.0 - org.apache.avalon.framework avalon-framework-api diff --git a/org.adempiere.base/src/org/compiere/util/Ini.java b/org.adempiere.base/src/org/compiere/util/Ini.java index eb86a35569..fac55a793a 100644 --- a/org.adempiere.base/src/org/compiere/util/Ini.java +++ b/org.adempiere.base/src/org/compiere/util/Ini.java @@ -22,12 +22,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.io.Serializable; -import java.net.MalformedURLException; -import java.net.URL; import java.nio.charset.Charset; import java.sql.Timestamp; import java.util.Collection; @@ -35,12 +30,6 @@ import java.util.Enumeration; import java.util.Properties; import java.util.logging.Level; -import javax.jnlp.BasicService; -import javax.jnlp.FileContents; -import javax.jnlp.PersistenceService; -import javax.jnlp.ServiceManager; -import javax.jnlp.UnavailableServiceException; - import org.compiere.model.ModelValidationEngine; /** @@ -238,35 +227,28 @@ public final class Ini implements Serializable ModelValidationEngine.get().beforeSaveProperties(); } - if (isWebStartClient()) + String fileName = getFileName (tryUserHome); + FileOutputStream fos = null; + try { - saveWebStartProperties(); + File f = new File(fileName); + f.getAbsoluteFile().getParentFile().mkdirs(); // Create all dirs if not exist - teo_sarca FR [ 2406123 ] + fos = new FileOutputStream(f); + s_prop.store(fos, "Adempiere"); + fos.flush(); + fos.close(); } - else + catch (Exception e) { - String fileName = getFileName (tryUserHome); - FileOutputStream fos = null; - try - { - File f = new File(fileName); - f.getAbsoluteFile().getParentFile().mkdirs(); // Create all dirs if not exist - teo_sarca FR [ 2406123 ] - fos = new FileOutputStream(f); - s_prop.store(fos, "Adempiere"); - fos.flush(); - fos.close(); - } - catch (Exception e) - { - log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString()); - return; - } - catch (Throwable t) - { - log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString()); - return; - } - if (log.isLoggable(Level.FINER)) log.finer(fileName); + log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + e.toString()); + return; } + catch (Throwable t) + { + log.log(Level.SEVERE, "Cannot save Properties to " + fileName + " - " + t.toString()); + return; + } + if (log.isLoggable(Level.FINER)) log.finer(fileName); } // save /** @@ -277,133 +259,10 @@ public final class Ini implements Serializable { if (reload || s_prop.size() == 0) { - if (isWebStartClient()) - { - loadWebStartProperties(); - } - else - { - loadProperties(getFileName(s_client)); - } + loadProperties(getFileName(s_client)); } } // loadProperties - private static boolean loadWebStartProperties() { - boolean loadOK = true; - boolean firstTime = false; - s_prop = new Properties(); - - PersistenceService ps; - - try { - ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService"); - } catch (UnavailableServiceException e) { - ps = null; - log.log(Level.SEVERE, e.toString()); - return false; - } - - FileContents fc = null; - try { - fc = ps.get(getCodeBase()); - } catch (MalformedURLException e) { - log.log(Level.SEVERE, e.toString()); - return false; - } catch (FileNotFoundException e) { - try { - ps.create(getCodeBase(), 16 * 1024); - ps.setTag(getCodeBase(), PersistenceService.DIRTY); - fc = ps.get(getCodeBase()); - } catch (Exception e1) { - - } - } catch (IOException e) { - log.log(Level.SEVERE, e.toString()); - return false; - } - - try - { - if (fc != null) { - InputStream is = fc.getInputStream(); - s_prop.load(is); - is.close(); - } - } - catch (Throwable t) - { - log.log(Level.SEVERE, t.toString()); - loadOK = false; - } - if (!loadOK || s_prop.getProperty(P_TODAY, "").equals("")) - { - firstTime = true; - } - - checkProperties(); - - // Save if not exist or could not be read - if (!loadOK || firstTime) - saveWebStartProperties(); - s_loaded = true; - s_propertyFileName = getCodeBase().toString(); - - return firstTime; - - } - - private static void saveWebStartProperties() { - PersistenceService ps; - - try { - ps = (PersistenceService)ServiceManager.lookup("javax.jnlp.PersistenceService"); - } catch (UnavailableServiceException e) { - ps = null; - log.log(Level.SEVERE, e.toString()); - return; - } - - try - { - OutputStream os = ps.get(getCodeBase()).getOutputStream(true); - s_prop.store(os, "Adempiere"); - os.flush(); - os.close(); - } - catch (Throwable t) - { - log.log(Level.SEVERE, "Cannot save Properties to " + getCodeBase() + " - " + t.toString()); - return; - } - - } - - /** - * Get JNLP CodeBase - * @return code base or null - */ - public static URL getCodeBase() - { - try - { - BasicService bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService"); - URL url = bs.getCodeBase(); - return url; - } - catch(UnavailableServiceException ue) - { - return null; - } - } // getCodeBase - - /** - * @return True if client is started using web start - */ - public static boolean isWebStartClient() - { - return getCodeBase() != null; - } - /** * Load INI parameters from filename. * Logger is on default level (INFO) diff --git a/org.adempiere.server/.classpath b/org.adempiere.server/.classpath index 581de6dd1b..5fc3e08d0c 100644 --- a/org.adempiere.server/.classpath +++ b/org.adempiere.server/.classpath @@ -10,7 +10,5 @@ - - diff --git a/org.adempiere.server/META-INF/MANIFEST.MF b/org.adempiere.server/META-INF/MANIFEST.MF index ddf90d094b..04ae659eff 100644 --- a/org.adempiere.server/META-INF/MANIFEST.MF +++ b/org.adempiere.server/META-INF/MANIFEST.MF @@ -9,9 +9,7 @@ Require-Bundle: org.adempiere.base;bundle-version="0.0.0", Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=11))" Web-ContextPath: / -Bundle-ClassPath: ., - WEB-INF/lib/jnlp-jardiff.jar, - WEB-INF/lib/jnlp-servlet.jar +Bundle-ClassPath: . Import-Package: javax.jms;version="1.1.0", javax.mail;version="1.5", javax.servlet;version="3.0.0", diff --git a/org.adempiere.server/WEB-INF/web.xml b/org.adempiere.server/WEB-INF/web.xml index 286d826c1f..b7f5427f07 100644 --- a/org.adempiere.server/WEB-INF/web.xml +++ b/org.adempiere.server/WEB-INF/web.xml @@ -22,16 +22,6 @@ idempiereMonitorFilter /idempiereMonitor/* - - JNLP Download Servlet - JnlpDownloadServlet - jnlp.sample.servlet.JnlpDownloadServlet - - logLevel - INFORMATIONAL - - 1 -