Kaydet (Commit) b6995199 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 7a11b9cc
...@@ -223,7 +223,9 @@ void NodeJava::load() ...@@ -223,7 +223,9 @@ void NodeJava::load()
//we do not support yet to write into the shared installation //we do not support yet to write into the shared installation
//check if shared settings exist at all. //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) if (s == FILE_INVALID)
throw FrameworkException( throw FrameworkException(
JFW_E_ERROR, JFW_E_ERROR,
...@@ -234,7 +236,11 @@ void NodeJava::load() ...@@ -234,7 +236,11 @@ void NodeJava::load()
} }
else if (USER == m_layer) else if (USER == m_layer)
{ {
prepareSettingsDocument(); if (!prepareSettingsDocument())
{
SAL_INFO("jvmfwk", "no path to load user settings document from");
return;
}
} }
else else
{ {
...@@ -383,12 +389,15 @@ void NodeJava::load() ...@@ -383,12 +389,15 @@ void NodeJava::load()
return ret; return ret;
} }
void NodeJava::prepareSettingsDocument() const bool NodeJava::prepareSettingsDocument() const
{ {
rtl::OString sExcMsg( rtl::OString sExcMsg(
"[Java framework] Error in function prepareSettingsDocument" "[Java framework] Error in function prepareSettingsDocument"
" (elements.cxx)."); " (elements.cxx).");
createSettingsDocument(); if (!createSettingsDocument())
{
return false;
}
rtl::OString sSettings = getSettingsPath(); rtl::OString sSettings = getSettingsPath();
CXmlDocPtr doc(xmlParseFile(sSettings.getStr())); CXmlDocPtr doc(xmlParseFile(sSettings.getStr()));
if (!doc) if (!doc)
...@@ -402,6 +411,7 @@ void NodeJava::prepareSettingsDocument() const ...@@ -402,6 +411,7 @@ void NodeJava::prepareSettingsDocument() const
sSettings.getStr(), doc,"UTF-8", 1) == -1) sSettings.getStr(), doc,"UTF-8", 1) == -1)
throw FrameworkException(JFW_E_ERROR, sExcMsg); throw FrameworkException(JFW_E_ERROR, sExcMsg);
} }
return true;
} }
void NodeJava::write() const void NodeJava::write() const
...@@ -412,7 +422,11 @@ void NodeJava::write() const ...@@ -412,7 +422,11 @@ void NodeJava::write() const
CXPathContextPtr contextUser; CXPathContextPtr contextUser;
CXPathObjectPtr pathObj; CXPathObjectPtr pathObj;
prepareSettingsDocument(); if (!prepareSettingsDocument())
{
SAL_INFO("jvmfwk", "no path to write settings document to");
return;
}
//Read the user elements //Read the user elements
rtl::OString sSettingsPath = getSettingsPath(); rtl::OString sSettingsPath = getSettingsPath();
...@@ -689,11 +703,10 @@ const boost::optional<CNodeJavaInfo> & NodeJava::getJavaInfo() const ...@@ -689,11 +703,10 @@ const boost::optional<CNodeJavaInfo> & NodeJava::getJavaInfo() const
return m_javaInfo; return m_javaInfo;
} }
jfw::FileStatus NodeJava::checkSettingsFileStatus() const jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL) const
{ {
jfw::FileStatus ret = FILE_DOES_NOT_EXIST; jfw::FileStatus ret = FILE_DOES_NOT_EXIST;
const rtl::OUString sURL = getSettingsURL();
//check the file time //check the file time
::osl::DirectoryItem item; ::osl::DirectoryItem item;
File::RC rc = ::osl::DirectoryItem::get(sURL, item); File::RC rc = ::osl::DirectoryItem::get(sURL, item);
...@@ -725,15 +738,19 @@ jfw::FileStatus NodeJava::checkSettingsFileStatus() const ...@@ -725,15 +738,19 @@ jfw::FileStatus NodeJava::checkSettingsFileStatus() const
return ret; return ret;
} }
void NodeJava::createSettingsDocument() const bool NodeJava::createSettingsDocument() const
{ {
const rtl::OUString sURL = getSettingsURL(); const rtl::OUString sURL = getSettingsURL();
if (sURL.isEmpty())
{
return false;
}
//make sure there is a user directory //make sure there is a user directory
rtl::OString sExcMsg("[Java framework] Error in function createSettingsDocument " rtl::OString sExcMsg("[Java framework] Error in function createSettingsDocument "
"(elements.cxx)."); "(elements.cxx).");
// check if javasettings.xml already exist // check if javasettings.xml already exist
if (FILE_OK == checkSettingsFileStatus()) if (FILE_OK == checkSettingsFileStatus(sURL))
return; return true;
//make sure that the directories are created in case they do not exist //make sure that the directories are created in case they do not exist
FileBase::RC rcFile = Directory::createPath(getDirFromFile(sURL)); FileBase::RC rcFile = Directory::createPath(getDirFromFile(sURL));
...@@ -773,6 +790,7 @@ void NodeJava::createSettingsDocument() const ...@@ -773,6 +790,7 @@ void NodeJava::createSettingsDocument() const
const rtl::OString path = getSettingsPath(); const rtl::OString path = getSettingsPath();
if (xmlSaveFormatFileEnc(path.getStr(), doc,"UTF-8", 1) == -1) if (xmlSaveFormatFileEnc(path.getStr(), doc,"UTF-8", 1) == -1)
throw FrameworkException(JFW_E_ERROR, sExcMsg); throw FrameworkException(JFW_E_ERROR, sExcMsg);
return true;
} }
//===================================================================== //=====================================================================
......
...@@ -127,11 +127,11 @@ private: ...@@ -127,11 +127,11 @@ private:
@return @return
JFW_E_CONFIG_READWRITE JFW_E_CONFIG_READWRITE
*/ */
void prepareSettingsDocument() const; bool prepareSettingsDocument() const;
/** helper function for prepareSettingsDocument. /** 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 /** 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 depends on the the member m_layer and the bootstrap parameters
...@@ -145,7 +145,7 @@ private: ...@@ -145,7 +145,7 @@ private:
/** Verifies if the respective settings file exist. /** 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 /** Determines the layer for which the instance the loads and writes the
data. data.
......
...@@ -245,16 +245,12 @@ locations for types.rdb and services.rdb files: ...@@ -245,16 +245,12 @@ locations for types.rdb and services.rdb files:
Linux x86, Solaris x86, and Solaris SPARC: Linux x86, Solaris x86, and Solaris SPARC:
- <URE installation>/share/misc/ types.rdb and services.rdb, respectively - <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 - any URLs listed in the public deployment variables URE_MORE_TYPES and
URE_MORE_SERVICES, respectively URE_MORE_SERVICES, respectively
Windows: Windows:
- <URE installation>\misc\ types.rdb and services.rdb, respectively - <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 - any URLs listed in the public deployment variables URE_MORE_TYPES and
URE_MORE_SERVICES, respectively URE_MORE_SERVICES, respectively
...@@ -297,36 +293,14 @@ relevant Java settings file for information on a suitable JDK/JRE version. ...@@ -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 NOTE: On any platform, you can delete the javasettings_${_OS}_${_ARCH}.xml file
if the file contains problematic stale data. if the file contains problematic stale data.
By default, the URE searches for a Java settings file in the following By default, the URE does not search for a Java settings file, but instead
locations: searches for a suitable JDK/JRE installation whenever necessary. You can
override this by setting the URE_OVERRIDE_JAVA_JFW_SHARED_DATA and
Linux x86, Solaris x86, and Solaris SPARC: URE_OVERRIDE_JAVA_JFW_USER_DATA deployment variables. If
URE_OVERRIDE_JAVA_JFW_USER_DATA is set, the URE will update the relevant
- /etc/opt/ure/javasettings_${_OS}_${_ARCH}.xml information in
- ~/.ure/javasettings_${_OS}_${_ARCH}.xml ${URE_OVERRIDE_JAVA_JFW_USER_DATA}/javasettings_${_OS}_${_ARCH}.xml when it
searches for a suitable JDK/JRE installation. You can also use the
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
UNO_JAVA_JFW_JREHOME deployment variable to specify the location of a JDK/JRE UNO_JAVA_JFW_JREHOME deployment variable to specify the location of a JDK/JRE
installation. For more information on this variable, see installation. For more information on this variable, see
http://udk.openoffice.org/common/man/spec/javavendorextension.sxw. http://udk.openoffice.org/common/man/spec/javavendorextension.sxw.
......
[Bootstrap] [Bootstrap]
UNO_JAVA_JFW_VENDOR_SETTINGS=${ORIGIN}/../misc/javavendors.xml 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_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA}
UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA} ${SYSUSERCONFIG}/URE/javasettings_${_OS}_${_ARCH}.xml UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA}
UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS} UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS}
...@@ -17,6 +17,6 @@ ...@@ -17,6 +17,6 @@
# #
[Bootstrap] [Bootstrap]
UNO_JAVA_JFW_VENDOR_SETTINGS=${ORIGIN}/../share/misc/javavendors.xml 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_SHARED_DATA=${URE_OVERRIDE_JAVA_JFW_SHARED_DATA}
UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA} ${SYSUSERHOME}/.ure/javasettings_${_OS}_${_ARCH}.xml UNO_JAVA_JFW_USER_DATA=${URE_OVERRIDE_JAVA_JFW_USER_DATA}
UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS} UNO_JAVA_JFW_CLASSPATH_URLS=${URE_MORE_JAVA_CLASSPATH_URLS}
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
URE_INTERNAL_LIB_DIR=${ORIGIN} URE_INTERNAL_LIB_DIR=${ORIGIN}
URE_INTERNAL_JAVA_DIR=${ORIGIN}/../java URE_INTERNAL_JAVA_DIR=${ORIGIN}/../java
URE_INTERNAL_JAVA_CLASSPATH=${URE_MORE_JAVA_TYPES} URE_INTERNAL_JAVA_CLASSPATH=${URE_MORE_JAVA_TYPES}
UNO_TYPES=${ORIGIN}/../misc/types.rdb ?${SYSUSERCONFIG}/URE/types.rdb ${URE_MORE_TYPES} UNO_TYPES=${ORIGIN}/../misc/types.rdb ${URE_MORE_TYPES}
UNO_SERVICES=${ORIGIN}/../misc/services.rdb ?${SYSUSERCONFIG}/URE/services.rdb ${URE_MORE_SERVICES} UNO_SERVICES=${ORIGIN}/../misc/services.rdb ${URE_MORE_SERVICES}
...@@ -19,5 +19,5 @@ ...@@ -19,5 +19,5 @@
URE_INTERNAL_LIB_DIR=${ORIGIN} URE_INTERNAL_LIB_DIR=${ORIGIN}
URE_INTERNAL_JAVA_DIR=${ORIGIN}/../share/java URE_INTERNAL_JAVA_DIR=${ORIGIN}/../share/java
URE_INTERNAL_JAVA_CLASSPATH=${URE_MORE_JAVA_TYPES} 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_TYPES=${ORIGIN}/../share/misc/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_SERVICES=${ORIGIN}/../share/misc/services.rdb ${URE_MORE_SERVICES}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment