Files
libreoffice/jvmfwk/source/libxmlutil.cxx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

137 lines
2.8 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
tdf#124503: Support JRE installations with unknown java.vendor property After recent additions of 61c4f96d6ae6a80370774e53287edb27cbce8067 "Support AdoptOpenJDK" and 41507db590b24e1b9b45d95cad55c71ba2e4091d "Support Amazon Corretto" to our hard-coded list, there is now reports that at least Debian and Ubuntu tried to distribute versions of OpenJDK with the java.vendor propety set to string like "Debian" or "Ubuntu". Instead of trying to catch up with an ever-growing hard-coded list, it is probably better to stop relying exclusively on such a hard-coded list, and for unknown vendor values, try out whether the SunInfo backend (which supports the "generic" OpenJDK) would be able to handle the given JRE. (For simplicity, assume that any versions of such JREs are supported. Our baseline is Java 6, and there are unlikely any older versions of JREs from unknown vendors out there. If this turns out to be problematic, we could include information about problematic vendors after all, or add a general check that JREs from unknown vendors are at least Java 6.) Many functions in jvmfwk/inc/vendorplugin.hxx that used to take a set of sVendor/sMinVersion/sMaxVerison/arExcludeList paramters had to be revised to take a vendorSettings parameter instead, and VendorSettings::getVersionInformation has been changed to return a boost::optional, so that unknown vendors can be handled gracefully. Change-Id: Ibf915f2ddd59e09b77e2c03be688cac0547b9ac9 Reviewed-on: https://gerrit.libreoffice.org/70460 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-04-09 14:51:54 +02:00
#include <libxmlutil.hxx>
2004-04-19 14:57:02 +00:00
namespace jfw
{
CXPathObjectPtr::CXPathObjectPtr():_object(nullptr)
2004-04-19 14:57:02 +00:00
{
}
CXPathObjectPtr::CXPathObjectPtr(xmlXPathObject* pObj):_object(pObj)
{
}
2004-04-19 14:57:02 +00:00
CXPathObjectPtr::~CXPathObjectPtr()
{
xmlXPathFreeObject(_object);
}
CXPathObjectPtr & CXPathObjectPtr::operator = (xmlXPathObject* pObj)
{
if (_object == pObj)
return *this;
xmlXPathFreeObject(_object);
_object = pObj;
return *this;
}
2004-04-27 14:22:15 +00:00
CXPathContextPtr::CXPathContextPtr(xmlXPathContextPtr aContext)
2004-04-19 14:57:02 +00:00
: _object(aContext)
{
}
CXPathContextPtr::CXPathContextPtr():_object(nullptr)
2004-04-19 14:57:02 +00:00
{
}
CXPathContextPtr::~CXPathContextPtr()
{
xmlXPathFreeContext(_object);
}
2004-04-27 14:22:15 +00:00
CXPathContextPtr & CXPathContextPtr::operator = (xmlXPathContextPtr pObj)
2004-04-19 14:57:02 +00:00
{
if (_object == pObj)
return *this;
xmlXPathFreeContext(_object);
_object = pObj;
return *this;
}
2004-04-19 14:57:02 +00:00
CXmlDocPtr::CXmlDocPtr(xmlDoc* aDoc)
: _object(aDoc)
{
}
CXmlDocPtr::CXmlDocPtr():_object(nullptr)
2004-04-19 14:57:02 +00:00
{
}
CXmlDocPtr::~CXmlDocPtr()
{
xmlFreeDoc(_object);
}
CXmlDocPtr & CXmlDocPtr::operator = (xmlDoc* pObj)
{
if (_object == pObj)
return *this;
xmlFreeDoc(_object);
_object = pObj;
return *this;
}
2004-04-27 14:22:15 +00:00
CXmlCharPtr::CXmlCharPtr(xmlChar * aChar)
2004-04-19 14:57:02 +00:00
: _object(aChar)
{
}
CXmlCharPtr::CXmlCharPtr(const OUString & s):
_object(nullptr)
{
OString o = OUStringToOString(s, RTL_TEXTENCODING_UTF8);
_object = xmlCharStrdup(o.getStr());
}
CXmlCharPtr::CXmlCharPtr():_object(nullptr)
2004-04-19 14:57:02 +00:00
{
}
CXmlCharPtr::~CXmlCharPtr()
{
xmlFree(_object);
}
CXmlCharPtr & CXmlCharPtr::operator = (xmlChar* pObj)
{
if (pObj == _object)
return *this;
xmlFree(_object);
_object = pObj;
return *this;
}
CXmlCharPtr::operator OUString()
2004-04-19 14:57:02 +00:00
{
OUString ret;
if (_object != nullptr)
2004-04-19 14:57:02 +00:00
{
OString aOStr(reinterpret_cast<char*>(_object));
ret = OStringToOUString(aOStr, RTL_TEXTENCODING_UTF8);
2004-04-19 14:57:02 +00:00
}
return ret;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */