jvmfwk/source/elements.cxx |   38 ++++++++++++++++++++++++++++----------
 jvmfwk/source/elements.hxx |    6 +++---
 ure/source/README          |   42 ++++++++----------------------------------
 ure/source/jvmfwk3.ini     |    4 ++--
 ure/source/jvmfwk3rc       |    4 ++--
 ure/source/uno.ini         |    4 ++--
 ure/source/unorc           |    4 ++--
 7 files changed, 47 insertions(+), 55 deletions(-)

New commits:
commit b69951996967a1c79e3a55dd13dd5609b19db6a1
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Thu Nov 15 12:40:40 2012 +0100

    Drop support for /etc/opt/ure and ~/.ure from LibreOffice 4
    
    For one, /etc/opt/ure was probably never used by anyone anyway, so meant 
just
    needless file-stats during startup.  For another, accidentally created
    ~/.ure/javasettings_*.xml that later became stale were noted to cause 
trouble,
    so that source is now closed.
    
    For this to work, jvmfwk needs to be silent now if it cannot read/write any
    shared/user javasettings_*.xml.
    
    Change-Id: I332b5ebb9549dc6ccf7c99c439d9a3b61aeb5829

diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index a395717..c544d45 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -223,7 +223,9 @@ void NodeJava::load()
         //we do not support yet to write into the shared installation
 
         //check if shared settings exist at all.
-        jfw::FileStatus s = checkFileURL(BootParams::getSharedData());
+        OUString sURL(BootParams::getSharedData());
+        jfw::FileStatus s = sURL.isEmpty()
+            ? FILE_DOES_NOT_EXIST : checkFileURL(sURL);
         if (s == FILE_INVALID)
             throw FrameworkException(
                 JFW_E_ERROR,
@@ -234,7 +236,11 @@ void NodeJava::load()
     }
     else if (USER == m_layer)
     {
-        prepareSettingsDocument();
+        if (!prepareSettingsDocument())
+        {
+            SAL_INFO("jvmfwk", "no path to load user settings document from");
+            return;
+        }
     }
     else
     {
@@ -383,12 +389,15 @@ void NodeJava::load()
     return ret;
 }
 
-void NodeJava::prepareSettingsDocument() const
+bool NodeJava::prepareSettingsDocument() const
 {
     rtl::OString sExcMsg(
         "[Java framework] Error in function prepareSettingsDocument"
         " (elements.cxx).");
-    createSettingsDocument();
+    if (!createSettingsDocument())
+    {
+        return false;
+    }
     rtl::OString sSettings = getSettingsPath();
     CXmlDocPtr doc(xmlParseFile(sSettings.getStr()));
     if (!doc)
@@ -402,6 +411,7 @@ void NodeJava::prepareSettingsDocument() const
                 sSettings.getStr(), doc,"UTF-8", 1) == -1)
             throw FrameworkException(JFW_E_ERROR, sExcMsg);
     }
+    return true;
 }
 
 void NodeJava::write() const
@@ -412,7 +422,11 @@ void NodeJava::write() const
     CXPathContextPtr contextUser;
     CXPathObjectPtr pathObj;
 
-    prepareSettingsDocument();
+    if (!prepareSettingsDocument())
+    {
+        SAL_INFO("jvmfwk", "no path to write settings document to");
+        return;
+    }
 
     //Read the user elements
     rtl::OString sSettingsPath = getSettingsPath();
@@ -689,11 +703,10 @@ const boost::optional<CNodeJavaInfo> & 
NodeJava::getJavaInfo() const
     return m_javaInfo;
 }
 
-jfw::FileStatus NodeJava::checkSettingsFileStatus() const
+jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL) const
 {
     jfw::FileStatus ret = FILE_DOES_NOT_EXIST;
 
-    const rtl::OUString sURL = getSettingsURL();
     //check the file time
     ::osl::DirectoryItem item;
     File::RC rc = ::osl::DirectoryItem::get(sURL, item);
@@ -725,15 +738,19 @@ jfw::FileStatus NodeJava::checkSettingsFileStatus() const
     return ret;
 }
 
-void NodeJava::createSettingsDocument() const
+bool NodeJava::createSettingsDocument() const
 {
     const rtl::OUString sURL = getSettingsURL();
+    if (sURL.isEmpty())
+    {
+        return false;
+    }
     //make sure there is a user directory
     rtl::OString sExcMsg("[Java framework] Error in function 
createSettingsDocument "
                          "(elements.cxx).");
     // check if javasettings.xml already exist
-    if (FILE_OK == checkSettingsFileStatus())
-        return;
+    if (FILE_OK == checkSettingsFileStatus(sURL))
+        return true;
 
     //make sure that the directories are created in case they do not exist
     FileBase::RC rcFile = Directory::createPath(getDirFromFile(sURL));
@@ -773,6 +790,7 @@ void NodeJava::createSettingsDocument() const
     const rtl::OString path = getSettingsPath();
     if (xmlSaveFormatFileEnc(path.getStr(), doc,"UTF-8", 1) == -1)
          throw FrameworkException(JFW_E_ERROR, sExcMsg);
+    return true;
 }
 
 //=====================================================================
diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx
index 7c99c50..507ac82 100644
--- a/jvmfwk/source/elements.hxx
+++ b/jvmfwk/source/elements.hxx
@@ -127,11 +127,11 @@ private:
         @return
         JFW_E_CONFIG_READWRITE
     */
-    void prepareSettingsDocument() const;
+    bool prepareSettingsDocument() const;
 
     /** helper function for prepareSettingsDocument.
     */
-    void createSettingsDocument() const;
+    bool createSettingsDocument() const;
 
     /** returns the system path to the data file which is to be used. The value
         depends on the the member m_layer and the bootstrap parameters
@@ -145,7 +145,7 @@ private:
 
     /** Verifies if the respective settings file exist.
      */
-    jfw::FileStatus checkSettingsFileStatus() const;
+    jfw::FileStatus checkSettingsFileStatus(OUString const & sURL) const;
 
     /** Determines the layer for which the instance the loads and writes the
         data.
diff --git a/ure/source/README b/ure/source/README
index bbc7469..2512d56 100644
--- a/ure/source/README
+++ b/ure/source/README
@@ -245,16 +245,12 @@ locations for types.rdb and services.rdb files:
 Linux x86, Solaris x86, and Solaris SPARC:
 
 - <URE installation>/share/misc/ types.rdb and services.rdb, respectively
-- /etc/opt/ure/ types.rdb and services.rdb, respectively
-- ~/.ure/ types.rdb and services.rdb, respectively
 - any URLs listed in the public deployment variables URE_MORE_TYPES and
   URE_MORE_SERVICES, respectively
 
 Windows:
 
 - <URE installation>\misc\ types.rdb and services.rdb, respectively
-- Documents and Settings\<User Name>\Application Data\URE\ types.rdb and
-  services.rdb, respectively
 - any URLs listed in the public deployment variables URE_MORE_TYPES and
   URE_MORE_SERVICES, respectively
 
@@ -297,36 +293,14 @@ relevant Java settings file for information on a suitable 
JDK/JRE version.
 NOTE: On any platform, you can delete the javasettings_${_OS}_${_ARCH}.xml file
 if the file contains problematic stale data.
 
-By default, the URE searches for a Java settings file in the following
-locations:
-
-Linux x86, Solaris x86, and Solaris SPARC:
-
-- /etc/opt/ure/javasettings_${_OS}_${_ARCH}.xml
-- ~/.ure/javasettings_${_OS}_${_ARCH}.xml
-
-NOTE: If these files do not contain information about a JDK/JRE, the URE
-searches for a suitable JDK/JRE installation and stores the relevant 
information
-in the ~/.ure/javasettings_${_OS}_${_ARCH}.xml file.  If you want all users to
-access the same JDK/JRE, log on as root and copy an existing
-~/.ure/javasettings_${_OS}_${_ARCH}.xml to
-/etc/opt/ure/javasettings_${_OS}_${_ARCH}.xml.
-
-Windows:
-
-- Documents and Settings\<User Name>\Application
-  Data\URE\javasettings_${_OS}_${_ARCH}.xml
-
-NOTE: If this file does not contain information about a JDK/JRE, the URE
-searches for a suitable JDK/JRE installation and stores the relevant 
information
-in the Documents and Settings\<User Name>\Application
-Data\URE\javasettings_${_OS}_${_ARCH}.xml file.  The URE on Windows does not
-by default support a system-wide deployment of the Java settings file.  That 
is,
-you cannot store the file in a Documents and Settings\All Users\Application
-Data\URE directory.
-
-You can override these paths by setting the URE_OVERRIDE_JAVA_JFW_SHARED_DATA
-and URE_OVERRIDE_JAVA_JFW_USER_DATA deployment variables.  You can also use the
+By default, the URE does not search for a Java settings file, but instead
+searches for a suitable JDK/JRE installation whenever necessary.  You can
+override this by setting the URE_OVERRIDE_JAVA_JFW_SHARED_DATA and
+URE_OVERRIDE_JAVA_JFW_USER_DATA deployment variables.  If
+URE_OVERRIDE_JAVA_JFW_USER_DATA is set, the URE will update the relevant
+information in
+${URE_OVERRIDE_JAVA_JFW_USER_DATA}/javasettings_${_OS}_${_ARCH}.xml when it
+searches for a suitable JDK/JRE installation.  You can also use the
 UNO_JAVA_JFW_JREHOME deployment variable to specify the location of a JDK/JRE
 installation.  For more information on this variable, see
 http://udk.openoffice.org/common/man/spec/javavendorextension.sxw.
diff --git a/ure/source/jvmfwk3.ini b/ure/source/jvmfwk3.ini
index 55c029d..18a2bb5 100644
--- a/ure/source/jvmfwk3.ini
+++ b/ure/source/jvmfwk3.ini
@@ -1,5 +1,5 @@
 [Bootstrap]
 UNO_JAVA_JFW_VENDOR_SETTINGS=${ORIGIN}/../misc/javavendors.xml
-UNO_JAVA_JFW_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA} 
${SYSUSERCONFIG}/URE/javasettings_${_OS}_${_ARCH}.xml
-UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA} 
${SYSUSERCONFIG}/URE/javasettings_${_OS}_${_ARCH}.xml
+UNO_JAVA_JFW_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA}
+UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA}
 UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS}
diff --git a/ure/source/jvmfwk3rc b/ure/source/jvmfwk3rc
index d1f79c5..01b21ce 100644
--- a/ure/source/jvmfwk3rc
+++ b/ure/source/jvmfwk3rc
@@ -17,6 +17,6 @@
 #
 [Bootstrap]
 UNO_JAVA_JFW_VENDOR_SETTINGS=${ORIGIN}/../share/misc/javavendors.xml
-UNO_JAVA_JFW_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA} 
file:///etc/opt/ure/javasettings_${_OS}_${_ARCH}.xml
-UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA} 
${SYSUSERHOME}/.ure/javasettings_${_OS}_${_ARCH}.xml
+UNO_JAVA_JFW_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA}
+UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA}
 UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS}
diff --git a/ure/source/uno.ini b/ure/source/uno.ini
index c28d5ba..6c04cae 100644
--- a/ure/source/uno.ini
+++ b/ure/source/uno.ini
@@ -19,5 +19,5 @@
 URE_INTERNAL_LIB_DIR=${ORIGIN}
 URE_INTERNAL_JAVA_DIR=${ORIGIN}/../java
 URE_INTERNAL_JAVA_CLASSPATH=${URE_MORE_JAVA_TYPES}
-UNO_TYPES=${ORIGIN}/../misc/types.rdb ?${SYSUSERCONFIG}/URE/types.rdb 
${URE_MORE_TYPES}
-UNO_SERVICES=${ORIGIN}/../misc/services.rdb ?${SYSUSERCONFIG}/URE/services.rdb 
${URE_MORE_SERVICES}
+UNO_TYPES=${ORIGIN}/../misc/types.rdb ${URE_MORE_TYPES}
+UNO_SERVICES=${ORIGIN}/../misc/services.rdb ${URE_MORE_SERVICES}
diff --git a/ure/source/unorc b/ure/source/unorc
index 7936432..1efbfe2 100644
--- a/ure/source/unorc
+++ b/ure/source/unorc
@@ -19,5 +19,5 @@
 URE_INTERNAL_LIB_DIR=${ORIGIN}
 URE_INTERNAL_JAVA_DIR=${ORIGIN}/../share/java
 URE_INTERNAL_JAVA_CLASSPATH=${URE_MORE_JAVA_TYPES}
-UNO_TYPES=${ORIGIN}/../share/misc/types.rdb ?file:///etc/opt/ure/types.rdb 
?${SYSUSERHOME}/.ure/types.rdb ${URE_MORE_TYPES}
-UNO_SERVICES=${ORIGIN}/../share/misc/services.rdb 
?file:///etc/opt/ure/services.rdb ?${SYSUSERHOME}/.ure/services.rdb 
${URE_MORE_SERVICES}
+UNO_TYPES=${ORIGIN}/../share/misc/types.rdb ${URE_MORE_TYPES}
+UNO_SERVICES=${ORIGIN}/../share/misc/services.rdb ${URE_MORE_SERVICES}
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to